Sha256: c2b8042084e5ebc1beee6fafd49058f0f086908987476b0d5039162b51f7cdd0

Contents?: true

Size: 1.07 KB

Versions: 80

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) 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

# 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 :panel
    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

80 entries across 80 versions & 1 rubygems

Version Path
j1-template-2022.0.18 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.17 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.16 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.15 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.14 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.13 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.12 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.11 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.10 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.9 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.8 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.7 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.6 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.5 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.4 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.3 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.2 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.1 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2022.0.0 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb
j1-template-2021.3.2 lib/starter_web/_plugins/asciidoctor-extensions/panel.rb