2

None of these parsers are used by Wikipedia; None of them handle the wiki code correctly.

Does anyone know what parser Wikipedia uses?

Sean Walsh
  • 8,266
  • 3
  • 30
  • 38
Peter Westerlund
  • 741
  • 1
  • 10
  • 36

2 Answers2

4

Wikipedia runs on the Mediawiki engine, originally written precisely to use for Wikipedia.

They implement their own parser. A more thorough description of the parser is available in the manual.

Michael Madsen
  • 54,231
  • 8
  • 72
  • 83
  • Do you know how to use [their own parser](http://svn.wikimedia.org/doc/Parser_8php_source.html) in a simple example? – Peter Westerlund May 10 '11 at 21:55
  • @Peter: I've never worked with the MediaWiki source, but judging by the manual, you'll want to instantiate the class and call either the [parse](http://svn.wikimedia.org/doc/classParser.html#a0e3f2edd4bd47376953dfad4dcfc9c74) method. If it's just parsing to HTML, you might be able to use the [internalParse](http://svn.wikimedia.org/doc/classParser.html#a6b7ac0b498eb30e00dfcfb5722cfab9f) method instead. – Michael Madsen May 10 '11 at 22:01
  • The page die when I try to instantiate the class. Neither `$wiki =& new Parser();` or `$wiki = new Parser();` works. – Peter Westerlund May 10 '11 at 22:13
  • @Peter: I expect the parser has some amount of dependencies which you may or may need to provide somehow (e.g. include other files). Again, I have never touched or used this code, so I can't say for sure; if nothing else, you should be able to figure it out by turning on error messages and dealing with any problems one at a time. – Michael Madsen May 10 '11 at 22:17
  • @Peter: You may also find the following blog post helpful to understand the parser better: http://musialek.org/?p=94 – Michael Madsen May 10 '11 at 22:19
1

Wikipedia uses MediaWiki, which has its own parser.

Oswald
  • 31,254
  • 3
  • 43
  • 68