A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

275 lines
12 KiB

  1. Changelog
  2. =========
  3. v0.5
  4. ----
  5. `Released June 23, 2017 <https://github.com/earwig/mwparserfromhell/tree/v0.5>`_
  6. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.4.4...v0.5>`__):
  7. - Added :meth:`.Wikicode.contains` to determine whether a :class:`.Node` or
  8. :class:`.Wikicode` object is contained within another :class:`.Wikicode`
  9. object.
  10. - Added :meth:`.Wikicode.get_ancestors` and :meth:`.Wikicode.get_parent` to
  11. find all ancestors and the direct parent of a :class:`.Node`, respectively.
  12. - Fixed a long-standing performance issue with deeply nested, invalid syntax
  13. (`issue #42 <https://github.com/earwig/mwparserfromhell/issues/42>`_). The
  14. parser should be much faster on certain complex pages. The "max cycle"
  15. restriction has also been removed, so some situations where templates at the
  16. end of a page were being skipped are now resolved.
  17. - Made :meth:`Template.remove(keep_field=True) <.Template.remove>` behave more
  18. reasonably when the parameter is already empty.
  19. - Added the *keep_template_params* argument to :meth:`.Wikicode.strip_code`.
  20. If *True*, then template parameters will be preserved in the output.
  21. - :class:`.Wikicode` objects can now be pickled properly (fixed infinite
  22. recursion error on incompletely-constructed :class:`.StringMixIn`
  23. subclasses).
  24. - Fixed :meth:`.Wikicode.matches`\ 's behavior on iterables besides lists and
  25. tuples.
  26. - Fixed ``len()`` sometimes raising ``ValueError`` on empty node lists.
  27. - Fixed a rare parsing bug involving self-closing tags inside the attributes of
  28. unpaired tags.
  29. - Fixed release script after changes to PyPI.
  30. v0.4.4
  31. ------
  32. `Released December 30, 2016 <https://github.com/earwig/mwparserfromhell/tree/v0.4.4>`_
  33. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.4.3...v0.4.4>`__):
  34. - Added support for Python 3.6.
  35. - Fixed parsing bugs involving:
  36. - wikitables nested in templates;
  37. - wikitable error recovery when unable to recurse;
  38. - templates nested in template parameters before other parameters.
  39. - Fixed parsing file-like objects.
  40. - Made builds deterministic.
  41. - Documented caveats.
  42. v0.4.3
  43. ------
  44. `Released October 29, 2015 <https://github.com/earwig/mwparserfromhell/tree/v0.4.3>`_
  45. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.4.2...v0.4.3>`__):
  46. - Added Windows binaries for Python 3.5.
  47. - Fixed edge cases involving wikilinks inside of external links and vice versa.
  48. - Fixed a C tokenizer crash when a keyboard interrupt happens while parsing.
  49. v0.4.2
  50. ------
  51. `Released July 30, 2015 <https://github.com/earwig/mwparserfromhell/tree/v0.4.2>`__
  52. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.4.1...v0.4.2>`__):
  53. - Fixed setup script not including header files in releases.
  54. - Fixed Windows binary uploads.
  55. v0.4.1
  56. ------
  57. `Released July 30, 2015 <https://github.com/earwig/mwparserfromhell/tree/v0.4.1>`__
  58. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.4...v0.4.1>`__):
  59. - The process for building Windows binaries has been fixed, and these should be
  60. distributed along with new releases. Windows users can now take advantage of
  61. C speedups without having a compiler of their own.
  62. - Added support for Python 3.5.
  63. - ``<`` and ``>`` are now disallowed in wikilink titles and template names.
  64. This includes when denoting tags, but not comments.
  65. - Fixed the behavior of *preserve_spacing* in :meth:`.Template.add` and
  66. *keep_field* in :meth:`.Template.remove` on parameters with hidden keys.
  67. - Removed :meth:`._ListProxy.detach`. :class:`.SmartList`\ s now use weak
  68. references and their children are garbage-collected properly.
  69. - Fixed parser bugs involving:
  70. - templates with completely blank names;
  71. - templates with newlines and comments.
  72. - Heavy refactoring and fixes to the C tokenizer, including:
  73. - corrected a design flaw in text handling, allowing for substantial speed
  74. improvements when parsing long strings of plain text;
  75. - implemented new Python 3.3
  76. `PEP 393 <https://www.python.org/dev/peps/pep-0393/>`_ Unicode APIs.
  77. - Fixed various bugs in :class:`.SmartList`, including one that was causing
  78. memory issues on 64-bit builds of Python 2 on Windows.
  79. - Fixed some bugs in the release scripts.
  80. v0.4
  81. ----
  82. `Released May 23, 2015 <https://github.com/earwig/mwparserfromhell/tree/v0.4>`_
  83. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3.3...v0.4>`__):
  84. - The parser now falls back on pure Python mode if C extensions cannot be
  85. built. This fixes an issue that prevented some Windows users from installing
  86. the parser.
  87. - Added support for parsing wikicode tables (patches by David Winegar).
  88. - Added a script to test for memory leaks in :file:`scripts/memtest.py`.
  89. - Added a script to do releases in :file:`scripts/release.sh`.
  90. - *skip_style_tags* can now be passed to :func:`mwparserfromhell.parse()
  91. <.parse_anything>` (previously, only :meth:`.Parser.parse` allowed it).
  92. - The *recursive* argument to :class:`Wikicode's <.Wikicode>` :meth:`.filter`
  93. methods now accepts a third option, ``RECURSE_OTHERS``, which recurses over
  94. all children except instances of *forcetype* (for example,
  95. ``code.filter_templates(code.RECURSE_OTHERS)`` returns all un-nested
  96. templates).
  97. - The parser now understands HTML tag attributes quoted with single quotes.
  98. When setting a tag attribute's value, quotes will be added if necessary. As
  99. part of this, :class:`.Attribute`\ 's :attr:`~.Attribute.quoted` attribute
  100. has been changed to :attr:`~.Attribute.quotes`, and is now either a string or
  101. ``None``.
  102. - Calling :meth:`.Template.remove` with a :class:`.Parameter` object that is
  103. not part of the template now raises :exc:`ValueError` instead of doing
  104. nothing.
  105. - :class:`.Parameter`\ s with non-integer keys can no longer be created with
  106. *showkey=False*, nor have the value of this attribute be set to *False*
  107. later.
  108. - :meth:`._ListProxy.destroy` has been changed to :meth:`._ListProxy.detach`,
  109. and now works in a more useful way.
  110. - If something goes wrong while parsing, :exc:`.ParserError` will now be
  111. raised. Previously, the parser would produce an unclear :exc:`.BadRoute`
  112. exception or allow an incorrect node tree to be build.
  113. - Fixed parser bugs involving:
  114. - nested tags;
  115. - comments in template names;
  116. - tags inside of ``<nowiki>`` tags.
  117. - Added tests to ensure that parsed trees convert back to wikicode without
  118. unintentional modifications.
  119. - Added support for a :envvar:`NOWEB` environment variable, which disables a
  120. unit test that makes a web call.
  121. - Test coverage has been improved, and some minor related bugs have been fixed.
  122. - Updated and fixed some documentation.
  123. v0.3.3
  124. ------
  125. `Released April 22, 2014 <https://github.com/earwig/mwparserfromhell/tree/v0.3.3>`_
  126. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3.2...v0.3.3>`__):
  127. - Added support for Python 2.6 and 3.4.
  128. - :meth:`.Template.has` is now passed *ignore_empty=False* by default
  129. instead of *True*. This fixes a bug when adding parameters to templates with
  130. empty fields, **and is a breaking change if you rely on the default
  131. behavior.**
  132. - The *matches* argument of :class:`Wikicode's <.Wikicode>` :meth:`.filter`
  133. methods now accepts a function (taking one argument, a :class:`.Node`, and
  134. returning a bool) in addition to a regex.
  135. - Re-added *flat* argument to :meth:`.Wikicode.get_sections`, fixed the order
  136. in which it returns sections, and made it faster.
  137. - :meth:`.Wikicode.matches` now accepts a tuple or list of
  138. strings/:class:`.Wikicode` objects instead of just a single string or
  139. :class:`.Wikicode`.
  140. - Given the frequency of issues with the (admittedly insufficient) tag parser,
  141. there's a temporary *skip_style_tags* argument to :meth:`~.Parser.parse` that
  142. ignores ``''`` and ``'''`` until these issues are corrected.
  143. - Fixed a parser bug involving nested wikilinks and external links.
  144. - C code cleanup and speed improvements.
  145. v0.3.2
  146. ------
  147. `Released September 1, 2013 <https://github.com/earwig/mwparserfromhell/tree/v0.3.2>`_
  148. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3.1...v0.3.2>`__):
  149. - Added support for Python 3.2 (along with current support for 3.3 and 2.7).
  150. - Renamed :meth:`.Template.remove`\ 's first argument from *name* to *param*,
  151. which now accepts :class:`.Parameter` objects in addition to parameter name
  152. strings.
  153. v0.3.1
  154. ------
  155. `Released August 29, 2013 <https://github.com/earwig/mwparserfromhell/tree/v0.3.1>`_
  156. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3...v0.3.1>`__):
  157. - Fixed a parser bug involving URLs nested inside other markup.
  158. - Fixed some typos.
  159. v0.3
  160. ----
  161. `Released August 24, 2013 <https://github.com/earwig/mwparserfromhell/tree/v0.3>`_
  162. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.2...v0.3>`__):
  163. - Added complete support for HTML :class:`Tags <.Tag>`, including forms like
  164. ``<ref>foo</ref>``, ``<ref name="bar"/>``, and wiki-markup tags like bold
  165. (``'''``), italics (``''``), and lists (``*``, ``#``, ``;`` and ``:``).
  166. - Added support for :class:`.ExternalLink`\ s (``http://example.com/`` and
  167. ``[http://example.com/ Example]``).
  168. - :class:`Wikicode's <.Wikicode>` :meth:`.filter` methods are now passed
  169. *recursive=True* by default instead of *False*. **This is a breaking change
  170. if you rely on any filter() methods being non-recursive by default.**
  171. - Added a :meth:`.matches` method to :class:`.Wikicode` for page/template name
  172. comparisons.
  173. - The *obj* param of :meth:`.Wikicode.insert_before`, :meth:`.insert_after`,
  174. :meth:`~.Wikicode.replace`, and :meth:`~.Wikicode.remove` now accepts
  175. :class:`.Wikicode` objects and strings representing parts of wikitext,
  176. instead of just nodes. These methods also make all possible substitutions
  177. instead of just one.
  178. - Renamed :meth:`.Template.has_param` to :meth:`~.Template.has` for consistency
  179. with :class:`.Template`\ 's other methods; :meth:`.has_param` is now an
  180. alias.
  181. - The C tokenizer extension now works on Python 3 in addition to Python 2.7.
  182. - Various bugfixes, internal changes, and cleanup.
  183. v0.2
  184. ----
  185. `Released June 20, 2013 <https://github.com/earwig/mwparserfromhell/tree/v0.2>`_
  186. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.1.1...v0.2>`__):
  187. - The parser now fully supports Python 3 in addition to Python 2.7.
  188. - Added a C tokenizer extension that is significantly faster than its Python
  189. equivalent. It is enabled by default (if available) and can be toggled by
  190. setting :attr:`mwparserfromhell.parser.use_c` to a boolean value.
  191. - Added a complete set of unit tests covering parsing and wikicode
  192. manipulation.
  193. - Renamed :meth:`.filter_links` to :meth:`.filter_wikilinks` (applies to
  194. :meth:`.ifilter` as well).
  195. - Added filter methods for :class:`Arguments <.Argument>`,
  196. :class:`Comments <.Comment>`, :class:`Headings <.Heading>`, and
  197. :class:`HTMLEntities <.HTMLEntity>`.
  198. - Added *before* param to :meth:`.Template.add`; renamed *force_nonconformity*
  199. to *preserve_spacing*.
  200. - Added *include_lead* param to :meth:`.Wikicode.get_sections`.
  201. - Removed *flat* param from :meth:`.get_sections`.
  202. - Removed *force_no_field* param from :meth:`.Template.remove`.
  203. - Added support for Travis CI.
  204. - Added note about Windows build issue in the README.
  205. - The tokenizer will limit itself to a realistic recursion depth to prevent
  206. errors and unreasonably long parse times.
  207. - Fixed how some nodes' attribute setters handle input.
  208. - Fixed multiple bugs in the tokenizer's handling of invalid markup.
  209. - Fixed bugs in the implementation of :class:`.SmartList` and
  210. :class:`.StringMixIn`.
  211. - Fixed some broken example code in the README; other copyedits.
  212. - Other bugfixes and code cleanup.
  213. v0.1.1
  214. ------
  215. `Released September 21, 2012 <https://github.com/earwig/mwparserfromhell/tree/v0.1.1>`_
  216. (`changes <https://github.com/earwig/mwparserfromhell/compare/v0.1...v0.1.1>`__):
  217. - Added support for :class:`Comments <.Comment>` (``<!-- foo -->``) and
  218. :class:`Wikilinks <.Wikilink>` (``[[foo]]``).
  219. - Added corresponding :meth:`.ifilter_links` and :meth:`.filter_links` methods
  220. to :class:`.Wikicode`.
  221. - Fixed a bug when parsing incomplete templates.
  222. - Fixed :meth:`.strip_code` to affect the contents of headings.
  223. - Various copyedits in documentation and comments.
  224. v0.1
  225. ----
  226. `Released August 23, 2012 <https://github.com/earwig/mwparserfromhell/tree/v0.1>`_:
  227. - Initial release.