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.
 
 
 
 

284 lines
12 KiB

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