From 5336fab7a731307a45b7fba90c1395f898dcab82 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 17 May 2018 16:23:39 -0400 Subject: [PATCH] support 3 icon params --- _plugins/icon.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/_plugins/icon.rb b/_plugins/icon.rb index dd1d11de..e608c3c3 100644 --- a/_plugins/icon.rb +++ b/_plugins/icon.rb @@ -36,8 +36,8 @@ module Jekyll def render(context) if tag_contents = determine_arguments(@markup.strip) - icon_class, icon_extra = tag_contents[0], tag_contents[1] - icon_tag(icon_class, icon_extra) + icon_class, icon_extra, icon_extra2 = tag_contents[0], tag_contents[1], tag_contents[2] + icon_tag(icon_class, icon_extra, icon_extra2) else raise ArgumentError.new <<-eos Syntax error in tag 'icon' while parsing the following markup: @@ -54,15 +54,17 @@ eos private def determine_arguments(input) - matched = input.match(/\A(\S+) ?(\S+)?\Z/) - [matched[1].to_s.strip, matched[2].to_s.strip] if matched && matched.length >= 3 + matched = input.match(/\A(\S+) ?(\S+)? ?(\S+)?\Z/) + [matched[1].to_s.strip, matched[2].to_s.strip, matched[3].to_s.strip] if matched && matched.length >= 4 end - def icon_tag(icon_class, icon_extra = nil) + def icon_tag(icon_class, icon_extra = nil, icon_extra2 = nil) if icon_extra.empty? "" - else + elsif icon_extra2.empty? "" + else + "" end end end