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.
 
 
 
 

376 linhas
16 KiB

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