On 09.03.2007, at 21:40, Andrea Censi wrote:
> I see that the well-defined order for transforming a page to HTML is:
> - Transform the content using the content converter
> ...
> - Replace tags
>
> I think it should be the other way around.
>
> I wrote this plugin that transform
>
> {flickr: <url of the photo>}
>
> into something like:
>
> <div> Foto, caption, etc. </div>
>
>
> Now, because of the order of transformations, the content-converter
> (bluecloth or maruku) will first transform the tag in:
>
> <p>{flickr: <url of the photo>}</p>
>
> and then the tag processor will transform this in
>
> <p><div> Foto, caption, etc. </div></p>
>
>
> So, two questions:
> 1 - is possible to customize the order of transformations?
> 2 - I was wondering why did you set this order instead of the other
> way around: was there a reason, or was it a random decision? I think
> that the other order is much more intuitive.
There are always trade-offs involved. I thought long about the pros
and cons of the current transformation order. Some reasons I chose
this one:
* The tag plugins know what to output, namely pure HTML. If
converting a page file to HTML after replacing tags, it depends on
the content converter to the right thing with the embedded HTML. If
the page file is converted to HTML first, replacing the tags with
pure HTML is easy. Same is true for ERB output.
* And generally: after reading a page file, it is automatically
converted to HTML. Therefore all plugins working with the page file
can be assured that can work on HTML.
* The in-page menu only works because of this ordering. After reading
in a page file, it is converted to HTML and then all header elementes
h1, h2, ... with id="..." are searched for and fragment nodes for
each such element are generated. This would not be possible without
transforming the page to HTML.
I know that this transformation order is not perfect but it turned
out to be the best viable solution for me. However, I''m open for
other/better suggestions concerning the transformation pipeline. One
major reason for choosing this particular order was the ability to
use in-page menus afterwards and this should be possible with another
order, too!
Currently it is not possible to customize the order of
transformations. Maybe this will be possible in the next bigger
release (0.5.0 - which is also worked on already, more to that later
on webgen-users). Your problem with the additional <p>...</p> tags
can be overcome, for example with Textile markup, by specifying that
some parts should not be formatted by Textile using the
<notextile>...</notextile> tags. I don''t know if something
like this
exists for Markdown or Maruku.
Bye,
Thomas