Yes, this is somewhat similar to what I had to deal with when adding
<mw:editsection>.
Take a look at includes/parser/Tidy.php, specifically the MWTidyWrapper
class. You'll find that in the end tidy couldn't play nice at all. And
to support the mw:editsection placeholder I had to explicitly add a new
wrapper class to our tidy code for the purpose of holding a mapping of
UNIQ style tokens to the contents of mw:editsection tokens and
completely hiding the fact that mw:editsection exists from Tidy. (And
then in the future I had to add a meta/link -> html-meta/html-link just
to stop it from screwing up the RDFa/Microdata style meta/link tags in
the body.
You'll have to tweak the tidy code to also wrap your tokens.
Also beware of parameters/data you need passed with placeholder tags. I
had some language converter issues I had to deal with. Some params you
explicitly do want converted and others you don't. So you end up having
to mix specific attribute names and contents just to get specific
behavior out of the converter. I had failing unit tests in my changes
till I found a way to deal with this.
I've been wanting a generic API to do this kind of post-processing in
the Parser for awhile. Though I just thought of an idea on how to
generically solve the "To language convert or not to language convert"
issue.
<mw:sometoken>
<mw:param name="some-key" value="..." /><!-- Language converter
should ignore this -->
<mw:param name="some-key">...</mw:param><!-- Language converter
should convert this -->
</mw:sometoken>
Or we could stick with attributes but automatically prefix everything
with convert- noconvert- attribute prefixes. Then hack all the
LanguageConverters to handle that.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
On 2013-10-07 5:45 PM, Max Semenik wrote:
> Hi, I would appreciate your help with wrestling Tidy into submision:
> I have a revision, https://gerrit.wikimedia.org/r/#/c/80578/ which
> allows to disable TOC in ParserOutput. Because now only a marker
> instead of full TOC passes through Tidy, it gets sometimes wrapped in
> <p> tags. I tried various stuff like trying different types of marker,
> but Tidy is stubborn. Does anyone know a way to work around this?
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l