A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Não pode escolher mais do que 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.
 
 
 
 

354 linhas
15 KiB

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