summaryrefslogtreecommitdiff
path: root/process.py
diff options
context:
space:
mode:
Diffstat (limited to 'process.py')
-rw-r--r--process.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/process.py b/process.py
index 1c84810..6cef2a8 100644
--- a/process.py
+++ b/process.py
@@ -5,15 +5,17 @@ from markdown import markdown
import subprocess
PROCESSORS = {
+ "lit": lambda c: c,
"ex": lambda c: popen(c).read(),
"exmd": lambda c: markdown(popen(c).read())
}
def run_pi(input: str) -> str:
- RE_PI = r"(?sm)\<\?(?P<name>\w+)\W(?P<body>.*)\?\>"
+ RE_PI = r"(?sm)\<\?(?P<n>\w+)\W(?P<b>.*?)\?\>"
def run_pi_match(m: re.Match):
- name = m.group("name")
- body = m.group("body")
+ name = m.group("n")
+ body = m.group("b")
+ print(f"({name})$ {body}")
output = PROCESSORS[name](body)
return output
return re.sub(RE_PI, run_pi_match, input)