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.
 
 
 
 

365 lines
16 KiB

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