Re: My first extension based on "83.5. Block Processor Example"
Posted by
mojavelinux on
URL: https://discuss.asciidoctor.org/My-first-extension-based-on-83-5-Block-Processor-Example-tp7705p7709.html
In order to support blank lines in the content, you must enclose the lines in a block (it could be an open block or some other block). So the closest thing you can have is:
[feature]
--
abc
123
--
That would be implemented as something like:
Asciidoctor::Extensions.register do
block :feature do
on_context :open
process do |parent, reader, attrs|
# magic goes here
end
end
end
If you are okay with:
[feature]
abc
{blank}
123
Then you could use on_context: :paragraph
The continuation line is only relevant for lists.
Cheers,
-Dan
On Sat, Feb 29, 2020 at 9:49 AM DrAscii [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Hi guys,
I started with AsciiDoc(tor) a few days ago. My problem: I have zero ruby skills so I need help with my first little extension.
What I do right know
Without the extension I write often something like this:
.feature
--
*Feature*
abc
123
--
What I would like to have
[feature]
abc
+
123
(This should lead to the same HTML as my current workaround.)
What I found so far
After reading the manual I think the chapter 83.5 Block Processor Example is the part I'm looking for. But I have no idea how to adapt the code to my needs and get it running. Maybe you can add another example based on my request to the manual? I think other people are looking for similar things.
Thanks!
Best regards
DrAscii
--