A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

367 líneas
16 KiB

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