A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

341 lignes
15 KiB

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