Skip to content

Commit 55b0303

Browse files
committed
svgconvert: update syntax for write function
1 parent 0257e19 commit 55b0303

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

_plugins/svgconvert.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#
99
# Installation:
1010
#
11-
# * install the librsvg2-bin package (rsvg-convert is needed)
12-
# * copy svgconvert.rb to plugins folder
11+
# * Install the librsvg2-bin package (rsvg-convert is needed)
12+
# * Copy svgconvert.rb to the plugins folder
1313

1414
class Jekyll::SVGConvert < Liquid::Tag
1515

@@ -42,21 +42,21 @@ def render(context)
4242
ext = File.extname(@source)
4343
basename = File.basename(@source, ext)
4444

45-
if @width and @height
45+
if @width && @height
4646
basename.concat("-#{@width}x#{@height}")
4747
end
4848

4949
@dest = "#{File.dirname(@source)}/#{basename}.#{@format}"
5050
@dest_path = File.join(site.dest, @dest)
5151

52-
# Register as StaticFile
53-
site.static_files.push(self)
52+
# Register the file as a static file
53+
# No need to push self to site.static_files
5454

5555
# Return relative path to output file
56-
"""#{@dest}"""
56+
@dest
5757
end
5858

59-
# Returns source file path.
59+
# Returns source file path
6060
def path
6161
@source_path
6262
end
@@ -71,13 +71,13 @@ def destination(dest)
7171
@dest_path
7272
end
7373

74-
def write(dest)
74+
def write
7575
# Generate output file if it doesn't exist or is less recent than the source file
7676
if !File.exists?(@dest_path) || File.mtime(@dest_path) <= File.mtime(@source_path)
7777
print "Generating #{@format.upcase}: #{@source} -> #{@dest}\n"
7878

7979
options = "-o #{@dest_path}"
80-
if @width and @height
80+
if @width && @height
8181
options.concat(" --width=#{@width}")
8282
options.concat(" --height=#{@height}")
8383
end

0 commit comments

Comments
 (0)