A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

changelog.rst 18 KiB

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