The problem is the precedence, once again. I expect from the parser to
parse wiki markup before parsing html tags, because templates can create
new tags by transclusion. If the ref tag is parsed first, glueing the
unbalanced parts to one proper template call, that means that (1) the
template can't include ref tags with follow parameter, because they will
not be parsed any more; or (2) after the transclusion the tags are parsed
once again, with the same algorithm. Both variants look me as a bad choice.
So the fact that the bad code I posted works is a symptom for a parser
problem.
Igal


‫בתאריך יום ה׳, 13 בדצמ׳ 2018 ב-18:17 מאת ‪Thiemo Kreuz‬‏ <‪
[email protected]‬‏>:‬

> The wikitext snippet you posted appears to be seriously broken. More
> precisely: It is unbalanced. Technically, there is no such thing as
> "broken" wikitext. The parser will always output something (as he does
> in the example). However, this doesn't mean such wikitext is ok. Sure,
> nobody is stopping anyone from writing unbalanced code. But it becomes
> unpredictable (as the example shows), unreliable, and effectively
> unmaintainable as it starts to heavily depend on quirky internal
> details of the parsers implementation, how it approaches certain
> aspects, and in which order they are processed.
>
> The bigger problem here is this: Even if you figure out how the parser
> works right now, it might change, as it already did many times. Have a
> look at pages like https://www.mediawiki.org/wiki/Markup_spec to get
> an idea of how complex this topic is, and how many people tried how
> many times to nail it down, all failing for one or the other reason.
> Code like the one you showed depends so much on the tiniest
> implementation detail of the parsing process, it becomes so fragile
> that it might break any day for reasons nobody could ever anticipate
> without a warning.
>
> Please balance your wikitext.
>
> Best
> Thiemo
>
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to