blob: dba4f459528d236645214cc084e833b7d9adfc2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env python3
import re
import sys
import subprocess
print(
re.sub(
r"^(```+)\$ (.*)\n((?:.+\n)*)\1$",
lambda m: subprocess.check_output(
m.group(2), input=m.group(3), shell=True, encoding="utf-8"
),
sys.stdin.read(),
flags=re.MULTILINE,
)
)
|