Sha256: 55705bea586202b1170b96967aa8faed093ce7b1cefade04262cfb564aa70aa1

Contents?: true

Size: 1.07 KB

Versions: 45

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) 2023 Juergen Adams
#
# J1 Theme is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
#
# ------------------------------------------------------------------------------
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

45 entries across 45 versions & 1 rubygems

Version Path
j1-template-2023.9.2 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.9.1 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.9.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.8.2 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.8.1 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.8.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.7.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.6.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.5.2 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.5 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.4 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.3 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.2 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.1 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.4.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.3.3 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.3.2 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.3.1 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.3.0 lib/starter_web/_plugins/asciidoctor/banner.rb
j1-template-2023.2.7 lib/starter_web/_plugins/asciidoctor/banner.rb