-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinject_usage.py
23 lines (20 loc) · 931 Bytes
/
inject_usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Javier Escalada Gómez
# All rights reserved.
# License: BSD 3-Clause Clear License (see LICENSE for details)
import sys
import subprocess
for line in sys.stdin:
if "{{PY2DOC_USAGE}}" in line:
output = subprocess.check_output([sys.executable, "py2doc.py", "-h"])
line = line.replace("{{PY2DOC_USAGE}}", output.rstrip().decode("utf-8"))
line = f"```\n{line}```\n"
elif "{{DOC2MD_USAGE}}" in line:
output = subprocess.check_output([sys.executable, "doc2md.py", "-h"])
line = line.replace("{{DOC2MD_USAGE}}", output.rstrip().decode("utf-8"))
line = f"```\n{line}```\n"
elif "{{MD2HTML_USAGE}}" in line:
output = subprocess.check_output([sys.executable, "md2html.py", "-h"])
line = line.replace("{{MD2HTML_USAGE}}", output.rstrip().decode("utf-8"))
line = f"```\n{line}```\n"
sys.stdout.write(line)