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.
 
 
 
 

363 lines
16 KiB

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