mwlib

Overview

mwlib is a Python library for parsing  MediaWiki articles. It is currently aimed at developers, who have a need to somehow handle MediaWiki articles.

Example

In [5]: from mwlib.uparser import simpleparse

In [6]: simpleparse("=h1=\n*item 1\n*item2\n==h2==\nsome [[Link|caption]] there\n")
parser.info >> Parsing "'unknown'"
 Article 'unknown': 1 children
     Section '': 3 children
         Node '': 1 children
             'h1'
         Paragraph '': 2 children
             '\n'
             Node '': 1 children
                 ItemList '': 2 children
                     Item '': 1 children
                         'item 1'
                     Item '': 1 children
                         'item2'
         Section '': 2 children
             Node '': 1 children
                 'h2'
             Paragraph '': 5 children
                 '\n'
                 'some '
                 ArticleLink '': 1 children
                     'caption'
                 ' there'
                 '\n'
Out[6]: Article 'unknown': 1 children

License

mwlib is copyrighted by  PediaPress and is distributed under a BSD license (see the included README.txt for details).

Installation / Source

To install mwlib, please see the detailed installation guide.

Mailing List

We've setup a  Google group for discussion of mwlib, mwlib.rl and the Collection extension.

You can either subscribe per email: <mwlib-subscribe@googlegroups.com> or browse its  archive.

Development

Use the issue tracker to submit bugs, feature requests.

Here is a list of open issues.

Programs

mwlib installs the following programs:

mw-parse

parses articles from a (virtual) MediaWiki installation. It's sole purpose is testing the parser.

mw-show

show an article or a template on stdout

mw-render

Render MediaWiki articles to different output formats. See commands or Examples for usage.

mw-zip

create a zipfile containing a list of articles, all needed templates, and images.
This zipfile can then be used as a virtual MediaWiki installation.
See commands or Examples for usage.

mw-serve

start a server interface to mw-render and mw-zip

All of those programs take a -c/--conf argument. The config file describes the virtual wiki to use. See ConfigFile for more information.

See also the full documentation of those commands.

Projects using mwlib