On 9/14/07, Brion Vibber <brion(a)wikimedia.org> wrote:
I'm happy to announce that as part of an ongoing
partnership between
the Wikimedia Foundation and
PediaPress.com, PediaPress has agreed to
release as open source a MediaWiki parser library written in Python:
http://code.pediapress.com/wiki/wiki
The library is released under a BSD license. It supports rendering
mathematics and timelines, provided the correct dependencies are
installed. It could be used for purposes such as offline readers or
desktop applications.
It took me a while to get a chance to work with it some. I'm quite impressed.
A really quick example which will be appricated by anyone who has
worked on mediawiki parsers in the past:
In [528]: parse("{|\n| [[Image:dogs.jpg|thumb|'''''This
'''is''' an''
example of [[Food|things to eat]]]]\n|-\n|}\n")
parser.info >> Parsing "'unknown'"
Article 'unknown': 1 children
Node '': 2 children
Table '' {}: 2 children
Row '' {}: 1 children
Cell '' {}: 1 children
Node '': 3 children
' '
ImageLink '': 4 children
Style "'''''": 2 children
'This'
' '
Style "''": 1 children
'is'
Style "'''''": 2 children
' '
'an'
Style "'''": 6 children
' '
'example'
' '
'of'
' '
Link '': 1 children
'things to eat'
'\n'
Row '' {}: 0 children
'\n'