Готовая ПЗ (обновить первые 3 стр)

This commit is contained in:
2026-05-30 16:26:28 +03:00
parent 0c171fc406
commit 48d13342bf
11 changed files with 21952 additions and 1533527 deletions

View File

@@ -1,7 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
REPORT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
ROOT="$(cd "$REPORT_DIR/.." && pwd)"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BODY_PDF="$REPORT_DIR/.Пояснительная_записка_ПытковРЕ.body.pdf"
cd "$REPORT_DIR"
python3 scripts/gen_listings.py
python3 scripts/gen_test_tables.py
python3 scripts/check_images.py
typst compile --root .. ояснительная_записка_ПытковРЕ.typ"
typst compile --root "$ROOT" ояснительная_записка_ПытковРЕ.typ" "$BODY_PDF"
# shellcheck source=merge_front_matter.sh
source "$SCRIPT_DIR/merge_front_matter.sh"
merge_front_into_pz "$REPORT_DIR" "$BODY_PDF"
rm -f "$BODY_PDF"

View File

@@ -18,8 +18,14 @@ echo "== render_puml =="
echo "== check_images =="
python3 "$SCRIPT_DIR/check_images.py"
echo "== typst compile =="
echo "== typst compile (тело ПЗ) =="
BODY_PDF="$REPORT_DIR/.Пояснительная_записка_ПытковРЕ.body.pdf"
cd "$REPORT_DIR"
typst compile --root "$ROOT" ояснительная_записка_ПытковРЕ.typ"
typst compile --root "$ROOT" ояснительная_записка_ПытковРЕ.typ" "$BODY_PDF"
# shellcheck source=merge_front_matter.sh
source "$SCRIPT_DIR/merge_front_matter.sh"
merge_front_into_pz "$REPORT_DIR" "$BODY_PDF"
rm -f "$BODY_PDF"
echo "Done: $REPORT_DIRояснительная_записка_ПытковРЕ.pdf"

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Склеивает 3 страницы ВКР_первы_3_страницы_Пытков.pdf и тело ПЗ (оригинальные страницы, без полей Typst).
set -euo pipefail
merge_front_into_pz() {
local report_dir="$1"
local body_pdf="$2"
local front_pdf="$report_dir/front-matter-export/ВКР_первы_3_страницы_Пытков.pdf"
local out_pdf="$report_dirояснительная_записка_ПытковРЕ.pdf"
local front_pages=3
if [[ ! -f "$front_pdf" ]]; then
echo "error: нет PDF первых страниц: $front_pdf" >&2
return 1
fi
if [[ ! -f "$body_pdf" ]]; then
echo "error: нет тела ПЗ: $body_pdf" >&2
return 1
fi
if ! command -v qpdf >/dev/null; then
echo "error: нужен qpdf (https://qpdf.sourceforge.io/)" >&2
return 1
fi
if command -v pdfinfo >/dev/null; then
local n
n="$(pdfinfo "$front_pdf" 2>/dev/null | awk '/^Pages:/ {print $2}')"
if [[ -n "$n" && "$n" != "$front_pages" ]]; then
echo "warning: в $front_pdf страниц: $n (ожидалось $front_pages)" >&2
fi
fi
echo "== merge: $(basename "$front_pdf") + body → $(basename "$out_pdf") =="
# qpdf вместо pdfunite: poppler сыпет «recursive dicts» на каждую страницу Typst-PDF
qpdf --warning-exit-0 --empty \
--pages "$front_pdf" "1-$front_pages" "$body_pdf" 1-z \
-- "$out_pdf"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
REPORT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
BODY="${2:-$REPORT_DIR/.Пояснительная_записка_ПытковРЕ.body.pdf}"
merge_front_into_pz "$REPORT_DIR" "$BODY"
fi