Sha256: f846be98d5a1c205ce79c4060401abfefdb45a50f4514ce7586345e3803892f1

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

# ------------------------------------------------------------------------------
#  ~/_plugins/asciidoctor-extensions/admonition-block-question.rb
#  Asciidoctor extension for J1 Template
#
#  Product/Info:
#  https://jekyll.one
#
#  Copyright (C) 2019 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'
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

8 entries across 8 versions & 1 rubygems

Version Path
j1_template-2019.4.12 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.11 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.10 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.8 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.7 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.5 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.4 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb
j1_template-2019.4.1 lib/starter_web/_plugins/asciidoctor-extensions/admonition-block-answer.rb