Sha256: 84aba35271bf90697ad1326541146daf1c9f70b81823d1f51274d59c84f9761d

Contents?: true

Size: 1.16 KB

Versions: 45

Compression:

Stored size: 1.16 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/admonition-block-question.rb
# Asciidoctor extension for J1 Theme
#
# 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'
include Asciidoctor

# An extension that introduces a custom admonition type, complete
# with a custom icon.
#
# Usage
#
#   [QUESTION]
#   ====
#   What's the main tool for selecting colors?
#   ====
#
# or
#
#   [QUESTION]
#   What's the main tool for selecting colors?
#
Asciidoctor::Extensions.register do

  class CustomAdmonitionBlockAnswer < Extensions::BlockProcessor
    use_dsl
    named :ANSWER
    on_contexts :example, :paragraph

    def process parent, reader, attrs
      attrs['name'] = 'answer'
      attrs['caption'] = 'Answer'
      create_block parent, :admonition, reader.lines, attrs, content_model: :compound
    end
  end

  block CustomAdmonitionBlockAnswer

end

Version data entries

45 entries across 45 versions & 1 rubygems

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