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.
| @@ -74,6 +74,16 @@ | ||
| 74 | 74 | @rloc -f src/*.pas |
| 75 | 75 | @rloc -c src/*.pas |
| 76 | 76 | |
| 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 | + | |
| 77 | 87 | # raz and its library go together under $(PREFIX)/lib/raz; the link |
| 78 | 88 | # on PATH works since raz finds lib/ beside its real path. |
| 79 | 89 | PREFIX = $(HOME)/.local |
| @@ -87,4 +97,4 @@ | ||
| 87 | 97 | uninstall: |
| 88 | 98 | rm -rf $(PREFIX)/lib/raz $(PREFIX)/bin/raz |
| 89 | 99 | |
| 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 |
| @@ -65,6 +65,7 @@ | ||
| 65 | 65 | make fmt # the library, examples and tools are formatted |
| 66 | 66 | make loc # the compiler's lines |
| 67 | 67 | make tests # tests of the scanner, encoder and linker on their own |
| 68 | + make pdf # build/raz.pdf, the report, by pandoc and Chromium | |
| 68 | 69 | |
| 69 | 70 | ## Using it |
| 70 | 71 |
| @@ -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; } |