aboutsummaryrefslogtreecommitdiff
path: root/create_adoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'create_adoc.py')
-rwxr-xr-xcreate_adoc.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/create_adoc.py b/create_adoc.py
new file mode 100755
index 0000000..e25da7a
--- /dev/null
+++ b/create_adoc.py
@@ -0,0 +1,19 @@
+import os
+from pathlib import Path
+import subprocess
+
+source_dir = Path("./content")
+target_dir = Path("./public/text")
+
+for md_path in source_dir.rglob("*.md"):
+ relative_path = md_path.relative_to(source_dir)
+ target_path = str(target_dir / relative_path.with_suffix(".txt")).replace("/index", "")
+ print(target_path)
+ # Создать все необходимые каталоги
+ Path(target_path).parent.mkdir(parents=True, exist_ok=True)
+
+ # Преобразовать файл из Markdown в AsciiDoc
+ subprocess.run(
+ ["pandoc", "-f", "markdown", "-t", "ansi", str(md_path), "-o", target_path],
+ check=True,
+ ) \ No newline at end of file