Skip to content

Commit

Permalink
v 0.0.4 fix error when no exiftag config given in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
benib committed Oct 13, 2015
1 parent 6a6170c commit f01512c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ These paths are relative to your sites root. Don't add leading and trailing slas
## License
Copyright (C) 2013 Beni Buess (http://benel.net/)
Copyright (C) 2013 - 2015 Beni Buess (http://benel.net/)
The MIT License
Expand Down
Binary file added jekyll-exiftag-0.0.4.gem
Binary file not shown.
6 changes: 3 additions & 3 deletions jekyll-exiftag.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |gem|
gem.name = 'jekyll-exiftag'
gem.version = '0.0.3'
gem.date = '2015-06-09'
gem.version = '0.0.4'
gem.date = '2015-10-13'
gem.summary = "jekyll-exiftag provides exif data in jekyll sites"
gem.description = "jekyll-exiftag is a LiquidTag Extension for Jekyll to get Exif data from images"
gem.authors = ["Beni Buess"]
Expand All @@ -10,5 +10,5 @@ Gem::Specification.new do |gem|
gem.homepage = 'http://github.com/benib/jekyll-exiftag'

gem.add_dependency "exifr"

end
10 changes: 5 additions & 5 deletions lib/jekyll-exiftag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Usage:
#
# {% exiftag tagname,[source],[file] %}
#
#
# Everything given as tagname is called on EXIFR::JPEG, so this could be model oder f_number.to_f (see https://github.com/remvee/exifr)
# If you give a source, this source is used build the fullpath for the given file (you can also configure them in _config.yml, see below)
# If the file is given, this is the file to get Exif Tags for, this can be alternatively defined in the YAML Front Matter as img: file
Expand Down Expand Up @@ -35,7 +35,7 @@ def initialize(tag_name, params, token)

def render(context)
sources = Array.new()
if context.registers[:site].config['exiftag']['sources']
if if context.registers[:site].config['exiftag'] and context.registers[:site].config['exiftag']['sources']
sources.unshift(*context.registers[:site].config['exiftag']['sources'])
end

Expand All @@ -46,15 +46,15 @@ def render(context)
if @args.count > 1
sources.unshift(@args[1])
end

# the image can be passed as the third parameter
if @args.count > 2
img = @args[2]
# or be defined in the YAML Front Matter like img: <file>
else
img = context.environments.first["page"]["img"]
end

# first check if the given img is already the path
if File.exist?(img)
file_name = img
Expand All @@ -73,7 +73,7 @@ def render(context)
""
end
end

def split_params(params)
params.split(",").map(&:strip)
end
Expand Down

0 comments on commit f01512c

Please sign in to comment.