A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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