From e41c7da4eea403dbe79f7bb70c2d9e2ee9a1b4e2 Mon Sep 17 00:00:00 2001 From: CodeChenL <2540735020@qq.com> Date: Mon, 15 Apr 2024 10:17:26 +0000 Subject: [PATCH] fix: remove src/bin/mdbook-runcommand --- src/bin/mdbook-runcommand | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100755 src/bin/mdbook-runcommand 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))