Sha256: bdcff9fbd7d6ff7b3fb146d859acc67c758d615b3c0e2f5def1517e8b0de8a43
Contents?: true
Size: 1.12 KB
Versions: 6
Compression:
Stored size: 1.12 KB
Contents
# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/fas-icon-inline.rb # Asciidoctor extension for J1 Template # # Product/Info: # https://jekyll.one # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # # ------------------------------------------------------------------------------ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' include Asciidoctor Asciidoctor::Extensions.register do class FabIconInlineMacro < Extensions::InlineMacroProcessor use_dsl named :fab name_positional_attributes 'size', 'modifier' default_attrs 'size' => '1x', 'modifier' => '' def process parent, target, attributes doc = parent.document size_class = (size = attributes['size']) ? %(fa-#{size}) : nil modifier_class = (modifier = attributes['modifier']) ? %(#{modifier}) : nil icon_name = target.tr '_', '-' %(<i class="fab #{size_class} #{modifier} fa-#{icon_name}"></i>) end end inline_macro FabIconInlineMacro end
Version data entries
6 entries across 6 versions & 1 rubygems