Sha256: 8a7b345bc102403e29bd9a4a45a4bf532a6b3ea3f60e01a3f16b147e868b98ee
Contents?: true
Size: 1.21 KB
Versions: 38
Compression:
Stored size: 1.21 KB
Contents
# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/gallery-block.rb # Asciidoctor extension for J1 Galleries # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 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 # A block macro that embeds a Gallery block into the output document # # Usage # # gallery::gallery_id[role="additional classes"] # # Example: # # .The gallery title # gallery::jg_live_demo[] # Asciidoctor::Extensions.register do class ImageBlockMacro < Extensions::BlockMacroProcessor use_dsl named :gallery name_positional_attributes 'role' def process parent, target, attrs title_html = (attrs.has_key? 'title') ? %(<div class="gallery-title">#{attrs['title']}</div>\n) : nil html = %(#{title_html} <div id="#{target}" class="#{attrs['role']}"></div>) create_pass_block parent, html, attrs, subs: nil end end block_macro ImageBlockMacro end
Version data entries
38 entries across 38 versions & 1 rubygems