lib/prawn/icon/parser.rb in prawn-icon-2.0.0 vs lib/prawn/icon/parser.rb in prawn-icon-2.1.0
- old
+ new
@@ -55,20 +55,18 @@
def config_from_tokens(tokens)
[].tap do |array|
tokens.each do |token|
# Skip the closing tag
next if token =~ /<\/icon>/i
- icon = {}
# Convert [[1,2], [3,4]] to { :1 => 2, :3 => 4 }
attrs = token.scan(ATTR_REGEX).inject({}) do |k, v|
val = attr_hash(v)
k.merge!(val)
end
- icon.merge!(attrs)
- array << icon
+ array << attrs
end
end
end
def icon_tags(icons)
@@ -99,16 +97,17 @@
end
def keys_to_unicode(document, content, config)
[].tap do |icons|
content.each_with_index do |icon, index|
+ key = Compatibility.new(key: icon).translate
options ||= {}
options = config[index] if config.any?
info = {
- set: FontData.specifier_from_key(icon),
+ set: FontData.specifier_from_key(key),
size: options[:size],
color: options[:color],
- content: FontData.unicode_from_key(document, icon)
+ content: FontData.unicode_from_key(document, key)
}
icons << info
end
end
end