Sha256: 017df73fa10f600bf117b480eecfbf85e333a2fdd39be1d2e03af09eaff6cba7

Contents?: true

Size: 740 Bytes

Versions: 8

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

require 'yaml'

module Asciidoctor
  module Epub3
    # Map of Font Awesome icon names to unicode characters
    class FontIconMap
      class << self
        FONT_AWESOME_DIR = File.join __dir__, '..', '..', 'data', 'fonts', 'awesome'

        def icons
          @icons ||= YAML.load_file File.join(FONT_AWESOME_DIR, 'icons.yml')
        end

        def shims
          @shims ||= YAML.load_file File.join(FONT_AWESOME_DIR, 'shims.yml')
        end

        def unicode icon_name
          shim = shims[icon_name]
          icon_name = shim['name'] unless shim.nil?
          icon_data = icons[icon_name]
          icon_data.nil? ? '' : %(\\#{icon_data['unicode']})
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
asciidoctor-epub3-1.5.1 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.19 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.18 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.17 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.16 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.15 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-1.5.0.alpha.14 lib/asciidoctor-epub3/font_icon_map.rb