chore: alte Pandoc-Hilfsskripte entfernen
convert_epub2md.sh und split-md-chapters.py sind durch epub2md.py ersetzt. Überflüssige .gitignore-Einträge (buch.*, medien/) entfernt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cc36372329
commit
557bbd3b36
3 changed files with 1 additions and 61 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -18,12 +18,8 @@ dist/
|
|||
.qa-fixtures/
|
||||
.qa-reports/
|
||||
|
||||
# Urheberrechtlich geschützte Beispiel-Bücher und Konvertierungsausgaben
|
||||
# Urheberrechtlich geschützte Beispiel-Bücher
|
||||
Beispiele/
|
||||
buch.epub
|
||||
buch.md
|
||||
buch-md/
|
||||
medien/
|
||||
|
||||
# Editor/OS
|
||||
.idea/
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
pandoc buch.epub \
|
||||
--from=epub \
|
||||
--to=markdown+fenced_code_blocks+backtick_code_blocks+tex_math_dollars+footnotes+pipe_tables \
|
||||
--wrap=none \
|
||||
--extract-media=medien \
|
||||
--output=buch.md
|
||||
|
||||
./split-md-chapters.py buch.md buch-md
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
raise SystemExit(f"Aufruf: {sys.argv[0]} EINGABE.md AUSGABE_ORDNER")
|
||||
|
||||
src = Path(sys.argv[1])
|
||||
outdir = Path(sys.argv[2])
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
text = src.read_text(encoding="utf-8")
|
||||
parts = re.split(r"(?m)^(?=#\s+)", text)
|
||||
|
||||
def slugify(title: str) -> str:
|
||||
title = title.lower()
|
||||
title = re.sub(r"[^\w\s-]", "", title, flags=re.UNICODE)
|
||||
title = re.sub(r"[\s_-]+", "-", title).strip("-")
|
||||
return title[:80] or "kapitel"
|
||||
|
||||
index = []
|
||||
chapter_no = 0
|
||||
|
||||
for part in parts:
|
||||
if not part.strip():
|
||||
continue
|
||||
|
||||
m = re.match(r"^#\s+(.+?)\s*$", part, re.M)
|
||||
if m:
|
||||
chapter_no += 1
|
||||
title = m.group(1).strip()
|
||||
filename = f"{chapter_no:03d}-{slugify(title)}.md"
|
||||
else:
|
||||
filename = "000-vorspann.md"
|
||||
title = "Vorspann"
|
||||
|
||||
(outdir / filename).write_text(part.rstrip() + "\n", encoding="utf-8")
|
||||
index.append(f"- [{title}]({filename})")
|
||||
|
||||
(outdir / "README.md").write_text(
|
||||
"# Inhaltsverzeichnis\n\n" + "\n".join(index) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
Loading…
Reference in a new issue