require 'asciidoctor/extensions'
class QuestionBlock < Asciidoctor::Extensions::BlockProcessor
use_dsl
named :QUESTION
on_context :example
def process parent, reader, attrs
attrs['name'] = 'question'
attrs['caption'] = 'Question'
admon = create_block parent, :admonition, nil, attrs, content_model: :compound
parse_content admon, reader
admon
end
end
class QuestionBlockCss < Asciidoctor::Extensions::DocinfoProcessor
use_dsl
def process doc
''
end
end
Asciidoctor::Extensions.register do
block QuestionBlock
docinfo_processor QuestionBlockCss
end
class AnswerBlock < Asciidoctor::Extensions::BlockProcessor
use_dsl
named :ANSWER
on_context :example
def process parent, reader, attrs
attrs['name'] = 'answer'
attrs['caption'] = 'Answer'
admon = create_block parent, :admonition, nil, attrs, content_model: :compound
parse_content admon, reader
admon
end
end
class AnswerBlockCss < Asciidoctor::Extensions::DocinfoProcessor
use_dsl
def process doc
''
end
end
Asciidoctor::Extensions.register do
block AnswerBlock
docinfo_processor AnswerBlockCss
end