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.
 
 
 
 

418 lines
18 KiB

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