diff --git a/src/bin/mdbook-runcommand b/src/bin/mdbook-runcommand deleted file mode 100755 index 68753dc..0000000 --- a/src/bin/mdbook-runcommand +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -import json -import sys -import re -import subprocess - -def render(markdown): - try: - command = re.findall(r'\$\(.*\)', markdown['Chapter']['content']) - for string in command: - markdown['Chapter']['content'] = markdown['Chapter']['content'].replace(string, subprocess.run(str.split(command[0][2:-1]), capture_output=True, text=True).stdout) - except KeyError: - return 1 - -if __name__ == '__main__': - if len(sys.argv) > 1 and sys.argv[1] == "supports": - sys.exit(0) - - context, book = json.load(sys.stdin) - for markdown in book['sections']: - if render(markdown): - continue - for sub_items in markdown['Chapter']['sub_items']: - if render(sub_items): - continue - print(json.dumps(book))