Re: Custom styles support

Posted by mojavelinux on
URL: https://discuss.asciidoctor.org/Custom-styles-support-tp441p442.html

Yes, this is planned for the upcoming release. It's the last big feature I need to complete, in fact.

Here's the issue for tracking this enhancement:

https://github.com/asciidoctor/asciidoctor/issues/79

In general, you don't want to rely on the parsing constants in asciidoctor.rb or the lexer.rb code directly. That code is very low level and subject to change. (While I'm on the subject, you shouldn't interact with any of the classes in lib/asciidoctor/backends either, since they aren't designed to be extended and may even go away as I further optimize things).

Having said that, what we do want is a nice clean extension system. Issue #79 is the beginning of that development. I'm intentionally starting with a Ruby-based approach to extension because I find using configuration files for such things just ends up limiting you too much to do what you really want. The extension point will receive the text being parsed and have the opportunity to interact with the document in any way, then return a true block object.

The best way to move this feature forward is to either provide feedback on the issue or help review the implementation when I push the code later this week.

Before I close, welcome to the group!

-Dan



On Thu, Aug 8, 2013 at 1:42 AM, pepijnve [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm experimenting with writing specifications in asciidoc. In order to make this easier I would like to use custom block styles for things like for instance requirements.

With asciidoc this is possible by adding the [blockdef-*] entries to the config file. I'm now trying to do the same thing with asciidoctor, but this doesn't seem to be supported.

I've already tried to be get this to work by adding entries to Asciidoctor::PARAGRAPH_STYLES and/or Asciidoctor::DELIMITED_BLOCKS. This got me one step further, but then I hit checks in lexer.rb that raise 'invalid style' or 'unsupported block type' errors.

Are there any plans to support this in asciidoctor? I would be happy to contribute a patch for this, but I would like to know if someone has thought this through already and if so, how they planned to tackle this.
My initial thought would be to relax the checks in lexer.rb and catch missing style problems later on during rendering. Is this a good way forward or are the checks in the lexer there for other reasons as well?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Custom-styles-support-tp441.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



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