raz / commit d4d2852b

commit
d4d2852bffefacee5aae5dea5711834f6bce3477
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
76f10fb8
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.

patch · log

3 files changed, +28 -1

Makefile (history) modified +11 -1

@@ -74,6 +74,16 @@
7474 @rloc -f src/*.pas
7575 @rloc -c src/*.pas
7676
77+# the report as a PDF, by pandoc and Chromium; not part of check, as
78+# CI has neither
79+pdf: build/raz.pdf
80+
81+build/raz.pdf: doc/raz.md doc/report.css | build
82+ pandoc doc/raz.md -s --toc --toc-depth=1 --shift-heading-level-by=-1 \
83+ --syntax-highlighting=none -c ../doc/report.css \
84+ -o build/raz.html
85+ chromium --headless --no-pdf-header-footer --print-to-pdf=$@ build/raz.html 2>/dev/null
86+
7787 # raz and its library go together under $(PREFIX)/lib/raz; the link
7888 # on PATH works since raz finds lib/ beside its real path.
7989 PREFIX = $(HOME)/.local
@@ -87,4 +97,4 @@
8797 uninstall:
8898 rm -rf $(PREFIX)/lib/raz $(PREFIX)/bin/raz
8999
90-.PHONY: units tests check gdb bench stress fmt loc clean install uninstall
100+.PHONY: units tests check gdb bench stress fmt loc pdf clean install uninstall

README.md (history) modified +1 -0

@@ -65,6 +65,7 @@
6565 make fmt # the library, examples and tools are formatted
6666 make loc # the compiler's lines
6767 make tests # tests of the scanner, encoder and linker on their own
68+ make pdf # build/raz.pdf, the report, by pandoc and Chromium
6869
6970 ## Using it
7071

doc/report.css (history) added +16 -0

@@ -0,0 +1,16 @@
1+/* How `make pdf` prints the report: pandoc makes HTML of doc/raz.md
2+ with this sheet, and Chromium prints it to build/raz.pdf. */
3+@page { size: A4; margin: 22mm 20mm; @bottom-center { content: counter(page); } }
4+body { font: 10.5pt/1.45 Charter, "Bitstream Charter", Georgia, serif; color: #111; max-width: none; }
5+/* pandoc makes the report's # its title and moves the rest up one */
6+h1.title { font-size: 24pt; margin: 30mm 0 12mm; }
7+h1 { font-size: 14pt; margin-top: 1.6em; break-after: avoid; }
8+h2 { font-size: 11.5pt; break-after: avoid; }
9+pre, code { font-family: "DejaVu Sans Mono", monospace; font-size: 8.8pt; }
10+/* a block of code or grammar is never split across pages */
11+pre { background: #f6f6f3; padding: 6px 9px; border-left: 2px solid #bbb; break-inside: avoid; white-space: pre-wrap; }
12+table { border-collapse: collapse; font-size: 9.5pt; }
13+td, th { border-bottom: 1px solid #ddd; padding: 2px 8px; text-align: left; }
14+nav#TOC { break-after: page; }
15+nav#TOC ul { list-style: none; padding-left: 1em; }
16+a { color: inherit; text-decoration: none; }