News for hackers. Stuff that matters.
Re:The Parser that Cracked the MediaWiki Code by Semiapies on Friday May 06, 2011 @01:33PM (#2521701)
I hadn't realized that there were any parsing issues around MediaWiki's markup. 5000 lines of PHP? Eek.
Re:The Parser that Cracked the MediaWiki Code by sigil on Friday May 06, 2011 @02:05PM (#2521852)
It's worse. The MediaWiki PHP code doesn't implement a proper scanner and parser, it's a bunch of regexes around which the code has grown more or less organically. Silent compensation for mismatched starting and ending tokens abounds, and causes problems for all consumers of the markup, in the same way that lenient HTML parsers have. The difference is that Wikipedia, as the sole channel for editing markup, could have easily rejected syntax errors with helpful messages instead of silently compensating.

If it was anything else, I'd say "who cares," but this is "the world's knowledge" -- we absolutely should care about the format it's stored in. I'm glad to see people tackling this problem.

Re:The Parser that Cracked the MediaWiki Code by VMG on Friday May 06, 2011 @02:13PM (#2521875)
Interestingly markdown has the same problem.

Another example of the imperfect but working implementation winning.

Re:The Parser that Cracked the MediaWiki Code by seanp2k on Friday May 06, 2011 @02:48PM (#2522018)
Markdown...ugh. Let's just stick to DokuWiki or Mediawiki syntax for everything, please. If you need something more advanced than that, you should be using LaTeX. Actually, it'd be cool to build a working MediaWiki + Markdown => LaTeX converter....in something like Python.
Re:The Parser that Cracked the MediaWiki Code by VMG on Friday May 06, 2011 @03:23PM (#2522142)
there is markdown2pdf written Haskell, which seems to have XeTeX as an intermediary step.

Personally I'd be happy to see any markup language becoming the default, regardless which one it is. Having a proper grammar would be a bonus.

Re:The Parser that Cracked the MediaWiki Code by gbog on Saturday May 07, 2011 @09:10AM (#2523694)
"Personally I'd be happy to see any markup language becoming the default."

I don't agree with this. All lightweight humane markup languages are not born equal, some are better others, and Mediawiki's is not in the list of the best ones. Now there seem to be a trend towards Markdown, but it should be improved and then, migrating Wikipedia to this Markdown2 could be a real good thing.

Re:The Parser that Cracked the MediaWiki Code by sigil on Friday May 06, 2011 @03:07PM (#2522092)
> it'd be cool to build a working MediaWiki + Markdown => LaTeX converter....in something like Python.

For parsing MediaWiki in Python, check out mwlib [1], which was part of cooperation between Wikimedia Foundation and PediaPress. It's neither very complete nor very fast, but you might be able to hack up some LaTeX conversion with it.

[1] http://code.pediapress.com/wiki/wiki/mwlib

Re:The Parser that Cracked the MediaWiki Code by lloeki on Saturday May 07, 2011 @06:41AM (#2523570)
There are actually a bunch of Markdown parsers that create a DOM, or at least a proper tree (e.g markdown2 in PyPI). Markdown is outrageously simple compared to MediaWiki.

I actually wrote a subset-of-MediaWiki parser in C#, which stayed at the "subset" stage because of the ridiculous complexity and corner-cases that crop up even very early.

Re:The Parser that Cracked the MediaWiki Code by cpeterso on Saturday May 07, 2011 @06:55PM (#2524798)
Regarding the storage and access of Wikipedia's "world knowledge", DBpedia is a project that scrapes Wikipedia (InfoBoxes and categories) to create a structured, semantic database of knowledge.

https://secure.wikimedia.org/wikipedia/en/wiki/DBpedia