Sha256: feb81bfbf18a56a3b8754123b3dd6db3ec7f72b948548edca3408782ccc18c44

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/banner.rb
# Asciidoctor extension for J1 Banner blocks
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2020 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 banner block into the output document
#
# Usage
#
#   banner::banner_id[role="additional classes"]
#
# Example:
#
#   banner::home_teaser_banner[role="mb-5"]
#
Asciidoctor::Extensions.register do

  class J1BlockMacro < Extensions::BlockMacroProcessor
    use_dsl

    named :banner
    name_positional_attributes 'role'

    def process parent, target, attrs
      html = %(<div id="#{target}" class="#{attrs['role']}"></div>)
      create_pass_block parent, html, attrs, subs: nil
    end
  end

  block_macro J1BlockMacro

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
j1-template-2021.0.0 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.25 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.24 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.22 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.21 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.20 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.19 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.18 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.17 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.16 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.15 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb
j1-template-2020.0.14 lib/starter_web/_plugins/asciidoctor-extensions/banner.rb