}}} but outside a {{{}}}; or inside a {{{}}} but not also inside a {{{- }}}.
The formatter probably needs to delay writing anchors until the next legal place for a span element.
'''Uniqueness of ids:''' When the {{{[[Include()]]}}} macro is used to include the source of one wiki page inside another, the line number ids used can be duplicated! This is not allowed in XHTML, where all id attribute values must be unique per document.
{{{This is in the parent document.
This is in the included document.
}}}
== Caching and dynamic content ==
Right now the weirdest obstacle seems to be the way the page caching system works. This is done by {{{formatter/text_python.py}}} with it's {{{Formatter}}} class. It acts as a front-end to the actual formatter being used, such as {{{formatter/text_html.py}}}. It has a nasty problem where it can re-order the calls to formatter methods. See DeronMeranda/DiscussPythonFormatter.
The current way it works is that it may delay calling the some formatter methods, based upon whether it thinks the output is static or dynamic. When creating a cache for the page it actually generates python code. It will go ahead can call the real formatter for all static content and just put the generated html fragments in the cache. But for dynamic content it will instead insert python code that will call the formatter methods when the cached page is retrieved (and not when the cache is created). This is how for instance some macros like {{{[[FullSearch]]}}} will always output the latest results, even though the wiki source for the page on which the macro belongs has not changed.
However this mix of dynamic and static content means that the real formatter gets it's methods called all out of order (time-wise), even though the final output will effectively have everything pasted back together in the correct document order. But this also means that the formatter class can not hope to keep track of any ''state'' during the formatting. It can not do things like keep track of an accurate stack of nested HTML tags.
As a real case, the formatter will currently get called on to output an {{{}}} before it gets called to output the corresponding {{{
}}} tag!
One posible compromise which may partially help would be to insure that openers and closers are always called
in the correct order (e.g., if is delayed to page-view time, then should be as well).
== Javascript ==
There are two basic issues with Javascript code that is output:
1. Use of {{{document.write}}} and such. XHTML can only be actively modified via standard DOM methods.
1. Simple escaping. Common characters in Javascript like {{{&&}}} are reserved XML characters. They need to be escaped.
For the escaping case, it depends on if the document is served as {{{text/html}}} or {{{application/xhtml+xml}}}, as well as if the Javascript is inside {{{
}}}
Obviously putting most javascript in external *.js files is probably a good thing. Also any complex code inside attribute values should probably be converted into function calls, where the code is defined inside a {{{ |