A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

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