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.
 
 
 
 

456 line
19 KiB

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