A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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