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.
 
 
 
 

283 lines
12 KiB

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