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.
 
 
 
 

377 lines
16 KiB

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