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

362 行
16 KiB

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