A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. name: basic
  2. label: a basic tag with an open and close
  3. input: "<ref></ref>"
  4. output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  5. ---
  6. name: basic_selfclosing
  7. label: a basic self-closing tag
  8. input: "<ref/>"
  9. output: [TagOpenOpen(), Text(text="ref"), TagCloseSelfclose(padding="")]
  10. ---
  11. name: content
  12. label: a tag with some content in the middle
  13. input: "<ref>this is a reference</ref>"
  14. output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=""), Text(text="this is a reference"), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  15. ---
  16. name: padded_open
  17. label: a tag with some padding in the open tag
  18. input: "<ref ></ref>"
  19. output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=" "), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  20. ---
  21. name: padded_close
  22. label: a tag with some padding in the close tag
  23. input: "<ref></ref >"
  24. output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref "), TagCloseClose()]
  25. ---
  26. name: padded_selfclosing
  27. label: a self-closing tag with padding
  28. input: "<ref />"
  29. output: [TagOpenOpen(), Text(text="ref"), TagCloseSelfclose(padding=" ")]
  30. ---
  31. name: attribute
  32. label: a tag with a single attribute
  33. input: "<ref name></ref>"
  34. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  35. ---
  36. name: attribute_value
  37. label: a tag with a single attribute with a value
  38. input: "<ref name=foo></ref>"
  39. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), Text(text="foo"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  40. ---
  41. name: attribute_quoted
  42. label: a tag with a single quoted attribute
  43. input: "<ref name="foo bar"></ref>"
  44. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), Text(text="foo bar"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  45. ---
  46. name: attribute_hyphen
  47. label: a tag with a single attribute, containing a hyphen
  48. input: "<ref name=foo-bar></ref>"
  49. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), Text(text="foo-bar"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  50. ---
  51. name: attribute_quoted_hyphen
  52. label: a tag with a single quoted attribute, containing a hyphen
  53. input: "<ref name="foo-bar"></ref>"
  54. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), Text(text="foo-bar"), TagCloseOpen(padding=""), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  55. ---
  56. name: attribute_selfclosing
  57. label: a self-closing tag with a single attribute
  58. input: "<ref name/>"
  59. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagCloseSelfclose(padding="")]
  60. ---
  61. name: attribute_selfclosing_value
  62. label: a self-closing tag with a single attribute with a value
  63. input: "<ref name=foo/>"
  64. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), Text(text="foo"), TagCloseSelfclose(padding="")]
  65. ---
  66. name: attribute_selfclosing_value_quoted
  67. label: a self-closing tag with a single quoted attribute
  68. input: "<ref name="foo"/>"
  69. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), Text(text="foo"), TagCloseSelfclose(padding="")]
  70. ---
  71. name: nested_tag
  72. label: a tag nested within the attributes of another
  73. input: "<ref name=<span style="color: red;">foo</span>>citation</ref>"
  74. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagOpenOpen(), Text(text="span"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="style"), TagAttrEquals(), TagAttrQuote(), Text(text="color: red;"), TagCloseOpen(padding=""), Text(text="foo"), TagOpenClose(), Text(text="span"), TagCloseClose(), TagCloseOpen(padding=""), Text(text="citation"), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  75. ---
  76. name: nested_tag_quoted
  77. label: a tag nested within the attributes of another, quoted
  78. input: "<ref name="<span style="color: red;">foo</span>">citation</ref>"
  79. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), TagOpenOpen(), Text(text="span"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="style"), TagAttrEquals(), TagAttrQuote(), Text(text="color: red;"), TagCloseOpen(padding=""), Text(text="foo"), TagOpenClose(), Text(text="span"), TagCloseClose(), TagCloseOpen(padding=""), Text(text="citation"), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  80. ---
  81. name: nested_troll_tag
  82. label: a bogus tag that appears to be nested within the attributes of another
  83. input: "<ref name=</ ><//>>citation</ref>"
  84. output: [Text(text="<ref name=</ ><//>>citation</ref>")]
  85. ---
  86. name: nested_troll_tag_quoted
  87. label: a bogus tag that appears to be nested within the attributes of another, quoted
  88. input: "<ref name="</ ><//>">citation</ref>"
  89. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), Text(text="</ ><//>"), TagCloseOpen(padding=""), Text(text="citation"), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  90. ---
  91. name: invalid_space_begin_open
  92. label: invalid tag: a space at the beginning of the open tag
  93. input: "< ref>test</ref>"
  94. output: [Text(text="< ref>test</ref>")]
  95. ---
  96. name: invalid_space_begin_close
  97. label: invalid tag: a space at the beginning of the close tag
  98. input: "<ref>test</ ref>"
  99. output: [Text(text="<ref>test</ ref>")]
  100. ---
  101. name: valid_space_end
  102. label: valid tag: spaces at the ends of both the open and close tags
  103. input: "<ref >test</ref >"
  104. output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=" "), Text(text="test"), TagOpenClose(), Text(text="ref "), TagCloseClose()]
  105. ---
  106. name: invalid_template_ends
  107. label: invalid tag: a template at the ends of both the open and close tags
  108. input: "<ref {{foo}}>test</ref {{foo}}>"
  109. output: [Text(text="<ref "), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text=">test</ref "), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text=">")]
  110. ---
  111. name: invalid_template_ends_nospace
  112. label: invalid tag: a template at the ends of both the open and close tags, without spacing
  113. input: "<ref {{foo}}>test</ref{{foo}}>"
  114. output: [Text(text="<ref "), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text=">test</ref"), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text=">")]
  115. ---
  116. name: valid_template_end_open
  117. label: valid tag: a template at the end of the open tag
  118. input: "<ref {{foo}}>test</ref>"
  119. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), TemplateOpen(), Text(text="foo"), TemplateClose(), TagCloseOpen(padding=""), Text(text="test"), TagOpenClose(), Text(text="ref"), TagCloseClose()]
  120. ---
  121. name: valid_template_end_open_space_end_close
  122. label: valid tag: a template at the end of the open tag; whitespace at the end of the close tag
  123. input: "<ref {{foo}}>test</ref\n>"
  124. output: [TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), TemplateOpen(), Text(text="foo"), TemplateClose(), TagCloseOpen(padding=""), Text(text="test"), TagOpenClose(), Text(text="ref\n"), TagCloseClose()]
  125. ---
  126. name: invalid_template_end_open_nospace
  127. label: invalid tag: a template at the end of the open tag, without spacing
  128. input: "<ref{{foo}}>test</ref>"
  129. output: [Text(text="<ref"), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text=">test</ref>")]
  130. ---
  131. name: invalid_template_start_close
  132. label: invalid tag: a template at the beginning of the close tag
  133. input: "<ref>test</{{foo}}ref>"
  134. output: [Text(text="<ref>test</"), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="ref>")]
  135. ---
  136. name: invalid_template_start_open
  137. label: invalid tag: a template at the beginning of the open tag
  138. input: "<{{foo}}ref>test</ref>"
  139. output: [Text(text="<"), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="ref>test</ref>")]
  140. ---
  141. name: unclosed_quote
  142. label: a quoted attribute that is never closed
  143. input: "<span style="foobar>stuff</span>"
  144. output: [TagOpenOpen(), Text(text="span"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="style"), TagAttrEquals(), Text(text="\"foobar"), TagCloseOpen(padding=""), Text(text="stuff"), TagOpenClose(), Text(text="span"), TagCloseClose()]
  145. ---
  146. name: fake_quote
  147. label: a fake quoted attribute
  148. input: "<span style="foo"bar>stuff</span>"
  149. output: [TagOpenOpen(), Text(text="span"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="style"), TagAttrEquals(), Text(text="\"foo\"bar"), TagCloseOpen(padding=""), Text(text="stuff"), TagOpenClose(), Text(text="span"), TagCloseClose()]
  150. ---
  151. name: fake_quote_complex
  152. label: a fake quoted attribute, with spaces and templates and links
  153. input: "<span style="foo {{bar}}\n[[baz]]"buzz >stuff</span>"
  154. output: [TagOpenOpen(), Text(text="span"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="style"), TagAttrEquals(), Text(text="\"foo"), TagAttrStart(pad_first=" ", pad_before_eq="\n", pad_after_eq=""), TemplateOpen(), Text(text="bar"), TemplateClose(), TagAttrStart(pad_first="", pad_before_eq=" ", pad_after_eq=""), WikilinkOpen(), Text(text="baz"), WikilinkClose(), Text(text="\"buzz"), TagCloseOpen(padding=""), Text(text="stuff"), TagOpenClose(), Text(text="span"), TagCloseClose()]
  155. ---
  156. name: incomplete_lbracket
  157. label: incomplete tags: just a left bracket
  158. input: "<"
  159. output: [Text(text="<")]
  160. ---
  161. name: incomplete_lbracket_junk
  162. label: incomplete tags: just a left bracket, surrounded by stuff
  163. input: "foo<bar"
  164. output: [Text(text="foo<bar")]
  165. ---
  166. name: incomplete_unclosed_open
  167. label: incomplete tags: an unclosed open tag
  168. input: "junk <ref"
  169. output: [Text(text="junk <ref")]
  170. ---
  171. name: incomplete_unclosed_open_space
  172. label: incomplete tags: an unclosed open tag, space
  173. input: "junk <ref "
  174. output: [Text(text="junk <ref ")]
  175. ---
  176. name: incomplete_unclosed_open_unnamed_attr
  177. label: incomplete tags: an unclosed open tag, unnamed attribute
  178. input: "junk <ref name"
  179. output: [Text(text="junk <ref name")]
  180. ---
  181. name: incomplete_unclosed_open_attr_equals
  182. label: incomplete tags: an unclosed open tag, attribute, equal sign
  183. input: "junk <ref name="
  184. output: [Text(text="junk <ref name=")]
  185. ---
  186. name: incomplete_unclosed_open_attr_equals_quoted
  187. label: incomplete tags: an unclosed open tag, attribute, equal sign, quote
  188. input: "junk <ref name=""
  189. output: [Text(text="junk <ref name=\"")]
  190. ---
  191. name: incomplete_unclosed_open_attr
  192. label: incomplete tags: an unclosed open tag, attribute with a key/value
  193. input: "junk <ref name=foo"
  194. output: [Text(text="junk <ref name=foo")]
  195. ---
  196. name: incomplete_unclosed_open_attr_quoted
  197. label: incomplete tags: an unclosed open tag, attribute with a key/value, quoted
  198. input: "junk <ref name="foo""
  199. output: [Text(text="junk <ref name=\"foo\"")]
  200. ---
  201. name: incomplete_open
  202. label: incomplete tags: an open tag
  203. input: "junk <ref>"
  204. output: [Text(text="junk <ref>")]
  205. ---
  206. name: incomplete_open_unnamed_attr
  207. label: incomplete tags: an open tag, unnamed attribute
  208. input: "junk <ref name>"
  209. output: [Text(text="junk <ref name>")]
  210. ---
  211. name: incomplete_open_attr_equals
  212. label: incomplete tags: an open tag, attribute, equal sign
  213. input: "junk <ref name=>"
  214. output: [Text(text="junk <ref name=>")]
  215. ---
  216. name: incomplete_open_attr
  217. label: incomplete tags: an open tag, attribute with a key/value
  218. input: "junk <ref name=foo>"
  219. output: [Text(text="junk <ref name=foo>")]
  220. ---
  221. name: incomplete_open_attr_quoted
  222. label: incomplete tags: an open tag, attribute with a key/value, quoted
  223. input: "junk <ref name="foo">"
  224. output: [Text(text="junk <ref name=\"foo\">")]
  225. ---
  226. name: incomplete_open_text
  227. label: incomplete tags: an open tag, text
  228. input: "junk <ref>foo"
  229. output: [Text(text="junk <ref>foo")]
  230. ---
  231. name: incomplete_open_attr_text
  232. label: incomplete tags: an open tag, attribute with a key/value, text
  233. input: "junk <ref name=foo>bar"
  234. output: [Text(text="junk <ref name=foo>bar")]
  235. ---
  236. name: incomplete_open_text_lbracket
  237. label: incomplete tags: an open tag, text, left open bracket
  238. input: "junk <ref>bar<"
  239. output: [Text(text="junk <ref>bar<")]
  240. ---
  241. name: incomplete_open_text_lbracket_slash
  242. label: incomplete tags: an open tag, text, left bracket, slash
  243. input: "junk <ref>bar</"
  244. output: [Text(text="junk <ref>bar</")]
  245. ---
  246. name: incomplete_open_text_unclosed_close
  247. label: incomplete tags: an open tag, text, unclosed close
  248. input: "junk <ref>bar</ref"
  249. output: [Text(text="junk <ref>bar</ref")]
  250. ---
  251. name: incomplete_open_text_wrong_close
  252. label: incomplete tags: an open tag, text, wrong close
  253. input: "junk <ref>bar</span>"
  254. output: [Text(text="junk <ref>bar</span>")]
  255. ---
  256. name: incomplete_unclosed_close
  257. label: incomplete tags: an unclosed close tag
  258. input: "junk </"
  259. output: [Text(text="junk </")]
  260. ---
  261. name: incomplete_unclosed_close_text
  262. label: incomplete tags: an unclosed close tag, with text
  263. input: "junk </br"
  264. output: [Text(text="junk </br")]
  265. ---
  266. name: incomplete_close
  267. label: incomplete tags: a close tag
  268. input: "junk </ref>"
  269. output: [Text(text="junk </ref>")]
  270. ---
  271. name: incomplete_no_tag_name_open
  272. label: incomplete tags: no tag name within brackets; just an open
  273. input: "junk <>"
  274. output: [Text(text="junk <>")]
  275. ---
  276. name: incomplete_no_tag_name_selfclosing
  277. label: incomplete tags: no tag name within brackets; self-closing
  278. input: "junk < />"
  279. output: [Text(text="junk < />")]
  280. ---
  281. name: incomplete_no_tag_name_open_close
  282. label: incomplete tags: no tag name within brackets; open and close
  283. input: "junk <></>"
  284. output: [Text(text="junk <></>")]
  285. ---
  286. name: backslash_premature_before
  287. label: a backslash before a quote before a space
  288. input: "<foo attribute="this is\\" quoted">blah</foo>"
  289. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="this is\\\" quoted"), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  290. ---
  291. name: backslash_premature_after
  292. label: a backslash before a quote after a space
  293. input: "<foo attribute="this is \\"quoted">blah</foo>"
  294. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="this is \\\"quoted"), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  295. ---
  296. name: backslash_premature_middle
  297. label: a backslash before a quote in the middle of a word
  298. input: "<foo attribute="this i\\"s quoted">blah</foo>"
  299. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="this i\\\"s quoted"), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  300. ---
  301. name: backslash_adjacent
  302. label: escaped quotes next to unescaped quotes
  303. input: "<foo attribute="\\"this is quoted\\"">blah</foo>"
  304. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="\\\"this is quoted\\\""), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  305. ---
  306. name: backslash_endquote
  307. label: backslashes before the end quote, causing the attribute to become unquoted
  308. input: "<foo attribute="this_is quoted\\">blah</foo>"
  309. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), Text(text="\"this_is"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="quoted\\\""), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  310. ---
  311. name: backslash_double
  312. label: two adjacent backslashes, which do *not* affect the quote
  313. input: "<foo attribute="this is\\\\" quoted">blah</foo>"
  314. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="this is\\\\"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="quoted\""), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  315. ---
  316. name: backslash_triple
  317. label: three adjacent backslashes, which do *not* affect the quote
  318. input: "<foo attribute="this is\\\\\\" quoted">blah</foo>"
  319. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="this is\\\\\\"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="quoted\""), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  320. ---
  321. name: backslash_unaffecting
  322. label: backslashes near quotes, but not immediately adjacent, thus having no effect
  323. input: "<foo attribute="\\quote\\d" also="quote\\d\\">blah</foo>"
  324. output: [TagOpenOpen(), Text(text="foo"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attribute"), TagAttrEquals(), TagAttrQuote(), Text(text="\\quote\\d"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="also"), TagAttrEquals(), Text(text="\"quote\\d\\\""), TagCloseOpen(padding=""), Text(text="blah"), TagOpenClose(), Text(text="foo"), TagCloseClose()]
  325. ---
  326. name: unparsable
  327. label: a tag that should not be put through the normal parser
  328. input: "{{t1}}<nowiki>{{t2}}</nowiki>{{t3}}"
  329. output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()]
  330. ---
  331. name: unparsable_complex
  332. label: a tag that should not be put through the normal parser; lots of stuff inside
  333. input: "{{t1}}<pre>{{t2}}\n==Heading==\nThis is some text with a [[page|link]].</pre>{{t3}}"
  334. output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="pre"), TagCloseOpen(padding=""), Text(text="{{t2}}\n==Heading==\nThis is some text with a [[page|link]]."), TagOpenClose(), Text(text="pre"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()]
  335. ---
  336. name: unparsable_attributed
  337. label: a tag that should not be put through the normal parser; parsed attributes
  338. input: "{{t1}}<nowiki attr=val attr2="{{val2}}">{{t2}}</nowiki>{{t3}}"
  339. output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr"), TagAttrEquals(), Text(text="val"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr2"), TagAttrEquals(), TagAttrQuote(), TemplateOpen(), Text(text="val2"), TemplateClose(), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()]
  340. ---
  341. name: unparsable_incomplete
  342. label: a tag that should not be put through the normal parser; incomplete
  343. input: "{{t1}}<nowiki>{{t2}}{{t3}}"
  344. output: [TemplateOpen(), Text(text="t1"), TemplateClose(), Text(text="<nowiki>"), TemplateOpen(), Text(text="t2"), TemplateClose(), TemplateOpen(), Text(text="t3"), TemplateClose()]
  345. ---
  346. name: unparsable_entity
  347. label: a HTML entity inside unparsable text is still parsed
  348. input: "{{t1}}<nowiki>{{t2}}&nbsp;{{t3}}</nowiki>{{t4}}"
  349. output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagCloseOpen(padding=""), Text(text="{{t2}}"), HTMLEntityStart(), Text(text="nbsp"), HTMLEntityEnd(), Text(text="{{t3}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t4"), TemplateClose()]
  350. ---
  351. name: unparsable_entity_incomplete
  352. label: an incomplete HTML entity inside unparsable text
  353. input: "<nowiki>&</nowiki>"
  354. output: [TagOpenOpen(), Text(text="nowiki"), TagCloseOpen(padding=""), Text(text="&"), TagOpenClose(), Text(text="nowiki"), TagCloseClose()]
  355. ---
  356. name: unparsable_entity_incomplete_2
  357. label: an incomplete HTML entity inside unparsable text
  358. input: "<nowiki>&"
  359. output: [Text(text="<nowiki>&")]
  360. ---
  361. name: single_open_close
  362. label: a tag that supports being single; both an open and a close tag
  363. input: "foo<li>bar{{baz}}</li>"
  364. output: [Text(text="foo"), TagOpenOpen(), Text(text="li"), TagCloseOpen(padding=""), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose(), TagOpenClose(), Text(text="li"), TagCloseClose()]
  365. ---
  366. name: single_open
  367. label: a tag that supports being single; just an open tag
  368. input: "foo<li>bar{{baz}}"
  369. output: [Text(text="foo"), TagOpenOpen(), Text(text="li"), TagCloseSelfclose(padding="", implicit=True), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  370. ---
  371. name: single_selfclose
  372. label: a tag that supports being single; a self-closing tag
  373. input: "foo<li/>bar{{baz}}"
  374. output: [Text(text="foo"), TagOpenOpen(), Text(text="li"), TagCloseSelfclose(padding=""), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  375. ---
  376. name: single_close
  377. label: a tag that supports being single; just a close tag
  378. input: "foo</li>bar{{baz}}"
  379. output: [Text(text="foo</li>bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  380. ---
  381. name: single_only_open_close
  382. label: a tag that can only be single; both an open and a close tag
  383. input: "foo<br>bar{{baz}}</br>"
  384. output: [Text(text="foo"), TagOpenOpen(), Text(text="br"), TagCloseSelfclose(padding="", implicit=True), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose(), TagOpenOpen(invalid=True), Text(text="br"), TagCloseSelfclose(padding="", implicit=True)]
  385. ---
  386. name: single_only_open
  387. label: a tag that can only be single; just an open tag
  388. input: "foo<br>bar{{baz}}"
  389. output: [Text(text="foo"), TagOpenOpen(), Text(text="br"), TagCloseSelfclose(padding="", implicit=True), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  390. ---
  391. name: single_only_selfclose
  392. label: a tag that can only be single; a self-closing tag
  393. input: "foo<br/>bar{{baz}}"
  394. output: [Text(text="foo"), TagOpenOpen(), Text(text="br"), TagCloseSelfclose(padding=""), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  395. ---
  396. name: single_only_close
  397. label: a tag that can only be single; just a close tag
  398. input: "foo</br>bar{{baz}}"
  399. output: [Text(text="foo"), TagOpenOpen(invalid=True), Text(text="br"), TagCloseSelfclose(padding="", implicit=True), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  400. ---
  401. name: single_only_double
  402. label: a tag that can only be single; a tag with backslashes at the beginning and end
  403. input: "foo</br/>bar{{baz}}"
  404. output: [Text(text="foo"), TagOpenOpen(invalid=True), Text(text="br"), TagCloseSelfclose(padding=""), Text(text="bar"), TemplateOpen(), Text(text="baz"), TemplateClose()]
  405. ---
  406. name: single_only_close_attribute
  407. label: a tag that can only be single; presented as a close tag with an attribute
  408. input: "</br id="break">"
  409. output: [TagOpenOpen(invalid=True), Text(text="br"), TagAttrStart(pad_first=" ", pad_after_eq="", pad_before_eq=""), Text(text="id"), TagAttrEquals(), TagAttrQuote(), Text(text="break"), TagCloseSelfclose(padding="", implicit=True)]
  410. ---
  411. name: capitalization
  412. label: caps should be ignored within tag names
  413. input: "<NoWiKi>{{test}}</nOwIkI>"
  414. output: [TagOpenOpen(), Text(text="NoWiKi"), TagCloseOpen(padding=""), Text(text="{{test}}"), TagOpenClose(), Text(text="nOwIkI"), TagCloseClose()]