]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/nested_preprocessor_directives.mdwn
link to timonator's patch
[ikiwiki.git] / doc / todo / nested_preprocessor_directives.mdwn
1 Ikiwiki's preprocessor parser cannot deal with arbitrary nested preprocesor
2 directives. It's possible to nest a directive with single quoted values
3 inside a triple-quoted value of a directive, but that's all.
4
5 It's not possible to unambiguously parse nested quotes, so to support
6 nesting, a new syntax would be needed. Maybe something xml-like?
7
8 > You can, however, unambiguously parse nested square brackets, and I think
9 > that would solve the problem, as long as you never allow the contents of a
10 > directive to contain a *partial* directive, which seems reasonable to me.
11 >
12 > For example, I *think* you can unambiguously parse the following:
13 >
14 >     \[[!if test="enabled(template) and templates/foo" then="""
15 >     [[!template id=foo content="""Flying Purple People Eater"""]]
16 >     """]]
17 >
18 > --[[JoshTriplett]]
19
20 >> Yes it's definitely possible to do something like that. I'm not 100%
21 >> sure if it can be done in perl regexp or needs a real recursive descent
22 >> parser though.
23 >>
24 >> In the meantime, this is an interesting approach:
25 >> <https://github.com/timo/ikiwiki/commit/a73837a8f26147e42a0bb2dde38b4890b27822b3>
26 >> 
27 >>      \[[!directive text=<<FOO
28 >>      ...
29 >>      <<FOO]]
30 >> 
31 >> Since that's implemented, I will probably just merge it,
32 >> once I satisfy myself it doesn't blow up in any edge cases.
33 >> (It also adds triple single quotes as a third, distinct type of quotes,
34 >> which feels a bit redundant given the here docs.) --[[Joey]]