A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

922 行
38 KiB

  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: newline_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: newline_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: newline_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: newline_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: newline_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: newline_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: newline_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: newline_unnamed_param_start
  192. label: a newline at the start of an unnamed template parameter
  193. input: "{{foo|\nbar}}"
  194. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateClose()]
  195. ---
  196. name: newline_unnamed_param_end
  197. label: a newline at the end of an unnamed template parameter
  198. input: "{{foo|bar\n}}"
  199. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateClose()]
  200. ---
  201. name: newline_unnamed_param_start_end
  202. label: a newline at the start and end of an unnamed template parameter
  203. input: "{{foo|\nbar\n}}"
  204. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateClose()]
  205. ---
  206. name: newline_unnamed_param_start_mid
  207. label: a newline at the start and middle of an unnamed template parameter
  208. input: "{{foo|\nb\nar}}"
  209. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nb\nar"), TemplateClose()]
  210. ---
  211. name: newline_unnamed_param_mid_end
  212. label: a newline at the middle and end of an unnamed template parameter
  213. input: "{{foo|b\nar\n}}"
  214. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="b\nar\n"), TemplateClose()]
  215. ---
  216. name: newline_unnamed_param_start_mid_end
  217. label: a newline at the start, middle, and end of an unnamed template parameter
  218. input: "{{foo|\nb\nar\n}}"
  219. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  220. ---
  221. name: newline_start_unnamed_param_start
  222. label: a newline at the start of a template name and at the start of an unnamed template parameter
  223. input: "{{\nfoo|\nbar}}"
  224. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateClose()]
  225. ---
  226. name: newline_start_unnamed_param_end
  227. label: a newline at the start of a template name and at the end of an unnamed template parameter
  228. input: "{{\nfoo|bar\n}}"
  229. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateClose()]
  230. ---
  231. name: newline_start_unnamed_param_start_end
  232. label: a newline at the start of a template name and at the start and end of an unnamed template parameter
  233. input: "{{\nfoo|\nbar\n}}"
  234. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateClose()]
  235. ---
  236. name: newline_start_unnamed_param_start_mid
  237. label: a newline at the start of a template name and at the start and middle of an unnamed template parameter
  238. input: "{{\nfoo|\nb\nar}}"
  239. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="\nb\nar"), TemplateClose()]
  240. ---
  241. name: newline_start_unnamed_param_mid_end
  242. label: a newline at the start of a template name and at the middle and end of an unnamed template parameter
  243. input: "{{\nfoo|b\nar\n}}"
  244. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="b\nar\n"), TemplateClose()]
  245. ---
  246. name: newline_start_unnamed_param_start_mid_end
  247. label: a newline at the start of a template name and at the start, middle, and end of an unnamed template parameter
  248. input: "{{\nfoo|\nb\nar\n}}"
  249. output: [TemplateOpen(), Text(text="\nfoo"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  250. ---
  251. name: newline_end_unnamed_param_start
  252. label: a newline at the end of a template name and at the start of an unnamed template parameter
  253. input: "{{foo\n|\nbar}}"
  254. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="\nbar"), TemplateClose()]
  255. ---
  256. name: newline_end_unnamed_param_end
  257. label: a newline at the end of a template name and at the end of an unnamed template parameter
  258. input: "{{foo\n|bar\n}}"
  259. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="bar\n"), TemplateClose()]
  260. ---
  261. name: newline_end_unnamed_param_start_end
  262. label: a newline at the end of a template name and at the start and end of an unnamed template parameter
  263. input: "{{foo\n|\nbar\n}}"
  264. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateClose()]
  265. ---
  266. name: newline_end_unnamed_param_start_mid
  267. label: a newline at the end of a template name and at the start and middle of an unnamed template parameter
  268. input: "{{foo\n|\nb\nar}}"
  269. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="\nb\nar"), TemplateClose()]
  270. ---
  271. name: newline_end_unnamed_param_mid_end
  272. label: a newline at the end of a template name and at the middle and end of an unnamed template parameter
  273. input: "{{foo\n|b\nar\n}}"
  274. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="b\nar\n"), TemplateClose()]
  275. ---
  276. name: newline_end_unnamed_param_start_mid_end
  277. label: a newline at the end of a template name and at the start, middle, and end of an unnamed template parameter
  278. input: "{{foo\n|\nb\nar\n}}"
  279. output: [TemplateOpen(), Text(text="foo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  280. ---
  281. name: newline_start_end_unnamed_param_end
  282. label: a newline at the start and end of a template name and the start of an unnamed template parameter
  283. input: "{{\nfoo\n|\nbar}}"
  284. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nbar"), TemplateClose()]
  285. ---
  286. name: newline_start_end_unnamed_param_end
  287. label: a newline at the start and end of a template name and the end of an unnamed template parameter
  288. input: "{{\nfoo\n|bar\n}}"
  289. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="bar\n"), TemplateClose()]
  290. ---
  291. name: newline_start_end_unnamed_param_start_end
  292. label: a newline at the start and end of a template name and the start and end of an unnamed template parameter
  293. input: "{{\nfoo\n|\nbar\n}}"
  294. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateClose()]
  295. ---
  296. name: newline_start_end_unnamed_param_start_mid
  297. label: a newline at the start and end of a template name and the start and middle of an unnamed template parameter
  298. input: "{{\nfoo\n|\nb\nar}}"
  299. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar"), TemplateClose()]
  300. ---
  301. name: newline_start_end_unnamed_param_mid_end
  302. label: a newline at the start and end of a template name and the middle and end of an unnamed template parameter
  303. input: "{{\nfoo\n|b\nar\n}}"
  304. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="b\nar\n"), TemplateClose()]
  305. ---
  306. name: newline_start_end_unnamed_param_start_mid_end
  307. label: a newline at the start and end of a template name and the start, middle, and end of an unnamed template parameter
  308. input: "{{\nfoo\n|\nb\nar\n}}"
  309. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nb\nar\n"), TemplateClose()]
  310. ---
  311. name: newline_mid_unnamed_param_start
  312. label: a newline at the middle of a template name and at the start of an unnamed template parameter
  313. input: "{{f\noo|\nbar}}"
  314. output: [Text(text="{{f\noo|\nbar}}")]
  315. ---
  316. name: newline_start_mid_unnamed_param_start
  317. label: a newline at the start and middle of a template name and at the start of an unnamed template parameter
  318. input: "{{\nf\noo|\nbar}}"
  319. output: [Text(text="{{\nf\noo|\nbar}}")]
  320. ---
  321. name: newline_start_end_unnamed_param_start
  322. label: a newline at the middle and of a template name and at the start of an unnamed template parameter
  323. input: "{{f\noo\n|\nbar}}"
  324. output: [Text(text="{{f\noo\n|\nbar}}")]
  325. ---
  326. name: newline_start_mid_end_unnamed_param_start
  327. label: a newline at the start, middle, and end of a template name and at the start of an unnamed template parameter
  328. input: "{{\nf\noo\n|\nbar}}"
  329. output: [Text(text="{{\nf\noo\n|\nbar}}")]
  330. ---
  331. name: newline_named_param_value_start
  332. label: a newline at the start of a named parameter value
  333. input: "{{foo|1=\nbar}}"
  334. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="\nbar"), TemplateClose()]
  335. ---
  336. name: newline_named_param_value_end
  337. label: a newline at the end of a named parameter value
  338. input: "{{foo|1=bar\n}}"
  339. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="bar\n"), TemplateClose()]
  340. ---
  341. name: newline_named_param_value_start_end
  342. label: a newline at the start and end of a named parameter value
  343. input: "{{foo|1=\nbar\n}}"
  344. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="\nbar\n"), TemplateClose()]
  345. ---
  346. name: newline_named_param_value_start_mid
  347. label: a newline at the start and middle of a named parameter value
  348. input: "{{foo|1=\nb\nar}}"
  349. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="\nb\nar"), TemplateClose()]
  350. ---
  351. name: newline_named_param_value_mid_end
  352. label: a newline at the middle and end of a named parameter value
  353. input: "{{foo|1=b\nar\n}}"
  354. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="b\nar\n"), TemplateClose()]
  355. ---
  356. name: newline_named_param_value_start_mid_end
  357. label: a newline at the start, middle, and end of a named parameter value
  358. input: "{{foo|1=\nb\nar\n}}"
  359. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="1"), TemplateParamEquals(), Text(text="\nb\nar\n"), TemplateClose()]
  360. ---
  361. name: newline_named_param_name_start
  362. label: a newline at the start of a parameter name
  363. input: "{{foo|\nbar=baz}}"
  364. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  365. ---
  366. name: newline_named_param_name_end
  367. label: a newline at the end of a parameter name
  368. input: "{{foo|bar\n=baz}}"
  369. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  370. ---
  371. name: newline_named_param_name_start_end
  372. label: a newline at the start and end of a parameter name
  373. input: "{{foo|\nbar\n=baz}}"
  374. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  375. ---
  376. name: newline_named_param_name_mid
  377. label: a newline at the middle of a parameter name
  378. input: "{{foo|b\nar=baz}}"
  379. output: [Text(text="{{foo|b\nar=baz}}")]
  380. ---
  381. name: newline_named_param_name_start_mid
  382. label: a newline at the start and middle of a parameter name
  383. input: "{{foo|\nb\nar=baz}}"
  384. output: [Text(text="{{foo|\nb\nar=baz}}")]
  385. ---
  386. name: newline_named_param_name_mid_end
  387. label: a newline at the middle and end of a parameter name
  388. input: "{{foo|b\nar\n=baz}}"
  389. output: [Text(text="{{foo|b\nar\n=baz}}")]
  390. ---
  391. name: newline_named_param_name_start_mid_end
  392. label: a newline at the start, middle, and end of a parameter name
  393. input: "{{foo|\nb\nar\n=baz}}"
  394. output: [Text(text="{{foo|\nb\nar\n=baz}}")]
  395. ---
  396. name: newline_named_param_name_start_param_value_end
  397. label: a newline at the start of a parameter name and the end of a parameter value
  398. input: "{{foo|\nbar=baz\n}}"
  399. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateParamEquals(), Text(text="baz\n"), TemplateClose()]
  400. ---
  401. name: newline_named_param_name_end_param_value_end
  402. label: a newline at the end of a parameter name and the end of a parameter value
  403. input: "{{foo|bar\n=baz\n}}"
  404. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateParamEquals(), Text(text="baz\n"), TemplateClose()]
  405. ---
  406. name: newline_named_param_name_start_end_param_value_end
  407. label: a newline at the start and end of a parameter name and the end of a parameter value
  408. input: "{{foo|\nbar\n=baz\n}}"
  409. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="baz\n"), TemplateClose()]
  410. ---
  411. name: newline_named_param_name_start_mid_param_value_end
  412. label: a newline at the start and middle of a parameter name and the end of a parameter value
  413. input: "{{foo|\nb\nar=baz\n}}"
  414. output: [Text(text="{{foo|\nb\nar=baz\n}}")]
  415. ---
  416. name: newline_named_param_name_mid_end_param_value_end
  417. label: a newline at the middle and end of a parameter name and the end of a parameter value
  418. input: "{{foo|b\nar\n=baz\n}}"
  419. output: [Text(text="{{foo|b\nar\n=baz\n}}")]
  420. ---
  421. name: newline_named_param_name_start_mid_end_param_value_end
  422. label: a newline at the start, middle, and end of a parameter name and at the end of a parameter value
  423. input: "{{foo|\nb\nar\n=baz\n}}"
  424. output: [Text(text="{{foo|\nb\nar\n=baz\n}}")]
  425. ---
  426. name: newline_named_param_name_start_param_value_start
  427. label: a newline at the start of a parameter name and at the start of a parameter value
  428. input: "{{foo|\nbar=\nbaz}}"
  429. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateParamEquals(), Text(text="\nbaz"), TemplateClose()]
  430. ---
  431. name: newline_named_param_name_end_param_value_start
  432. label: a newline at the end of a parameter name and at the start of a parameter value
  433. input: "{{foo|bar\n=\nbaz}}"
  434. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateParamEquals(), Text(text="\nbaz"), TemplateClose()]
  435. ---
  436. name: newline_named_param_name_start_end_param_value_start
  437. label: a newline at the start and end of a parameter name and at the start of a parameter value
  438. input: "{{foo|\nbar\n=\nbaz}}"
  439. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="\nbaz"), TemplateClose()]
  440. ---
  441. name: newline_named_param_name_start_mid_param_value_start
  442. label: a newline at the start and middle of a parameter name and at the start of a parameter value
  443. input: "{{foo|\nb\nar=\nbaz}}"
  444. output: [Text(text="{{foo|\nb\nar=\nbaz}}")]
  445. ---
  446. name: newline_named_param_name_mid_end_param_value_start
  447. label: a newline at the middle and end of a parameter name and at the start of a parameter value
  448. input: "{{foo|b\nar\n=\nbaz}}"
  449. output: [Text(text="{{foo|b\nar\n=\nbaz}}")]
  450. ---
  451. name: newline_named_param_name_start_mid_end_param_value_start
  452. label: a newline at the start, middle, and end of a parameter name and at the start of a parameter value
  453. input: "{{foo|\nb\nar\n=\nbaz}}"
  454. output: [Text(text="{{foo|\nb\nar\n=\nbaz}}")]
  455. ---
  456. name: newline_named_param_name_start_param_value_start_end
  457. label: a newline at the start of a parameter name and at the start and end of a parameter value
  458. input: "{{foo|\nbar=\nbaz\n}}"
  459. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateParamEquals(), Text(text="\nbaz\n"), TemplateClose()]
  460. ---
  461. name: newline_named_param_name_end_param_value_start_end
  462. label: a newline at the end of a parameter name and at the start and end of a parameter value
  463. input: "{{foo|bar\n=\nbaz\n}}"
  464. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateParamEquals(), Text(text="\nbaz\n"), TemplateClose()]
  465. ---
  466. name: newline_named_param_name_start_end_param_value_start_end
  467. label: a newline at the start and end of a parameter name and at the start and end of a parameter value
  468. input: "{{foo|\nbar\n=\nbaz\n}}"
  469. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="\nbaz\n"), TemplateClose()]
  470. ---
  471. name: newline_named_param_name_start_mid_param_value_start_end
  472. label: a newline at the start and middle of a parameter name and at the start and end of a parameter value
  473. input: "{{foo|\nb\nar=\nbaz\n}}"
  474. output: [Text(text="{{foo|\nb\nar=\nbaz\n}}")]
  475. ---
  476. name: newline_named_param_name_mid_end_param_value_start_end
  477. label: a newline at the middle and end of a parameter name and at the start and end of a parameter value
  478. input: "{{foo|b\nar\n=\nbaz\n}}"
  479. output: [Text(text="{{foo|b\nar\n=\nbaz\n}}")]
  480. ---
  481. name: newline_named_param_name_start_mid_end_param_value_start_end
  482. label: a newline at the start, middle, and end of a parameter name and at the start and end of a parameter value
  483. input: "{{foo|\nb\nar\n=\nbaz\n}}"
  484. output: [Text(text="{{foo|\nb\nar\n=\nbaz\n}}")]
  485. ---
  486. name: newline_named_param_name_start_param_value_mid
  487. label: a newline at the start of a parameter name and at the middle of a parameter value
  488. input: "{{foo|\nbar=ba\nz}}"
  489. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar"), TemplateParamEquals(), Text(text="ba\nz"), TemplateClose()]
  490. ---
  491. name: newline_named_param_name_end_param_value_mid
  492. label: a newline at the end of a parameter name and at the middle of a parameter value
  493. input: "{{foo|bar\n=ba\nz}}"
  494. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="bar\n"), TemplateParamEquals(), Text(text="ba\nz"), TemplateClose()]
  495. ---
  496. name: newline_named_param_name_start_end_param_value_mid
  497. label: a newline at the start and end of a parameter name and at the middle of a parameter value
  498. input: "{{foo|\nbar\n=ba\nz}}"
  499. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="ba\nz"), TemplateClose()]
  500. ---
  501. name: newline_named_param_name_start_mid_param_value_mid
  502. label: a newline at the start and middle of a parameter name and at the middle of a parameter value
  503. input: "{{foo|\nb\nar=ba\nz}}"
  504. output: [Text(text="{{foo|\nb\nar=ba\nz}}")]
  505. ---
  506. name: newline_named_param_name_mid_end_param_value_mid
  507. label: a newline at the middle and end of a parameter name and at the middle of a parameter value
  508. input: "{{foo|b\nar\n=ba\nz}}"
  509. output: [Text(text="{{foo|b\nar\n=ba\nz}}")]
  510. ---
  511. name: newline_named_param_start_mid_end_param_value_mid
  512. label: a newline at the start, middle, and end of a parameter name and at the middle of a parameter value
  513. input: "{{foo|\nb\nar\n=ba\nz}}"
  514. output: [Text(text="{{foo|\nb\nar\n=ba\nz}}")]
  515. ---
  516. name: newline_wildcard
  517. label: a random, complex assortment of templates and newlines
  518. input: "{{\nfoo\n|\nbar\n=\nb\naz\n|\nb\nuz\n}}"
  519. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\nbar\n"), TemplateParamEquals(), Text(text="\nb\naz\n"), TemplateParamSeparator(), Text(text="\nb\nuz\n"), TemplateClose()]
  520. ---
  521. name: newline_wildcard_redux
  522. label: an even more random and complex assortment of templates and newlines
  523. input: "{{\nfoo\n|\n{{\nbar\n|\nbaz\n=\nb\niz\n}}\n=\nb\nuzz\n}}"
  524. output: [TemplateOpen(), Text(text="\nfoo\n"), TemplateParamSeparator(), Text(text="\n"), TemplateOpen(), Text(text="\nbar\n"), TemplateParamSeparator(), Text(text="\nbaz\n"), TemplateParamEquals(), Text(text="\nb\niz\n"), TemplateClose(), Text(text="\n"), TemplateParamEquals(), Text(text="\nb\nuzz\n"), TemplateClose()]
  525. ---
  526. name: invalid_name_left_brace_middle
  527. label: invalid characters in template name: left brace in middle
  528. input: "{{foo{bar}}"
  529. output: [Text(text="{{foo{bar}}")]
  530. ---
  531. name: invalid_name_right_brace_middle
  532. label: invalid characters in template name: right brace in middle
  533. input: "{{foo}bar}}"
  534. output: [Text(text="{{foo}bar}}")]
  535. ---
  536. name: invalid_name_left_braces
  537. label: invalid characters in template name: two left braces in middle
  538. input: "{{foo{b{ar}}"
  539. output: [Text(text="{{foo{b{ar}}")]
  540. ---
  541. name: invalid_name_left_bracket_middle
  542. label: invalid characters in template name: left bracket in middle
  543. input: "{{foo[bar}}"
  544. output: [Text(text="{{foo[bar}}")]
  545. ---
  546. name: invalid_name_right_bracket_middle
  547. label: invalid characters in template name: right bracket in middle
  548. input: "{{foo]bar}}"
  549. output: [Text(text="{{foo]bar}}")]
  550. ---
  551. name: invalid_name_left_bracket_start
  552. label: invalid characters in template name: left bracket at start
  553. input: "{{[foobar}}"
  554. output: [Text(text="{{[foobar}}")]
  555. ---
  556. name: invalid_name_right_bracket_start
  557. label: invalid characters in template name: right bracket at end
  558. input: "{{foobar]}}"
  559. output: [Text(text="{{foobar]}}")]
  560. ---
  561. name: valid_name_left_brace_start
  562. label: valid characters in template name: left brace at start
  563. input: "{{{foobar}}"
  564. output: [Text(text="{"), TemplateOpen(), Text(text="foobar"), TemplateClose()]
  565. ---
  566. name: valid_unnamed_param_left_brace
  567. label: valid characters in unnamed template parameter: left brace
  568. input: "{{foo|ba{r}}"
  569. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r"), TemplateClose()]
  570. ---
  571. name: valid_unnamed_param_braces
  572. label: valid characters in unnamed template parameter: left and right braces
  573. input: "{{foo|ba{r}}}"
  574. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r"), TemplateClose(), Text(text="}")]
  575. ---
  576. name: valid_param_name_braces
  577. label: valid characters in template parameter name: left and right braces
  578. input: "{{foo|ba{r}=baz}}"
  579. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba{r}"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]
  580. ---
  581. name: valid_param_name_brackets
  582. label: valid characters in unnamed template parameter: left and right brackets
  583. input: "{{foo|ba[r]}}"
  584. output: [TemplateOpen(), Text(text="foo"), TemplateParamSeparator(), Text(text="ba[r]"), TemplateClose()]
  585. ---
  586. name: incomplete_plain
  587. label: incomplete templates that should fail gracefully: no close whatsoever
  588. input: "{{stuff}} {{foobar"
  589. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar")]
  590. ---
  591. name: incomplete_right_brace
  592. label: incomplete templates that should fail gracefully: only one right brace
  593. input: "{{stuff}} {{foobar}"
  594. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar}")]
  595. ---
  596. name: incomplete_pipe
  597. label: incomplete templates that should fail gracefully: a pipe
  598. input: "{{stuff}} {{foobar|"
  599. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foobar|")]
  600. ---
  601. name: incomplete_unnamed_param
  602. label: incomplete templates that should fail gracefully: an unnamed parameter
  603. input: "{{stuff}} {{foo|bar"
  604. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar")]
  605. ---
  606. name: incomplete_unnamed_param_pipe
  607. label: incomplete templates that should fail gracefully: an unnamed parameter, then a pipe
  608. input: "{{stuff}} {{foo|bar|"
  609. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|")]
  610. ---
  611. name: incomplete_valueless_param
  612. label: incomplete templates that should fail gracefully: an a named parameter with no value
  613. input: "{{stuff}} {{foo|bar="
  614. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=")]
  615. ---
  616. name: incomplete_valueless_param_pipe
  617. label: incomplete templates that should fail gracefully: a named parameter with no value, then a pipe
  618. input: "{{stuff}} {{foo|bar=|"
  619. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=|")]
  620. ---
  621. name: incomplete_named_param
  622. label: incomplete templates that should fail gracefully: a named parameter with a value
  623. input: "{{stuff}} {{foo|bar=baz"
  624. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz")]
  625. ---
  626. name: incomplete_named_param_pipe
  627. label: incomplete templates that should fail gracefully: a named parameter with a value, then a paipe
  628. input: "{{stuff}} {{foo|bar=baz|"
  629. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|")]
  630. ---
  631. name: incomplete_two_unnamed_params
  632. label: incomplete templates that should fail gracefully: two unnamed parameters
  633. input: "{{stuff}} {{foo|bar|baz"
  634. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz")]
  635. ---
  636. name: incomplete_unnamed_param_valueless_param
  637. label: incomplete templates that should fail gracefully: an unnamed parameter, then a named parameter with no value
  638. input: "{{stuff}} {{foo|bar|baz="
  639. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz=")]
  640. ---
  641. name: incomplete_unnamed_param_named_param
  642. label: incomplete templates that should fail gracefully: an unnamed parameter, then a named parameter with a value
  643. input: "{{stuff}} {{foo|bar|baz=biz"
  644. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar|baz=biz")]
  645. ---
  646. name: incomplete_named_param_unnamed_param
  647. label: incomplete templates that should fail gracefully: a named parameter with a value, then an unnamed parameter
  648. input: "{{stuff}} {{foo|bar=baz|biz"
  649. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz")]
  650. ---
  651. name: incomplete_named_param_valueless_param
  652. label: incomplete templates that should fail gracefully: a named parameter with a value, then a named parameter with no value
  653. input: "{{stuff}} {{foo|bar=baz|biz="
  654. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz=")]
  655. ---
  656. name: incomplete_two_named_params
  657. label: incomplete templates that should fail gracefully: two named parameters with values
  658. input: "{{stuff}} {{foo|bar=baz|biz=buzz"
  659. output: [TemplateOpen(), Text(text="stuff"), TemplateClose(), Text(text=" {{foo|bar=baz|biz=buzz")]