On Wed, Apr 3, 2013 at 1:43 AM, Richard Cotton <[email protected]>
wrote:

> Since this sort of task might be useful to understand, how do I create I
> new block definition?


Richard,

This is an area of Asciidoctor we worked hard to make more developer
friendly. Personally, I think the block filters in AsciiDoc are extremely
primitive. Making a true extension API, as we did in Asciidoctor, is a much
more sound approach.

I have an example which demonstrates almost the exact same use case as
yours. The textql block reads a listing block with sample data and run the
SQL-like query specified in the attribute on it to get a result set. It
then creates a table block with the result. (To do something similar in
AsciiDoc Python takes you far away from the AsciiDoc processor.)

You can see the code in the asciidoctor-extensions-lab repository.

Extension code:
https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/textql-block.rb
Sample doc:
https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/textql-block/sample.adoc

If you have ideas about how to improve the extension APIs, I'd be glad to
hear it.

Cheers,

-Dan

-- 
Dan Allen | http://google.com/profiles/dan.j.allen

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.

Reply via email to