Unreleased (changes):
- The parser is now distributed with Windows binaries, fixing an issue that prevented Windows users from using the C tokenizer.
- Added support for parsing wikicode tables (patches by David Winegar).
- Added a script to test for memory leaks in
scripts/memtest.py
. - Added a script to do releases in
scripts/release.sh
. - skip_style_tags can now be passed to
mwparserfromhell.parse() <.parse_anything>
(previously, only.Parser.parse
allowed it). - The recursive argument to
Wikicode's <.Wikicode>
.filter
methods now accepts a third option,RECURSE_OTHERS
, which recurses over all children except instances of forcetype (for example,code.filter_templates(code.RECURSE_OTHERS)
returns all un-nested templates). - The parser now understands HTML tag attributes quoted with single quotes. When setting a tag attribute's value, quotes will be added if necessary. As part of this,
.Attribute
's~.Attribute.quoted
attribute has been changed to~.Attribute.quotes
, and is now either a string orNone
. - Calling
.Template.remove
with a.Parameter
object that is not part of the template now raisesValueError
instead of doing nothing. .Parameter
s with non-integer keys can no longer be created with showkey=False, nor have the value of this attribute be set to False later.._ListProxy.destroy
has been changed to._ListProxy.detach
, and now works in a more useful way.- If something goes wrong while parsing,
.ParserError
will now be raised. Previously, the parser would produce an unclear.BadRoute
exception or allow an incorrect node tree to be build. - Fixed parser bugs involving:
- nested tags;
- comments in template names;
- tags inside of
<nowiki>
tags.
- Added tests to ensure that parsed trees convert back to wikicode without unintentional modifications.
- Added support for a
NOWEB
environment variable, which disables a unit test that makes a web call. - Test coverage has been improved, and some minor related bugs have been fixed.
- Updated and fixed some documentation.
Released April 22, 2014 (changes):
- Added support for Python 2.6 and 3.4.
.Template.has
is now passed ignore_empty=False by default instead of True. This fixes a bug when adding parameters to templates with empty fields, and is a breaking change if you rely on the default behavior.- The matches argument of
Wikicode's <.Wikicode>
.filter
methods now accepts a function (taking one argument, a.Node
, and returning a bool) in addition to a regex. - Re-added flat argument to
.Wikicode.get_sections
, fixed the order in which it returns sections, and made it faster. .Wikicode.matches
now accepts a tuple or list of strings/.Wikicode
objects instead of just a single string or.Wikicode
.- Given the frequency of issues with the (admittedly insufficient) tag parser, there's a temporary skip_style_tags argument to
~.Parser.parse
that ignores''
and'''
until these issues are corrected. - Fixed a parser bug involving nested wikilinks and external links.
- C code cleanup and speed improvements.
Released September 1, 2013 (changes):
- Added support for Python 3.2 (along with current support for 3.3 and 2.7).
- Renamed
.Template.remove
's first argument from name to param, which now accepts.Parameter
objects in addition to parameter name strings.
Released August 29, 2013 (changes):
- Fixed a parser bug involving URLs nested inside other markup.
- Fixed some typos.
Released August 24, 2013 (changes):
- Added complete support for HTML
Tags <.Tag>
, including forms like<ref>foo</ref>
,<ref name="bar"/>
, and wiki-markup tags like bold ('''
), italics (''
), and lists (*
,#
,;
and:
). - Added support for
.ExternalLink
s (http://example.com/
and[http://example.com/ Example]
). Wikicode's <.Wikicode>
.filter
methods are now passed recursive=True by default instead of False. This is a breaking change if you rely on any filter() methods being non-recursive by default.- Added a
.matches
method to.Wikicode
for page/template name comparisons. - The obj param of
.Wikicode.insert_before
,.insert_after
,~.Wikicode.replace
, and~.Wikicode.remove
now accepts.Wikicode
objects and strings representing parts of wikitext, instead of just nodes. These methods also make all possible substitutions instead of just one. - Renamed
.Template.has_param
to~.Template.has
for consistency with.Template
's other methods;.has_param
is now an alias. - The C tokenizer extension now works on Python 3 in addition to Python 2.7.
- Various bugfixes, internal changes, and cleanup.
Released June 20, 2013 (changes):
- The parser now fully supports Python 3 in addition to Python 2.7.
- Added a C tokenizer extension that is significantly faster than its Python equivalent. It is enabled by default (if available) and can be toggled by setting
mwparserfromhell.parser.use_c
to a boolean value. - Added a complete set of unit tests covering parsing and wikicode manipulation.
- Renamed
.filter_links
to.filter_wikilinks
(applies to.ifilter
as well). - Added filter methods for
Arguments <.Argument>
,Comments <.Comment>
,Headings <.Heading>
, andHTMLEntities <.HTMLEntity>
. - Added before param to
.Template.add
; renamed force_nonconformity to preserve_spacing. - Added include_lead param to
.Wikicode.get_sections
. - Removed flat param from
.get_sections
. - Removed force_no_field param from
.Template.remove
. - Added support for Travis CI.
- Added note about Windows build issue in the README.
- The tokenizer will limit itself to a realistic recursion depth to prevent errors and unreasonably long parse times.
- Fixed how some nodes' attribute setters handle input.
- Fixed multiple bugs in the tokenizer's handling of invalid markup.
- Fixed bugs in the implementation of
.SmartList
and.StringMixIn
. - Fixed some broken example code in the README; other copyedits.
- Other bugfixes and code cleanup.
Released September 21, 2012 (changes):
- Added support for
Comments <.Comment>
(<!-- foo -->
) andWikilinks <.Wikilink>
([[foo]]
). - Added corresponding
.ifilter_links
and.filter_links
methods to.Wikicode
. - Fixed a bug when parsing incomplete templates.
- Fixed
.strip_code
to affect the contents of headings. - Various copyedits in documentation and comments.
- Initial release.