On 02/02/2012 07:52 PM, Trevor Parscal wrote: > Any ideas about what happens if a parser hook, parser function or > template resolves to just plain text, without any wrapping HTML? Where > does the microdata get stored? If we wrap it, how do we decide what to > wrap it in?
Normally we would wrap the text into a span, and mark this span as being a wrapper in an attribute. The span would then hold all metadata. The extra wrapper might break some CSS selectors unfortunately, but that is a problem with any wrapper and hard to avoid (without those handy range annotations..). In the parser, wrapping into a span by inserting tokens should be safe in any case (ignoring the potential CSS issues), but there might be a case for propagating that information to a surrounding paragraph if the span is later wrapped into a paragraph at the DOM level. Also, any trailing text tokens in a template expansion will need to be wrapped as well to mark the end of the expansion. At the token level, all non-text tokens from an expansion are marked as coming from a template, so that the full expansion can be identified in the resulting DOM. This catches any text in between, but not normally plain text before or after the last non-text token. Hence the need for wrapping this too. Gabriel _______________________________________________ Wikitext-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitext-l
