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 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. name: no_params
  2. label: simplest type of template
  3. input: "{{template}}"
  4. output: [TemplateOpen(), Text(text="template"), TemplateClose()]
  5. ---
  6. name: one_param_unnamed
  7. label: basic template with one unnamed parameter
  8. input: "{{foo|bar}}"
  9. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateClose()]
  10. ---
  11. name: one_param_named
  12. label: basic template with one named parameter
  13. input: "{{foo|bar=baz}}"
  14. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  15. ---
  16. name: multiple_unnamed_params
  17. label: basic template with multiple unnamed parameters
  18. input: "{{foo|bar|baz|biz|buzz}}"
  19. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamSeparator(), Text(text="baz"), TemplateParamSeparator(), Text(text="biz"), TemplateParamSeparator(), Text(text="buzz"), TemplateClose()]
  20. ---
  21. name: multiple_named_params
  22. label: basic template with multiple named parameters
  23. input: "{{foo|bar=baz|biz=buzz|buff=baff|usr=bin}}"
  24. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamEquals(), Text(text="baz"), TemplateParamSeparator(), Text(text="biz"), TemplateParamEquals(), Text(text="buzz"), TemplateParamSeparator(), Text(text="buff"), TemplateParamEquals(), Text(text="baff"), TemplateParamSeparator(), Text(text="usr"), TemplateParamEquals(), Text(text="bin"), TemplateClose()]
  25. ---
  26. name: multiple_mixed_params
  27. label: basic template with multiple unnamed/named parameters
  28. input: "{{foo|bar=baz|biz|buzz=buff|usr|bin}}"
  29. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamEquals(), Text(text="baz"), TemplateParamSeparator(), Text(text="biz"), TemplateParamSeparator(), Text(text="buzz"), TemplateParamEquals(), Text(text="buff"), TemplateParamSeparator(), Text(text="usr"), TemplateParamSeparator(), Text(text="bin"), TemplateClose()]
  30. ---
  31. name: multiple_mixed_params2
  32. label: basic template with multiple unnamed/named parameters in another order
  33. input: "{{foo|bar|baz|biz=buzz|buff=baff|usr=bin}}"
  34. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamSeparator(), Text(text="baz"), TemplateParamSeparator(), Text(text="biz"), TemplateParamEquals(), Text(text="buzz"), TemplateParamSeparator(), Text(text="buff"), TemplateParamEquals(), Text(text="baff"), TemplateParamSeparator(), Text(text="usr"), TemplateParamEquals(), Text(text="bin"), TemplateClose()]
  35. ---
  36. name: nested_unnamed_param
  37. label: nested template as an unnamed parameter
  38. input: "{{foo|{{bar}}}}"
  39. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateClose()]
  40. ---
  41. name: nested_named_param_value
  42. label: nested template as a parameter value with a named parameter
  43. input: "{{foo|bar={{baz}}}}"
  44. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar"), TemplateParamEquals(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateClose()]
  45. ---
  46. name: nested_named_param_name_and_value
  47. label: nested templates as a parameter name and value
  48. input: "{{foo|{{bar}}={{baz}}}}"
  49. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateClose()]
  50. ---
  51. name: nested_name_start
  52. label: nested template at the beginning of a template name
  53. input: "{{{{foo}}bar}}"
  54. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateClose()]
  55. ---
  56. name: nested_name_start_unnamed_param
  57. label: nested template at the beginning of a template name and as an unnamed parameter
  58. input: "{{{{foo}}bar|{{baz}}}}"
  59. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateClose()]
  60. ---
  61. name: nested_name_start_named_param_value
  62. label: nested template at the beginning of a template name and as a parameter value with a named parameter
  63. input: "{{{{foo}}bar|baz={{biz}}}}"
  64. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateParamSeparator(), Text(text="baz"), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  65. ---
  66. name: nested_name_start_named_param_name_and_value
  67. label: nested template at the beginning of a template name and as a parameter name and value
  68. input: "{{{{foo}}bar|{{baz}}={{biz}}}}"
  69. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  70. ---
  71. name: nested_name_end
  72. label: nested template at the end of a template name
  73. input: "{{foo{{bar}}}}"
  74. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateClose()]
  75. ---
  76. name: nested_name_end_unnamed_param
  77. label: nested template at the end of a template name and as an unnamed parameter
  78. input: "{{foo{{bar}}|{{baz}}}}"
  79. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateClose()]
  80. ---
  81. name: nested_name_end_named_param_value
  82. label: nested template at the end of a template name and as a parameter value with a named parameter
  83. input: "{{foo{{bar}}|baz={{biz}}}}"
  84. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), Text(text="baz"), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  85. ---
  86. name: nested_name_end_named_param_name_and_value
  87. label: nested template at the end of a template name and as a parameter name and value
  88. input: "{{foo{{bar}}|{{baz}}={{biz}}}}"
  89. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  90. ---
  91. name: nested_name_mid
  92. label: nested template in the middle of a template name
  93. input: "{{foo{{bar}}baz}}"
  94. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateClose()]
  95. ---
  96. name: nested_name_mid_unnamed_param
  97. label: nested template in the middle of a template name and as an unnamed parameter
  98. input: "{{foo{{bar}}baz|{{biz}}}}"
  99. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateParamSeparator(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  100. ---
  101. name: nested_name_mid_named_param_value
  102. label: nested template in the middle of a template name and as a parameter value with a named parameter
  103. input: "{{foo{{bar}}baz|biz={{buzz}}}}"
  104. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateParamSeparator(), Text(text="biz"), TemplateParamEquals(), TemplateOpen(), Text(text="buzz"), TemplateClose(), TemplateClose()]
  105. ---
  106. name: nested_name_mid_named_param_name_and_value
  107. label: nested template in the middle of a template name and as a parameter name and value
  108. input: "{{foo{{bar}}baz|{{biz}}={{buzz}}}}"
  109. output: [TemplateOpen(), Text(text="foo"), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateParamSeparator(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="buzz"), TemplateClose(), TemplateClose()]
  110. ---
  111. name: nested_name_start_end
  112. label: nested template at the beginning and end of a template name
  113. input: "{{{{foo}}{{bar}}}}"
  114. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateClose()]
  115. ---
  116. name: nested_name_start_end_unnamed_param
  117. label: nested template at the beginning and end of a template name and as an unnamed parameter
  118. input: "{{{{foo}}{{bar}}|{{baz}}}}"
  119. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateClose()]
  120. ---
  121. name: nested_name_start_end_named_param_value
  122. label: nested template at the beginning and end of a template name and as a parameter value with a named parameter
  123. input: "{{{{foo}}{{bar}}|baz={{biz}}}}"
  124. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), Text(text="baz"), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  125. ---
  126. name: nested_name_start_end_named_param_name_and_value
  127. label: nested template at the beginning and end of a template name and as a parameter name and value
  128. input: "{{{{foo}}{{bar}}|{{baz}}={{biz}}}}"
  129. output: [TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), TemplateOpen(), Text(text="bar"), TemplateClose(), TemplateParamSeparator(), TemplateOpen(), Text(text="baz"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="biz"), TemplateClose(), TemplateClose()]
  130. ---
  131. name: nested_names_multiple
  132. label: multiple nested templates within nested templates
  133. input: "{{{{{{{{foo}}bar}}baz}}biz}}"
  134. output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateClose(), Text(text="biz"), TemplateClose()]
  135. ---
  136. name: nested_names_multiple_unnamed_param
  137. label: multiple nested templates within nested templates with a nested unnamed parameter
  138. input: "{{{{{{{{foo}}bar}}baz}}biz|{{buzz}}}}"
  139. output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateClose(), Text(text="biz"), TemplateParamSeparator(), TemplateOpen(), Text(text="buzz"), TemplateClose(), TemplateClose()]
  140. ---
  141. name: nested_names_multiple_named_param_value
  142. label: multiple nested templates within nested templates with a nested parameter value in a named parameter
  143. input: "{{{{{{{{foo}}bar}}baz}}biz|buzz={{bin}}}}"
  144. output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateClose(), Text(text="biz"), TemplateParamSeparator(), Text(text="buzz"), TemplateParamEquals(), TemplateOpen(), Text(text="bin"), TemplateClose(), TemplateClose()]
  145. ---
  146. name: nested_names_multiple_named_param_name_and_value
  147. label: multiple nested templates within nested templates with a nested parameter name and value
  148. input: "{{{{{{{{foo}}bar}}baz}}biz|{{buzz}}={{bin}}}}"
  149. output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateClose(), Text(text="baz"), TemplateClose(), Text(text="biz"), TemplateParamSeparator(), TemplateOpen(), Text(text="buzz"), TemplateClose(), TemplateParamEquals(), TemplateOpen(), Text(text="bin"), TemplateClose(), TemplateClose()]
  150. ---
  151. name: mixed_nested_templates
  152. label: mixed assortment of nested templates within template names, parameter names, and values
  153. input: "{{{{{{{{foo}}bar|baz=biz}}buzz}}usr|{{bin}}}}"
  154. output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateParamSeparator(), Text(text="baz"), TemplateParamEquals(), Text(text="biz"), TemplateClose(), Text(text="buzz"), TemplateClose(), Text(text="usr"), TemplateParamSeparator(), TemplateOpen(), Text(text="bin"), TemplateClose(), TemplateClose()]
  155. ---
  156. name: newlines_start
  157. label: a newline at the start of a template name
  158. input: "{{\nfoobar}}"
  159. output: [TemplateOpen(), Text(text="\nfoobar"), TemplateClose()]
  160. ---
  161. name: newlines_end
  162. label: a newline at the end of a template name
  163. input: "{{foobar\n}}"
  164. output: [TemplateOpen(), Text(text="foobar\n"), TemplateClose()]
  165. ---
  166. name: newlines_start_end
  167. label: a newline at the start and end of a template name
  168. input: "{{\nfoobar\n}}"
  169. output: [TemplateOpen(), Text(text="\nfoobar\n"), TemplateClose()]
  170. ---
  171. name: newlines_mid
  172. label: a newline at the middle of a template name
  173. input: "{{foo\nbar}}"
  174. output: [Text(text="{{foo\nbar}}")]
  175. ---
  176. name: newlines_start_mid
  177. label: a newline at the start and middle of a template name
  178. input: "{{\nfoo\nbar}}"
  179. output: [Text(text="{{\nfoo\nbar}}")]
  180. ---
  181. name: newlines_mid_end
  182. label: a newline at the middle and end of a template name
  183. input: "{{foo\nbar\n}}"
  184. output: [Text(text="{{foo\nbar\n}}")]
  185. ---
  186. name: newlines_start_mid_end
  187. label: a newline at the start, middle, and end of a template name
  188. input: "{{\nfoo\nbar\n}}"
  189. output: [Text(text="{{\nfoo\nbar\n}}")]
  190. ---
  191. name: newlines_unnamed_param
  192. label: newlines within an unnamed template parameter
  193. input: "{{foo|\nb\nar\n}}"
  194. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  195. ---
  196. name: newlines_enclose_template_name_unnamed_param
  197. label: newlines enclosing a template name and within an unnamed template parameter
  198. input: "{{\nfoo\n|\nb\nar\n}}"
  199. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  200. ---
  201. name: newlines_within_template_name_unnamed_param
  202. label: newlines within a template name and within an unnamed template parameter
  203. input: "{{\nfo\no\n|\nb\nar\n}}"
  204. output: [Text(text="{{\nfo\no\n|\nb\nar\n}}")]
  205. ---
  206. name: newlines_enclose_template_name_named_param_value
  207. label: newlines enclosing a template name and within a named parameter value
  208. input: "{{\nfoo\n|1=\nb\nar\n}}"
  209. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="\nb\nar\n"), TemplateClose()]
  210. ---
  211. name: newlines_within_template_name_named_param_value
  212. label: newlines within a template name and within a named parameter value
  213. input: "{{\nf\noo\n|1=\nb\nar\n}}"
  214. output: [Text(text="{{\nf\noo\n|1=\nb\nar\n}}")]
  215. ---
  216. name: newlines_named_param_name
  217. label: newlines within a parameter name
  218. input: "{{foo|\nb\nar\n=baz}}"
  219. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  220. ---
  221. name: newlines_named_param_name_param_value
  222. label: newlines within a parameter name and within a parameter value
  223. input: "{{foo|\nb\nar\n=\nba\nz\n}}"
  224. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateParamEquals(), Text(text="\nba\nz\n"), TemplateClose()]
  225. ---
  226. name: newlines_enclose_template_name_named_param_name
  227. label: newlines enclosing a template name and within a parameter name
  228. input: "{{\nfoo\n|\nb\nar\n=baz}}"
  229. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  230. ---
  231. name: newlines_enclose_template_name_named_param_name_param_value
  232. label: newlines enclosing a template name and within a parameter name and within a parameter value
  233. input: "{{\nfoo\n|\nb\nar\n=\nba\nz\n}}"
  234. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateParamEquals(), Text(text="\nba\nz\n"), TemplateClose()]
  235. ---
  236. name: newlines_within_template_name_named_param_name
  237. label: newlines within a template name and within a parameter name
  238. input: "{{\nfo\no\n|\nb\nar\n=baz}}"
  239. output: [Text(text="{{\nfo\no\n|\nb\nar\n=baz}}")]
  240. ---
  241. name: newlines_within_template_name_named_param_name_param_value
  242. label: newlines within a template name and within a parameter name and within a parameter value
  243. input: "{{\nf\noo\n|\nb\nar\n=\nba\nz\n}}"
  244. output: [Text(text="{{\nf\noo\n|\nb\nar\n=\nba\nz\n}}")]
  245. ---
  246. name: newlines_wildcard
  247. label: a random, complex assortment of templates and newlines
  248. input: "{{\nfoo\n|\nb\nar\n=\nb\naz\n|\nb\nuz\n}}"
  249. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateParamEquals(), Text(text="\nb\naz\n"), TemplateParamSeparator(), Text(text="\nb\nuz\n"), TemplateClose()]
  250. ---
  251. name: newlines_wildcard_redux
  252. label: an even more random and complex assortment of templates and newlines
  253. input: "{{\nfoo\n|\n{{\nbar\n|\nb\naz\n=\nb\niz\n}}\n=\nb\nuzz\n}}"
  254. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\n"), TemplateOpen(), Text(text="\nbar\n"), TemplateParamSeparator(), Text(text="\nb\naz\n"), TemplateParamEquals(), Text(text="\nb\niz\n"), TemplateClose(), Text(text="\n"), TemplateParamEquals(), Text(text="\nb\nuzz\n"), TemplateClose()]
  255. ---
  256. name: newlines_wildcard_redux_invalid
  257. label: a variation of the newlines_wildcard_redux test that is invalid
  258. input: "{{\nfoo\n|\n{{\nb\nar\n|\nb\naz\n=\nb\niz\n}}\n=\nb\nuzz\n}}"
  259. output: [Text(text="{{\nfoo\n|\n{{\nb\nar\n|\nb\naz\n=\nb\niz\n}}\n=\nb\nuzz\n}}")]
  260. ---
  261. name: invalid_name_left_brace_middle
  262. label: invalid characters in template name: left brace in middle
  263. input: "{{foo{bar}}"
  264. output: [Text(text="{{foo{bar}}")]
  265. ---
  266. name: invalid_name_right_brace_middle
  267. label: invalid characters in template name: right brace in middle
  268. input: "{{foo}bar}}"
  269. output: [Text(text="{{foo}bar}}")]
  270. ---
  271. name: invalid_name_left_braces
  272. label: invalid characters in template name: two left braces in middle
  273. input: "{{foo{b{ar}}"
  274. output: [Text(text="{{foo{b{ar}}")]
  275. ---
  276. name: invalid_name_left_bracket_middle
  277. label: invalid characters in template name: left bracket in middle
  278. input: "{{foo[bar}}"
  279. output: [Text(text="{{foo[bar}}")]
  280. ---
  281. name: invalid_name_right_bracket_middle
  282. label: invalid characters in template name: right bracket in middle
  283. input: "{{foo]bar}}"
  284. output: [Text(text="{{foo]bar}}")]
  285. ---
  286. name: invalid_name_left_bracket_start
  287. label: invalid characters in template name: left bracket at start
  288. input: "{{[foobar}}"
  289. output: [Text(text="{{[foobar}}")]
  290. ---
  291. name: invalid_name_right_bracket_start
  292. label: invalid characters in template name: right bracket at end
  293. input: "{{foobar]}}"
  294. output: [Text(text="{{foobar]}}")]
  295. ---
  296. name: valid_name_left_brace_start
  297. label: valid characters in template name: left brace at start
  298. input: "{{{foobar}}"
  299. output: [Text(text="{"), TemplateOpen(), Text(text="foobar"), TemplateClose()]
  300. ---
  301. name: valid_unnamed_param_left_brace
  302. label: valid characters in unnamed template parameter: left brace
  303. input: "{{foo|ba{r}}"
  304. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r"), TemplateClose()]
  305. ---
  306. name: valid_unnamed_param_braces
  307. label: valid characters in unnamed template parameter: left and right braces
  308. input: "{{foo|ba{r}}}"
  309. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r"), TemplateClose(), Text(text="}")]
  310. ---
  311. name: valid_param_name_braces
  312. label: valid characters in template parameter name: left and right braces
  313. input: "{{foo|ba{r}=baz}}"
  314. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r}"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  315. ---
  316. name: valid_param_name_brackets
  317. label: valid characters in unnamed template parameter: left and right brackets
  318. input: "{{foo|ba[r]=baz}}"
  319. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba[r]"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  320. ---
  321. name: valid_param_name_double_left_brackets
  322. label: valid characters in unnamed template parameter: double left brackets
  323. input: "{{foo|bar[[in\nvalid=baz}}"
  324. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar[[in\nvalid"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  325. ---
  326. name: valid_param_name_double_right_brackets
  327. label: valid characters in unnamed template parameter: double right brackets
  328. input: "{{foo|bar]]=baz}}"
  329. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar]]"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  330. ---
  331. name: valid_param_name_double_brackets
  332. label: valid characters in unnamed template parameter: double left and right brackets
  333. input: "{{foo|bar[[in\nvalid]]=baz}}"
  334. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar[[in\nvalid]]"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  335. ---
  336. name: invalid_param_name_double_left_braces
  337. label: invalid characters in template parameter name: double left braces
  338. input: "{{foo|bar{{in\nvalid=baz}}"
  339. output: [Text(text="{{foo|bar{{in\nvalid=baz}}")]
  340. ---
  341. name: invalid_param_name_double_braces
  342. label: invalid characters in template parameter name: double left and right braces
  343. input: "{{foo|bar{{in\nvalid}}=baz}}"
  344. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar{{in\nvalid"), TemplateClose(), Text(text="=baz}}")]
  345. ---
  346. name: incomplete_stub
  347. label: incomplete templates that should fail gracefully: just an opening
  348. input: "{{"
  349. output: [Text(text="{{")]
  350. ---
  351. name: incomplete_plain
  352. label: incomplete templates that should fail gracefully: no close whatsoever
  353. input: "{{stuff}} {{foobar"
  354. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar")]
  355. ---
  356. name: incomplete_right_brace
  357. label: incomplete templates that should fail gracefully: only one right brace
  358. input: "{{stuff}} {{foobar}"
  359. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar}")]
  360. ---
  361. name: incomplete_pipe
  362. label: incomplete templates that should fail gracefully: a pipe
  363. input: "{{stuff}} {{foobar|"
  364. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar|")]
  365. ---
  366. name: incomplete_unnamed_param
  367. label: incomplete templates that should fail gracefully: an unnamed parameter
  368. input: "{{stuff}} {{foo|bar"
  369. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar")]
  370. ---
  371. name: incomplete_unnamed_param_pipe
  372. label: incomplete templates that should fail gracefully: an unnamed parameter, then a pipe
  373. input: "{{stuff}} {{foo|bar|"
  374. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|")]
  375. ---
  376. name: incomplete_valueless_param
  377. label: incomplete templates that should fail gracefully: an a named parameter with no value
  378. input: "{{stuff}} {{foo|bar="
  379. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=")]
  380. ---
  381. name: incomplete_valueless_param_pipe
  382. label: incomplete templates that should fail gracefully: a named parameter with no value, then a pipe
  383. input: "{{stuff}} {{foo|bar=|"
  384. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=|")]
  385. ---
  386. name: incomplete_named_param
  387. label: incomplete templates that should fail gracefully: a named parameter with a value
  388. input: "{{stuff}} {{foo|bar=baz"
  389. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz")]
  390. ---
  391. name: incomplete_named_param_pipe
  392. label: incomplete templates that should fail gracefully: a named parameter with a value, then a paipe
  393. input: "{{stuff}} {{foo|bar=baz|"
  394. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|")]
  395. ---
  396. name: incomplete_two_unnamed_params
  397. label: incomplete templates that should fail gracefully: two unnamed parameters
  398. input: "{{stuff}} {{foo|bar|baz"
  399. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz")]
  400. ---
  401. name: incomplete_unnamed_param_valueless_param
  402. label: incomplete templates that should fail gracefully: an unnamed parameter, then a named parameter with no value
  403. input: "{{stuff}} {{foo|bar|baz="
  404. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz=")]
  405. ---
  406. name: incomplete_unnamed_param_named_param
  407. label: incomplete templates that should fail gracefully: an unnamed parameter, then a named parameter with a value
  408. input: "{{stuff}} {{foo|bar|baz=biz"
  409. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz=biz")]
  410. ---
  411. name: incomplete_named_param_unnamed_param
  412. label: incomplete templates that should fail gracefully: a named parameter with a value, then an unnamed parameter
  413. input: "{{stuff}} {{foo|bar=baz|biz"
  414. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz")]
  415. ---
  416. name: incomplete_named_param_valueless_param
  417. label: incomplete templates that should fail gracefully: a named parameter with a value, then a named parameter with no value
  418. input: "{{stuff}} {{foo|bar=baz|biz="
  419. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz=")]
  420. ---
  421. name: incomplete_two_named_params
  422. label: incomplete templates that should fail gracefully: two named parameters with values
  423. input: "{{stuff}} {{foo|bar=baz|biz=buzz"
  424. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz=buzz")]
  425. ---
  426. name: incomplete_nested_template_as_unnamed_param
  427. label: incomplete templates that should fail gracefully: a valid nested template as an unnamed parameter
  428. input: "{{stuff}} {{foo|{{bar}}"
  429. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|"), TemplateOpen(), Text(text="bar"), TemplateClose()]
  430. ---
  431. name: incomplete_nested_template_as_param_value
  432. label: incomplete templates that should fail gracefully: a valid nested template as a parameter value
  433. input: "{{stuff}} {{foo|bar={{baz}}"
  434. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar="), TemplateOpen(), Text(text="baz"), TemplateClose()]
  435. ---
  436. name: recursion_five_hundred_opens
  437. label: test potentially dangerous recursion: five hundred template openings, without spaces
  438. input: "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{"
  439. output: [Text(text="{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{")]
  440. ---
  441. name: recursion_one_hundred_opens
  442. label: test potentially dangerous recursion: one hundred template openings, with spaces
  443. input: "{{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{"
  444. output: [Text(text="{{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{ {{")]
  445. ---
  446. name: recursion_opens_and_closes
  447. label: test potentially dangerous recursion: template openings and closings
  448. input: "{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}"
  449. output: [Text(text="{{|"), TemplateOpen(), TemplateClose(), Text(text="{{|"), TemplateOpen(), TemplateClose(), TemplateOpen(), TemplateParamSeparator(), TemplateOpen(), TemplateClose(), Text(text="{{"), TemplateParamSeparator(), Text(text="{{"), TemplateClose(), Text(text="{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}{{|{{}}")]