lib/jekyll-smiley.rb in jekyll-smiley-0.1.1 vs lib/jekyll-smiley.rb in jekyll-smiley-0.1.2

- old
+ new

@@ -2,11 +2,11 @@ class SmileyGenerator < Generator def generate(site) smiley_config = site.config["smiley"] return if not smiley_config or not smiley_config["enabled"] - dir = smiley_config["dir"] || "assets/smileys" + dir = smiley_config["dir"] || "smileys" smileys = {} begin Dir.foreach(dir) do |filename| @@ -31,9 +31,11 @@ module SmileyFilter def smiley(message) site = @context.registers[:site].config smileys = site["smileys"] + return message if smileys.nil? or smileys.empty? + message.gsub!(/:([a-z]+):/) do |match| smiley = smileys[$1] if smiley "![#{$1}](#{smiley["img"]})" end