8
8
#
9
9
# Installation:
10
10
#
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
13
13
14
14
class Jekyll ::SVGConvert < Liquid ::Tag
15
15
@@ -42,21 +42,21 @@ def render(context)
42
42
ext = File . extname ( @source )
43
43
basename = File . basename ( @source , ext )
44
44
45
- if @width and @height
45
+ if @width && @height
46
46
basename . concat ( "-#{ @width } x#{ @height } " )
47
47
end
48
48
49
49
@dest = "#{ File . dirname ( @source ) } /#{ basename } .#{ @format } "
50
50
@dest_path = File . join ( site . dest , @dest )
51
51
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
54
54
55
55
# Return relative path to output file
56
- "" " #{ @dest } " ""
56
+ @dest
57
57
end
58
58
59
- # Returns source file path.
59
+ # Returns source file path
60
60
def path
61
61
@source_path
62
62
end
@@ -71,13 +71,13 @@ def destination(dest)
71
71
@dest_path
72
72
end
73
73
74
- def write ( dest )
74
+ def write
75
75
# Generate output file if it doesn't exist or is less recent than the source file
76
76
if !File . exists? ( @dest_path ) || File . mtime ( @dest_path ) <= File . mtime ( @source_path )
77
77
print "Generating #{ @format . upcase } : #{ @source } -> #{ @dest } \n "
78
78
79
79
options = "-o #{ @dest_path } "
80
- if @width and @height
80
+ if @width && @height
81
81
options . concat ( " --width=#{ @width } " )
82
82
options . concat ( " --height=#{ @height } " )
83
83
end
0 commit comments