A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

303 wiersze
13 KiB

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