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.
 
 
 
 

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