Re:Extracting data from Wikipedia using curl, grep, cut and ...
by germanier on Tuesday August 16, 2016 @10:13AM
(#12297562)
> And there is no way to obtain a list of parser functions and extension tags (the latter of which look like HTML tags, but parse differently).
FWIW, every sane extensions reports its existence to [[Special:Version]] which at least includes a list of extension tags at the bottom but you'd need to implement all of them in an alternative parser.
Most alternative parsing libraries (at least all the ones I looked at, and that includes Wikimedia's own Parsoid!) don't bother with implementing all that complexity. Which means that they can be often tripped by sufficiently tricky markup; and this turns out to be a quite low bar.
Parsing MediaWiki markup properly is an insanity on a level comparable only with TeX and Unix shell scripts. Even PHP is saner.
[0] https://www.mediawiki.org/wiki/API:Parsing_wikitext
[1] https://www.mediawiki.org/wiki/Strip_marker