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

1234567891011121314
  1. import mwparserfromhell
  2. text = "foo {{spam|eggs}} bar"
  3. code = mwparserfromhell.parse(text)
  4. template = code.filter_templates()[0]
  5. template.name
  6. template.params
  7. template.params[0].value
  8. template.params[0].name
  9. template.params[0].showkey
  10. template.params[0].showkey = True
  11. template.params[0].name = "apples"
  12. code
  13. template.add("pears", "{{plums}}")
  14. code.filter_templates(recursive=True)