A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

270 lines
12 KiB

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