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.

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