Sha256: 09ca283a669bb217146ccbfb0b7a3693519c032f681924de355bcdb8e8445ba6

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/admonition-block-question.rb
# Asciidoctor extension for J1 Theme
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023, 2024 Juergen Adams
#
# J1 Template 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 CustomAdmonitionBlockQuestion < Extensions::BlockProcessor
    use_dsl
    named :QUESTION
    on_contexts :example, :paragraph

    def process parent, reader, attributes

      attributes['name'] = 'question'
      attributes['caption'] = 'Question'

      create_block parent, :admonition, reader.lines, attributes, content_model: :compound
    end
  end

  block CustomAdmonitionBlockQuestion
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
j1-template-2024.2.1 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.2.0 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.5 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.4 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.3 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.2 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.1 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.1.0 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.0.3 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.0.2 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.0.1 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb
j1-template-2024.0.0 lib/starter_web/_plugins/asciidoctor/admonition-block-question.rb