On 08.10.2013, 5:27 Daniel wrote:

> 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.

Thanks Daniel - but my problem is not that Tidy corrupts the tag
itself, but that it wraps it in <p>. This is different from
<mw:editsection> that is always surrounded by other tags. After much
experimenting, I ended up with a conclusion that the only way to
reliably prevent <p> addition is... to make it a <p> itself:) I used a
unique attribute, so there's no chance it will clash with something
including user-submitted tags.

> 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 need no parameters, so no danger here.

The patchset that passes all tests is at
https://gerrit.wikimedia.org/r/#/c/80578/ , can someone take a look at
it, please?



-- 
Best regards,
  Max Semenik ([[User:MaxSem]])


_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to