]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/todo/nested_preprocessor_directives.mdwn
added a comment on my lovely patch
[ikiwiki.git] / doc / todo / nested_preprocessor_directives.mdwn
index b5080dc3ca22ef24ad87de301f3cc7b0f584b567..0799810540bb8806095f4e8466da908f68f4c919 100644 (file)
@@ -16,3 +16,43 @@ nesting, a new syntax would be needed. Maybe something xml-like?
 >     """]]
 >
 > --[[JoshTriplett]]
+
+>> Yes it's definitely possible to do something like that. I'm not 100%
+>> sure if it can be done in perl regexp or needs a real recursive descent
+>> parser though.
+>>
+>> In the meantime, this is an interesting approach:
+>> <https://github.com/timo/ikiwiki/commit/a73837a8f26147e42a0bb2dde38b4890b27822b3>
+>> 
+>>     \[[!directive text=\<\<FOO
+>>     ...
+>>     FOO]]
+>> 
+>> Since that's implemented, I will probably just merge it,
+>> once I satisfy myself it doesn't blow up in any edge cases.
+>> (It also adds triple single quotes as a third, distinct type of quotes,
+>> which feels a bit redundant given the here docs.) --[[Joey]] 
+>>
+>> Hmm, that patch changes a `m///sgx` to a `m///msgx`. Meaning
+>> that any '^' or '$' inside the regexp will change behavior from matching
+>> the start/end of string to matching the start/end of individual lines 
+>> within the string. And there is one legacy '$' which must then 
+>> change behavior; the "delimiter to next param".
+>>
+>> So, I'm not sure what behavior that will cause, but I suspect it will
+>> be a bug. Unless the `\s+|$' already stops matching at a newline within
+>> the string like it's whitespace. That needs more alalysis. 
+>> Update: seems it does, I'm fairly satisfied that is not a bug.
+>>
+>> Also, the patch seems incomplete, only patching the first regexp
+>> but not the other two in the same function, which also are quoting-aware. --[[Joey]] 
+>>
+>> Yes, I'm terribly sorry. I actually did edit the other two regexps, but
+>> I apparently missed copying it over as well. Should have been doing this
+>> in a git repo all along. Look at the new commit I put atop it that has
+>> the rest as well:
+>> <https://github.com/timo/ikiwiki/commit/a4e33d9654404acff71344cd5d3672bcdf3f3ce5>
+>> Also: I'm not sure any more, why I added the m modifier. It was very
+>> late at night and I was getting a bit desperate (turned out, the next
+>> morning, I put my extra regexes after the "unquoted value" one. heh.)
+>> So, feel free to fix that. --Timo