On 2013-10-09 8:04 AM, Max Semenik wrote:
On 08.10.2013, 5:27 Daniel wrote:
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.
Please please, *please* do not give up on implementing this with a proper placeholder and put an even worse hack into the Parser.
There should be some way to find out exactly what is happening, where, and then target only that spot with a work-around.
Some things to start with:
* Is this really Tidy adding the <p>? Or is it actually the Parser adding them? (In the latter case I'd try adding a UNIQ there). * You tried wrapping with a UNIQ inside that tidy wrapper code, right? If Tidy is wrapping the text itself in a <p> then how about targeting tidy specifically by wrapping the UNIQ in one single expected <div> and then stripping that . Or maybe instead of a <div> add "mw-uniq" to new-blocklevel-tags and wrap the UNIQ in <mw-uniq> in the tidy wrapper.
Something like mw:foo shouldn't be changed to a <p> in the Parser just because of tidy. It doesn't make sense to make the parser worse just because of tidy when not everyone is using tidy and we have an open bug planning to kill tidy and replace it with something that wont suck so much (and theoretically won't give you the same issue with adding a mw:foo.
[1] https://bugzilla.wikimedia.org/show_bug.cgi?id=54617
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]