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.
 
 
 
 

297 rivejä
13 KiB

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