From d4d2852bffefacee5aae5dea5711834f6bce3477 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Sun, 11 Oct 2026 21:54:46 +0100 Subject: [PATCH] make pdf: the report as build/raz.pdf pandoc makes HTML of doc/raz.md with doc/report.css, Chromium prints it: A4, title and contents on page 1, code never split across pages. Not part of check, as CI has neither tool. --- diff --git a/Makefile b/Makefile index 6ad027b..9e238bb 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,16 @@ @rloc -f src/*.pas @rloc -c src/*.pas +# the report as a PDF, by pandoc and Chromium; not part of check, as +# CI has neither +pdf: build/raz.pdf + +build/raz.pdf: doc/raz.md doc/report.css | build + pandoc doc/raz.md -s --toc --toc-depth=1 --shift-heading-level-by=-1 \ + --syntax-highlighting=none -c ../doc/report.css \ + -o build/raz.html + chromium --headless --no-pdf-header-footer --print-to-pdf=$@ build/raz.html 2>/dev/null + # raz and its library go together under $(PREFIX)/lib/raz; the link # on PATH works since raz finds lib/ beside its real path. PREFIX = $(HOME)/.local @@ -87,4 +97,4 @@ uninstall: rm -rf $(PREFIX)/lib/raz $(PREFIX)/bin/raz -.PHONY: units tests check gdb bench stress fmt loc clean install uninstall +.PHONY: units tests check gdb bench stress fmt loc pdf clean install uninstall diff --git a/README.md b/README.md index d277181..4b47411 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ make fmt # the library, examples and tools are formatted make loc # the compiler's lines make tests # tests of the scanner, encoder and linker on their own + make pdf # build/raz.pdf, the report, by pandoc and Chromium ## Using it diff --git a/doc/report.css b/doc/report.css new file mode 100644 index 0000000..129d0af --- /dev/null +++ b/doc/report.css @@ -0,0 +1,16 @@ +/* How `make pdf` prints the report: pandoc makes HTML of doc/raz.md + with this sheet, and Chromium prints it to build/raz.pdf. */ +@page { size: A4; margin: 22mm 20mm; @bottom-center { content: counter(page); } } +body { font: 10.5pt/1.45 Charter, "Bitstream Charter", Georgia, serif; color: #111; max-width: none; } +/* pandoc makes the report's # its title and moves the rest up one */ +h1.title { font-size: 24pt; margin: 30mm 0 12mm; } +h1 { font-size: 14pt; margin-top: 1.6em; break-after: avoid; } +h2 { font-size: 11.5pt; break-after: avoid; } +pre, code { font-family: "DejaVu Sans Mono", monospace; font-size: 8.8pt; } +/* a block of code or grammar is never split across pages */ +pre { background: #f6f6f3; padding: 6px 9px; border-left: 2px solid #bbb; break-inside: avoid; white-space: pre-wrap; } +table { border-collapse: collapse; font-size: 9.5pt; } +td, th { border-bottom: 1px solid #ddd; padding: 2px 8px; text-align: left; } +nav#TOC { break-after: page; } +nav#TOC ul { list-style: none; padding-left: 1em; } +a { color: inherit; text-decoration: none; }