From 940af50d96e9a7916674d237dec53738ab776103 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Thu, 2 Jan 2025 23:16:38 +0300 Subject: Auto-commit 2025-01-02 --- create_adoc.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 create_adoc.py (limited to 'create_adoc.py') 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 -- cgit v1.2.3