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

192 行
9.2 KiB

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