I’ve recently noticed something odd that happens with a specific pattern of html comments and pragmas. What I see is not a problem for me but it gives me the feeling that it might be revealing something that is worth mentioning. I’m posting this in case someone who knows enough about how wikitext parsing works might find it interesting or an indication of something not quite right happening. The wiki I am working on is using 5.3.0.
To be clear, it works just fine to have html comments within a procedure or macro. It works just fine to “comment out” a procedure definition. The following, however, does not work-
\define outer()
<!--
\procedure exampleProcedure()
Some example wikitext...
\end
Some commented out instructions...
-->
Some live wikitext...
\end
The result of that is that the \end for the commented out procedure terminates the outer macro causing everything else that is supposed to be commented out to render as if it was not in an html comment block. That includes rendering the → that should have terminated the comment block. Then everything else in the macro renders as if it was not in a “pragma block.” It does not seem to matter if macros or procedures are used or, in the case I have, if they are mixed.
This isn’t a real problem for me, so I don’t need a fix. I have just changed the \end
for my example procedure to \end exampleProcedure
and then it is no longer recognized as being for the outer macro and the comment block terminates with the → as it should but it is still valid if I edit the example and move it outside the comment block. Anything that makes the \end
for the example invalid as an end of the macro fixes things, for example, \endQQQQ
fixes the problem but would need to be changed if I edit the example and move it out of the comment block.
Here are a couple screenshots to show what I mean. First nested macros that show the behavior-
Here is how basically the same setup works well when the inner macro is replaced with a procedure that is terminated by an \end followed by the procedure name-
Skippable background:
In case anyone wonders why I would do something that probably looks pretty strange-
I’ve got a button that creates new tiddlers with some standard wikitext. After creating a tiddler I need to edit it and give some values to some fields. I’m creating a lot of these tiddlers now but eventually it is the kind of thing that I might only need to do once every few months. To make it as painless as possible to do this once I have half forgotten what needs to be done, one of the things that gets put into the newly created tiddler is a set of instructions inside HTML comments (<!-- instructions... -->
) Since the final tiddler also needs to contain a procedure that follows a certain structure but is different for each of these tiddlers, I thought it would be nice to include a sample procedure in the commented out instructions. I put all of this into a good old fashioned macro, since it is just text and then set the text of the new tiddler to the value of that macro.