Sha256: f201808676900eb103392504a42fc14c16293e4a7df2447d804f62454075cfcd

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 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

3 entries across 3 versions & 1 rubygems

Version Path
asciidoctor-epub3-2.1.0 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-2.0.1 lib/asciidoctor-epub3/font_icon_map.rb
asciidoctor-epub3-2.0.0 lib/asciidoctor-epub3/font_icon_map.rb