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

33 lines
1.0 KiB

  1. name: empty_table
  2. label: Parsing an empty table.
  3. input: "{|\n|}"
  4. output: [TagOpenOpen(wiki_markup="{|"), Text(text="table"), TagCloseOpen(), Text(text="\n"), TagOpenClose(), Text(text="table"), TagCloseClose()]
  5. ---
  6. name: inline_table
  7. label: Correctly handle tables with close on the same line.
  8. input: "{||}"
  9. output: [TagOpenOpen(wiki_markup="{|"), Text(text="table"), TagCloseOpen(), TagOpenClose(), Text(text="table"), TagCloseClose()]
  10. ---
  11. name: no_table_close_simple
  12. label: Handle case when there is no table close.
  13. input: "{| "
  14. output: [Text(text="{| ")]
  15. ---
  16. name: leading_whitespace_table
  17. label: Handle leading whitespace for a table.
  18. input: "foo \n \t {|\n|}"
  19. output: [Text(text="foo \n \t "), TagOpenOpen(wiki_markup="{|"), Text(text="table"), TagCloseOpen(), Text(text="\n"), TagOpenClose(), Text(text="table"), TagCloseClose()]
  20. ---
  21. name: leading_characters_table
  22. label: Don't parse as a table when leading characters are not newline or whitespace.
  23. input: "foo \n foo \t {|\n|}"
  24. output: [Text(text="foo \n foo \t {|\n|}")]