A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

124 righe
2.8 KiB

  1. name: blank
  2. label: argument with no content
  3. input: "{{{}}}"
  4. output: [ArgumentOpen(), ArgumentClose()]
  5. ---
  6. name: blank_with_default
  7. label: argument with no content but a pipe
  8. input: "{{{|}}}"
  9. output: [ArgumentOpen(), ArgumentSeparator(), ArgumentClose()]
  10. ---
  11. name: basic
  12. label: simplest type of argument
  13. input: "{{{argument}}}"
  14. output: [ArgumentOpen(), Text(text="argument"), ArgumentClose()]
  15. ---
  16. name: default
  17. label: argument with a default value
  18. input: "{{{foo|bar}}}"
  19. output: [ArgumentOpen(), Text(text="foo"), ArgumentSeparator(), Text(text="bar"), ArgumentClose()]
  20. ---
  21. name: blank_with_multiple_defaults
  22. label: no content, multiple pipes
  23. input: "{{{|||}}}"
  24. output: [ArgumentOpen(), ArgumentSeparator(), Text(text="||"), ArgumentClose()]
  25. ---
  26. name: multiple_defaults
  27. label: multiple values separated by pipes
  28. input: "{{{foo|bar|baz}}}"
  29. output: [ArgumentOpen(), Text(text="foo"), ArgumentSeparator(), Text(text="bar|baz"), ArgumentClose()]
  30. ---
  31. name: newline
  32. label: newline as only content
  33. input: "{{{\n}}}"
  34. output: [ArgumentOpen(), Text(text="\n"), ArgumentClose()]
  35. ---
  36. name: right_braces
  37. label: multiple } scattered throughout text
  38. input: "{{{foo}b}a}r}}}"
  39. output: [ArgumentOpen(), Text(text="foo}b}a}r"), ArgumentClose()]
  40. ---
  41. name: right_braces_default
  42. label: multiple } scattered throughout text, with a default value
  43. input: "{{{foo}b}|}a}r}}}"
  44. output: [ArgumentOpen(), Text(text="foo}b}"), ArgumentSeparator(), Text(text="}a}r"), ArgumentClose()]
  45. ---
  46. name: invalid_braces
  47. label: invalid argument: multiple braces that are not part of a template or argument
  48. input: "{{{foo{{[a}}}}}"
  49. output: [Text(text="{{{foo{{[a}}}}}")]
  50. ---
  51. name: incomplete_open_only
  52. label: incomplete arguments: just an open
  53. input: "{{{"
  54. output: [Text(text="{{{")]
  55. ---
  56. name: incomplete_open_text
  57. label: incomplete arguments: an open with some text
  58. input: "{{{foo"
  59. output: [Text(text="{{{foo")]
  60. ---
  61. name: incomplete_open_text_pipe
  62. label: incomplete arguments: an open, text, then a pipe
  63. input: "{{{foo|"
  64. output: [Text(text="{{{foo|")]
  65. ---
  66. name: incomplete_open_pipe
  67. label: incomplete arguments: an open, then a pipe
  68. input: "{{{|"
  69. output: [Text(text="{{{|")]
  70. ---
  71. name: incomplete_open_pipe_text
  72. label: incomplete arguments: an open, then a pipe, then text
  73. input: "{{{|foo"
  74. output: [Text(text="{{{|foo")]
  75. ---
  76. name: incomplete_open_pipes_text
  77. label: incomplete arguments: a pipe, then text then two pipes
  78. input: "{{{|f||"
  79. output: [Text(text="{{{|f||")]
  80. ---
  81. name: incomplete_open_partial_close
  82. label: incomplete arguments: an open, then one right brace
  83. input: "{{{{}"
  84. output: [Text(text="{{{{}")]
  85. ---
  86. name: incomplete_preserve_previous
  87. label: incomplete arguments: a valid argument followed by an invalid one
  88. input: "{{{foo}}} {{{bar"
  89. output: [ArgumentOpen(), Text(text="foo"), ArgumentClose(), Text(text=" {{{bar")]