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.
 
 
 
 

389 linhas
17 KiB

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