A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

227 linhas
10 KiB

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