https://discuss.asciidoctor.org/Custom-styles-support-tp441p474.html
Pepijn,
Your example aligns perfectly with the BlockProcessor extension proposed in the changeset for issue #79.
The good news is, all the work of inline processing, etc you get for free. All you need to do is decorate the content with the extra text in AsciiDoc format that you need.
In your example, you'd create a custom block for the requirement style:
class RequirementBlock < BlockProcessor
option :contexts, [:paragraph]
option :content_model, :simple
def process parent, reader, attributes
reader.unshift_line "*Req {counter:requirement}*"
Block.new parent, :quote, :content_module => @content_model, :source => reader.lines, :attributes => attributes
end
end
That matches your effective AsciiDoc output above, and the following HTML:
<div class="blockquote">
<blockquote><strong>Req 1</strong> AsciiDoctor shall support custom block styles.</blockquote>
</div>
If you need to render a custom template, you change the second argument to Block.new from :quote to the name of your custom template. You'd then need to provide a custom template, which you load using the :template_dirs API option or -T command option.
I'll be including a few examples in the release notes so that you can put this into practice. For sure, you're case is covered.
-Dan