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.
 
 
 
 

305 lines
13 KiB

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