# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/gist-block.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 # A block macro that embeds a Gist into the output document # # Usage # # gist::12345[] # # Example: # # .Guard setup to live preview AsciiDoc output # gist::mojavelinux/5546622[] # Asciidoctor::Extensions.register do class GistBlockMacro < Extensions::BlockMacroProcessor use_dsl named :gist def process parent, target, attrs title_html = (attrs.has_key? 'title') ? %(