feat: epub2md_merge kürzt ISO-Datum im Buch-Kopf (13.01.2025)
display_date(): '2025-01-13T08:00:00+00:00' → '13.01.2025' bei deutschen Büchern, sonst '2025-01-13'; andere Formate unverändert. metadata.yaml behält den Originalwert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
13617c8d3e
commit
65c90c67ca
1 changed files with 36 additions and 7 deletions
|
|
@ -71,3 +71,16 @@ def test_merge_invalid_directory(tmp_path):
|
|||
assert merge_main([str(tmp_path / "gibt-es-nicht")]) == 1
|
||||
(tmp_path / "leer").mkdir()
|
||||
assert merge_main([str(tmp_path / "leer")]) == 1
|
||||
|
||||
|
||||
def test_merge_shortens_iso_date(convert):
|
||||
from epub2md.merge import display_date
|
||||
assert display_date("2025-01-13T08:00:00+00:00", "de") == "13.01.2025"
|
||||
assert display_date("2025-01-13", "de-DE") == "13.01.2025"
|
||||
assert display_date("2025-01-13T08:00:00Z", "en") == "2025-01-13"
|
||||
assert display_date("2025", "de") == "2025" # year only / other formats stay
|
||||
assert display_date("Januar 2025", "de") == "Januar 2025"
|
||||
run = convert(book())
|
||||
assert merge_main([str(run.out)]) == 0
|
||||
text = (run.out / f"{run.report['input']['name'][:-5]}.md").read_text(encoding="utf-8")
|
||||
assert yaml.safe_load(text.split("---\n")[1])["date"] == "01.01.2024"
|
||||
|
|
|
|||
Loading…
Reference in a new issue