Also: improve rendering of README.rst
Parsing with the 'wikitext' parser will parse and render as expected and do nothing more. This is useful for the inclusion of the article content in a larger HTML page. Parsing with the 'body' parser will also add the <body>...</body> tags and the interwiki links and category links. This is useful to mimic the behavior of MediaWiki's parser when rendering a whole article as a web page.
enumerate() instead of zip() will save copying all the split bits of the string once for each loop.
Mostly, import things once, at the top, and let things have distinct names.
We had a stupid apostrophe parsing problem because we were parsing the whole text instead of doing that line by line as the parser expects. I added tests for this weird case. Also: update apostrophe.py to be closer to MediaWiki's code. Also: add docstring for the parameters of html.make_parser()
All open tags should be closed, in the right order (if no closing tag, add it). A closing tag must close an open tag (if not, remove it). Of course, the tags in "<br> and </br>" are not open/close tags, so they will be automagically converted to: "<br /> and <br />".
This allows to choose which tags and attributes will be allowed by the HTML postprocessor. Each instance of it can have different lists instead of using predefined lists. Also: clean a little the postprocessors.
This new version of apostrophe.py allows to choose what the italic and bold tags will be. e.g.: <b>...</b>, <strong>...</strong> or *...*
In the HTML preprocessor, the allowed tags are cleaned (only the allowed parameters are kept) and output as HTML and the disallowed tags are output as text. In the text preprocessor, the allowed tags are rendered by specific functions and the disallowed ones are output as text.