summaryrefslogtreecommitdiff
path: root/process.py
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-03 15:46:02 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-03 15:46:02 +0200
commit0a37d862039e208368865786831532f6ea79cbb4 (patch)
tree0f480b8d2da19f320d066148658ef3d474eab875 /process.py
parent23871d5aadcaa4d01b7c46cb951854572940414d (diff)
downloadmetamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar
metamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar.bz2
metamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar.zst
services list
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)