Browse Source

revert template

pull/222/head
Victor Bulatov 4 years ago
parent
commit
5b84216b2a
1 changed files with 3 additions and 14 deletions
  1. +3
    -14
      mwparserfromhell/nodes/template.py

+ 3
- 14
mwparserfromhell/nodes/template.py View File

@@ -33,18 +33,6 @@ __all__ = ["Template"]

FLAGS = re.DOTALL | re.UNICODE

TEMPLATES = {
"Esp": lambda x: f"* 10^{x.params[0]}",
"smallcaps": lambda x: f"{x.params[0]}",
"Unicode": lambda x: f"{x.params[0]}",
"IPA": lambda x: f"{x.params[0]}",
"transl": lambda x: f"{x.params[-1]}",
"IAST": lambda x: f"{x.params[0]}",
"ssub": lambda x: f"{x.params[0]}",
"SubatomicParticle": lambda x: f"{x.params[0]}",
"convert": lambda x: f"{x.params[0]} {x.params[1]}",
}

class Template(Node):
"""Represents a template in wikicode, like ``{{foo}}``."""

@@ -71,8 +59,9 @@ class Template(Node):
yield param.value

def __strip__(self, **kwargs):
if str(self.name) in TEMPLATES:
return TEMPLATES[str(self.name)](self)
if kwargs.get("keep_template_params"):
parts = [param.value.strip_code(**kwargs) for param in self.params]
return " ".join(part for part in parts if part)
return None

def __showtree__(self, write, get, mark):


Loading…
Cancel
Save