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

120 行
5.9 KiB

  1. v0.4 (unreleased):
  2. - The parser is now distributed with Windows binaries, fixing an issue that
  3. prevented Windows users from using the C tokenizer.
  4. - Added support for parsing wikicode tables (patches by David Winegar).
  5. - Added a script to test for memory leaks in scripts/memtest.py.
  6. - Added a script to do releases in scripts/release.sh.
  7. - skip_style_tags can now be passed to mwparserfromhell.parse() (previously,
  8. only Parser().parse() allowed it).
  9. - The 'recursive' argument to Wikicode's filter methods now accepts a third
  10. option, RECURSE_OTHERS, which recurses over all children except instances of
  11. 'forcetype' (for example, `code.filter_templates(code.RECURSE_OTHERS)`
  12. returns all un-nested templates).
  13. - The parser now understands HTML tag attributes quoted with single quotes.
  14. When setting a tag attribute's value, quotes will be added if necessary. As
  15. part of this, Attribute's 'quoted' attribute has been changed to 'quotes',
  16. and is now either a string or None.
  17. - Calling Template.remove() with a Parameter object that is not part of the
  18. template now raises ValueError instead of doing nothing.
  19. - Parameters with non-integer keys can no longer be created with
  20. 'showkey=False', nor have the value of this attribute be set to False later.
  21. - _ListProxy.destroy() has been changed to _ListProxy.detach(), and now works
  22. in a more useful way.
  23. - If something goes wrong while parsing, ParserError will now be raised.
  24. Previously, the parser would produce an unclear BadRoute exception or allow
  25. an incorrect node tree to be build.
  26. - Fixed a parser bug involving nested tags, and another involving comments in
  27. template names.
  28. - Added tests to ensure that parsed trees convert back to wikicode without
  29. unintentional modifications.
  30. - Test coverage has been improved, and some minor related bugs have been fixed.
  31. - Updated and fixed some documentation.
  32. v0.3.3 (released April 22, 2014):
  33. - Added support for Python 2.6 and 3.4.
  34. - Template.has() is now passed 'ignore_empty=False' by default instead of True.
  35. This fixes a bug when adding parameters to templates with empty fields, and
  36. is a breaking change if you rely on the default behavior.
  37. - The 'matches' argument of Wikicode's filter methods now accepts a function
  38. (taking one argument, a Node, and returning a bool) in addition to a regex.
  39. - Re-added 'flat' argument to Wikicode.get_sections(), fixed the order in which
  40. it returns sections, and made it faster.
  41. - Wikicode.matches() now accepts a tuple or list of strings/Wikicode objects
  42. instead of just a single string or Wikicode.
  43. - Given the frequency of issues with the (admittedly insufficient) tag parser,
  44. there's a temporary skip_style_tags argument to parse() that ignores '' and
  45. ''' until these issues are corrected.
  46. - Fixed a parser bug involving nested wikilinks and external links.
  47. - C code cleanup and speed improvements.
  48. v0.3.2 (released September 1, 2013):
  49. - Added support for Python 3.2 (along with current support for 3.3 and 2.7).
  50. - Renamed Template.remove()'s first argument from 'name' to 'param', which now
  51. accepts Parameter objects in addition to parameter name strings.
  52. v0.3.1 (released August 29, 2013):
  53. - Fixed a parser bug involving URLs nested inside other markup.
  54. - Fixed some typos.
  55. v0.3 (released August 24, 2013):
  56. - Added complete support for HTML Tags, including forms like <ref>foo</ref>,
  57. <ref name="bar"/>, and wiki-markup tags like bold ('''), italics (''), and
  58. lists (*, #, ; and :).
  59. - Added support for ExternalLinks (http://example.com/ and
  60. [http://example.com/ Example]).
  61. - Wikicode's filter methods are now passed 'recursive=True' by default instead
  62. of False. This is a breaking change if you rely on any filter() methods being
  63. non-recursive by default.
  64. - Added a matches() method to Wikicode for page/template name comparisons.
  65. - The 'obj' param of Wikicode.insert_before(), insert_after(), replace(), and
  66. remove() now accepts other Wikicode objects and strings representing parts of
  67. wikitext, instead of just nodes. These methods also make all possible
  68. substitutions instead of just one.
  69. - Renamed Template.has_param() to has() for consistency with Template's other
  70. methods; has_param() is now an alias.
  71. - The C tokenizer extension now works on Python 3 in addition to Python 2.7.
  72. - Various bugfixes, internal changes, and cleanup.
  73. v0.2 (released June 20, 2013):
  74. - The parser now fully supports Python 3 in addition to Python 2.7.
  75. - Added a C tokenizer extension that is significantly faster than its Python
  76. equivalent. It is enabled by default (if available) and can be toggled by
  77. setting `mwparserfromhell.parser.use_c` to a boolean value.
  78. - Added a complete set of unit tests covering parsing and wikicode
  79. manipulation.
  80. - Renamed Wikicode.filter_links() to filter_wikilinks() (applies to ifilter as
  81. well).
  82. - Added filter methods for Arguments, Comments, Headings, and HTMLEntities.
  83. - Added 'before' param to Template.add(); renamed 'force_nonconformity' to
  84. 'preserve_spacing'.
  85. - Added 'include_lead' param to Wikicode.get_sections().
  86. - Removed 'flat' param from Wikicode.get_sections().
  87. - Removed 'force_no_field' param from Template.remove().
  88. - Added support for Travis CI.
  89. - Added note about Windows build issue in the README.
  90. - The tokenizer will limit itself to a realistic recursion depth to prevent
  91. errors and unreasonably long parse times.
  92. - Fixed how some nodes' attribute setters handle input.
  93. - Fixed multiple bugs in the tokenizer's handling of invalid markup.
  94. - Fixed bugs in the implementation of SmartList and StringMixIn.
  95. - Fixed some broken example code in the README; other copyedits.
  96. - Other bugfixes and code cleanup.
  97. v0.1.1 (released September 21, 2012):
  98. - Added support for Comments (<!-- foo -->) and Wikilinks ([[foo]]).
  99. - Added corresponding ifilter_links() and filter_links() methods to Wikicode.
  100. - Fixed a bug when parsing incomplete templates.
  101. - Fixed strip_code() to affect the contents of headings.
  102. - Various copyedits in documentation and comments.
  103. v0.1 (released August 23, 2012):
  104. - Initial release.