In trying to find a good way to re-use templates I've stumbled upon a great
solution. It essentially re-uses the inserted content's template inside the
parent tiddler. This makes for simple templates (since they can be re-used).
However it uncovers a bug/feature in the applyHtmlMacros function. The
function works by starting at a root element and looking for all children
with a 'macro' attribute and executing the corresponding macro. The problem
is that when the inserted templates are included the applyHtmlMacros
functions covers them and they insert their content (that is the expected
behavior) but then the containing tiddler calls it again triggering the
macros again but in the context of the parent tiddler (this is incorrect
behavior)
To fix this the applyHtmlMacros function just needs to call
e.removeAttribute("macro");
after the getAttribute call. That way it cleans up after itself and removes
the macro calls. There are other solutions, I've included this one here:
http://checkettsweb.com/tw/beta.html#ShowQuotes
I think this would be a great inclusion in the core (regarding the
applyHtmlMacro tweak, not necessarily the showQuotes macro there)
-Clint