Pārlūkot izejas kodu

revert template

pull/222/head
Victor Bulatov pirms 5 gadiem
vecāks
revīzija
5b84216b2a
1 mainītis faili ar 3 papildinājumiem un 14 dzēšanām
  1. +3
    -14
      mwparserfromhell/nodes/template.py

+ 3
- 14
mwparserfromhell/nodes/template.py Parādīt failu

@@ -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):


Notiek ielāde…
Atcelt
Saglabāt