Исправлено тире
This commit is contained in:
@@ -18,6 +18,9 @@ echo "== render_puml =="
|
||||
echo "== check_images =="
|
||||
python3 "$SCRIPT_DIR/check_images.py"
|
||||
|
||||
echo "== check_gost_dashes =="
|
||||
python3 "$SCRIPT_DIR/check_gost_dashes.py"
|
||||
|
||||
echo "== typst compile (тело ПЗ) =="
|
||||
BODY_PDF="$REPORT_DIR/.Пояснительная_записка_ПытковРЕ.body.pdf"
|
||||
cd "$REPORT_DIR"
|
||||
|
||||
38
Report/scripts/check_gost_dashes.py
Normal file
38
Report/scripts/check_gost_dashes.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Проверка: в .typ ПЗ нет длинного тире «—» (по чек-листу п. 29 — среднее «–»)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DIRS = [ROOT / "includes", ROOT / "appendices"]
|
||||
SKIP = {"ch05-tests-generated.typ"}
|
||||
EM = "\u2014"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
bad: list[str] = []
|
||||
for base in DIRS:
|
||||
if not base.is_dir():
|
||||
continue
|
||||
for path in sorted(base.rglob("*.typ")):
|
||||
if path.name in SKIP:
|
||||
continue
|
||||
text = path.read_text(encoding="utf-8")
|
||||
for i, line in enumerate(text.splitlines(), 1):
|
||||
if EM in line and "не длинное" not in line:
|
||||
bad.append(f"{path.relative_to(ROOT)}:{i}: {line.strip()[:100]}")
|
||||
if bad:
|
||||
print("error: найдено длинное тире «—» (нужно среднее «–»):", file=sys.stderr)
|
||||
for line in bad[:40]:
|
||||
print(f" {line}", file=sys.stderr)
|
||||
if len(bad) > 40:
|
||||
print(f" ... и ещё {len(bad) - 40}", file=sys.stderr)
|
||||
return 1
|
||||
print("OK: длинное тире в .typ не найдено")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user