Sha256: 9db8613d95989a701f3b8ffd5e4256017ac51b9f74a43ea4ac0c4b9e4214f4be
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/fas-icon-inline.rb # Asciidoctor extension for J1 Template # # Product/Info: # https://jekyll-one.com # # Copyright (C) 2019 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one/j1_template_mde/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' => 'md-black' 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 fa#{size_class} #{modifier} fa-#{icon_name}"></i>) end end inline_macro FabIconInlineMacro end
Version data entries
9 entries across 9 versions & 1 rubygems