diff options
author | metamuffin <metamuffin@disroot.org> | 2025-10-03 15:46:02 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-10-03 15:46:02 +0200 |
commit | 0a37d862039e208368865786831532f6ea79cbb4 (patch) | |
tree | 0f480b8d2da19f320d066148658ef3d474eab875 /process.py | |
parent | 23871d5aadcaa4d01b7c46cb951854572940414d (diff) | |
download | metamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar metamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar.bz2 metamuffin-website-0a37d862039e208368865786831532f6ea79cbb4.tar.zst |
services list
Diffstat (limited to 'process.py')
-rw-r--r-- | process.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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) |