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.
 
 
 
 

288 linhas
13 KiB

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