|
TRUST 1.9.8
HPC thermohydraulic platform
|
keyword_reference_to_pdf.py turns the output of `trustify generate_markdown` into a single hyperlinked PDF of the TRUST keyword reference manual.
The primary way to build this PDF is now the CLI:
trustify generate_pdf runs the whole pipeline (schema → markdown → doxygen → LaTeX → PDF) end-to-end, and --from-markdown DIR reuses an existing generate_markdown output. Its orchestration lives in src/trustify/pdf.py, with the Doxyfile embedded as a Python string.
This standalone keyword_reference_to_pdf.py (and its sibling Doxyfile.pdf) is a deliberate duplicate kept for the exotic case of a user who cannot install trustify but already has a markdown tree (e.g. obtained from elsewhere) and only Python stdlib + doxygen + TeX Live. It is stdlib-only and self-contained. It carries no automated tests and is maintained on demand; the tested copy is src/trustify/pdf.py. If you change one, mirror the other.
It runs doxygen (with a deliberately minimal Doxyfile — see Files in this directory below) on the trustify-emitted markdown tree, then drives make -C latex to produce refman.pdf via pdflatex. The script is standalone — it does not depend on $TRUST_ROOT/docs/Makefile or the shared doxyfile_common.
A successful run prints one line:
The resulting PDF (~290 pages for the current TRUST schema) has:
| Argument | Meaning |
|---|---|
| <input-dir> | Required. Directory written by trustify generate_markdown --out. Must contain keyword_reference.md and at least one kw_*.md. |
| --output PATH | PDF output path. Default: <input-dir>/keyword_reference.pdf. The parent directory must already exist — typos are surfaced rather than masked. |
| --keep-build | Keep the scratch build directory at <input-dir>/_pdf_build/ instead of using a one-shot tempfile.mkdtemp that is wiped on exit. Useful to inspect latex/refman.log after a failure, or to iterate faster (doxygen overwrites; re-running reuses the existing tree). |
| --doxygen PATH | Explicit doxygen binary. Resolution order otherwise: $TRUST_DOXYGEN_BINARY → doxygen on $PATH. The chosen binary is probed with --version; a non-doxygen file by that name is rejected. |
The tool fails fast (before invoking doxygen) when any of these is missing:
| File | Role |
|---|---|
| keyword_reference_to_pdf.py | CLI entry point. Stdlib-only Python orchestrator (~270 LOC). |
| Doxyfile.pdf | Minimal Doxyfile template. Path-free; the script exports KW_INPUT_DIR and KW_OUTPUT_DIR into doxygen's environment, and the Doxyfile expands $(KW_INPUT_DIR) / $(KW_OUTPUT_DIR) (same trick $TRUST_ROOT/docs/doxyfile_common uses with $(TRUST_ROOT)). |
The Doxyfile turns OFF every output format and feature that doesn't serve a markdown-only PDF (HTML, XML, graphs, source browser, alphabetical index, …), turns ON GENERATE_LATEX + USE_PDFLATEX + PDF_HYPERLINKS, and pulls in amsmath + amssymb via EXTRA_PACKAGES (the trustify-generated markdown uses \text, \overline, \langle / \rangle in math mode — without those packages pdflatex exits non-zero on every formula).