mirror of
https://github.com/bitwarden/help
synced 2025-12-17 08:43:30 +00:00
support 3 icon params
This commit is contained in:
@@ -36,8 +36,8 @@ module Jekyll
|
|||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
if tag_contents = determine_arguments(@markup.strip)
|
if tag_contents = determine_arguments(@markup.strip)
|
||||||
icon_class, icon_extra = tag_contents[0], tag_contents[1]
|
icon_class, icon_extra, icon_extra2 = tag_contents[0], tag_contents[1], tag_contents[2]
|
||||||
icon_tag(icon_class, icon_extra)
|
icon_tag(icon_class, icon_extra, icon_extra2)
|
||||||
else
|
else
|
||||||
raise ArgumentError.new <<-eos
|
raise ArgumentError.new <<-eos
|
||||||
Syntax error in tag 'icon' while parsing the following markup:
|
Syntax error in tag 'icon' while parsing the following markup:
|
||||||
@@ -54,15 +54,17 @@ eos
|
|||||||
private
|
private
|
||||||
|
|
||||||
def determine_arguments(input)
|
def determine_arguments(input)
|
||||||
matched = input.match(/\A(\S+) ?(\S+)?\Z/)
|
matched = input.match(/\A(\S+) ?(\S+)? ?(\S+)?\Z/)
|
||||||
[matched[1].to_s.strip, matched[2].to_s.strip] if matched && matched.length >= 3
|
[matched[1].to_s.strip, matched[2].to_s.strip, matched[3].to_s.strip] if matched && matched.length >= 4
|
||||||
end
|
end
|
||||||
|
|
||||||
def icon_tag(icon_class, icon_extra = nil)
|
def icon_tag(icon_class, icon_extra = nil, icon_extra2 = nil)
|
||||||
if icon_extra.empty?
|
if icon_extra.empty?
|
||||||
"<i class=\"fa #{icon_class}\"></i>"
|
"<i class=\"fa #{icon_class}\"></i>"
|
||||||
else
|
elsif icon_extra2.empty?
|
||||||
"<i class=\"fa #{icon_class} #{icon_extra}\"></i>"
|
"<i class=\"fa #{icon_class} #{icon_extra}\"></i>"
|
||||||
|
else
|
||||||
|
"<i class=\"fa #{icon_class} #{icon_extra} #{icon_extra2}\"></i>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user