A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

409 行
18 KiB

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