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