A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

225 wiersze
10 KiB

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