Skip to content

Commit 95fea78

Browse files
authored
Fix #15276 (manual: improve the build) (#9079)
1 parent 35e76b5 commit 95fea78

17 files changed

Lines changed: 586 additions & 1613 deletions

‎.github/workflows/buildman.yml‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ jobs:
2626
- run: |
2727
mkdir output
2828
29-
- uses: docker://pandoc/latex:3.6.3
30-
with:
31-
args: --output=output/manual.html man/manual.md
32-
33-
- uses: docker://pandoc/latex:3.6.3
34-
with:
35-
args: --output=output/manual.pdf man/manual.md
36-
37-
- uses: docker://pandoc/latex:3.6.3
38-
with:
39-
args: --output=output/manual-premium.pdf man/manual-premium.md
29+
# buildman.sh runs in the pandoc container. The LaTeX packages used by manual-style.tex
30+
# and the DejaVu fonts are not included in the image.
31+
- name: Build manuals
32+
run: |
33+
docker run --rm -v "$GITHUB_WORKSPACE:/data" -w /data/man --entrypoint sh pandoc/latex:3.6.3 -c '
34+
set -e
35+
tlmgr --repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2024/tlnet-final install titlesec newverbs
36+
apk add --no-cache font-dejavu
37+
./buildman.sh
38+
chown -R '"$(id -u):$(id -g)"' .'
39+
cp man/*.pdf man/*.html man/manual.css output/
4040
4141
- uses: actions/upload-artifact@v7
4242
with:

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ stage
8383

8484
# Manual folder
8585
/man/manual.log
86+
/man/appendix-*.md
8687
/man/manual.tex
8788
/man/*.pdf
8889
/man/*.html

‎man/build-html.sh‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
#!/bin/sh
2-
echo Building $1.html
3-
pandoc $1.md -o $1.html -s --number-sections --toc --css manual.css
2+
# Usage:
3+
# ./build-html.sh NAME # NAME.md -> NAME.html
4+
# ./build-html.sh NAME INPUT... [pandoc options]
5+
# # INPUT... -> NAME.html
6+
name=$1
7+
shift
8+
if [ $# -eq 0 ]; then
9+
set -- "$name.md"
10+
fi
11+
echo Building $name.html
12+
pandoc "$@" -o $name.html -s --number-sections --toc --css manual.css \
13+
--lua-filter=filters/include-files.lua \
14+
--lua-filter=filters/manual.lua

‎man/build-pdf.sh‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/bin/sh
2+
# Usage:
3+
# ./build-pdf.sh NAME # NAME.md -> NAME.pdf
4+
# ./build-pdf.sh NAME INPUT... [pandoc options]
5+
# # INPUT... -> NAME.pdf
6+
#
27
# This uses installed fonts, which vary between systems
38
# Segoe UI and Consolas are standard in Windows 10, DejaVu is more common on Linux
4-
echo Building $1.pdf
9+
name=$1
10+
shift
11+
if [ $# -eq 0 ]; then
12+
set -- "$name.md"
13+
fi
14+
echo Building $name.pdf
515

616
MainFont="Segoe UI"
717
MonoFont="Consolas"
@@ -20,7 +30,7 @@ fi
2030

2131
# echo Using $MainFont / $MonoFont
2232

23-
pandoc $1.md -o $1.pdf -s --number-sections --toc \
33+
pandoc "$@" -o $name.pdf -s --number-sections --toc \
2434
--pdf-engine=xelatex \
2535
--listings \
2636
-f markdown \
@@ -29,4 +39,6 @@ pandoc $1.md -o $1.pdf -s --number-sections --toc \
2939
-V geometry:a4paper \
3040
-V geometry:margin=2.4cm \
3141
-V subparagraph \
32-
-H manual-style.tex
42+
-H manual-style.tex \
43+
--lua-filter=filters/include-files.lua \
44+
--lua-filter=filters/manual.lua

‎man/buildman.sh‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
# sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-latex-extra
44
# For Windows you can use the MiKTeX installer https://miktex.org/download
55

6-
./build-pdf.sh manual
7-
./build-html.sh manual
6+
set -e
7+
8+
# The documentation of all checkers is added as an appendix
9+
./make-appendix.sh "Checkers" checkers/*.md > appendix-checkers.md
10+
11+
# manual.md contains the content for both the open source and the premium
12+
# manual, the metadata file selects which one is built.
13+
./build-pdf.sh manual manual.md appendix-checkers.md --metadata-file=manual-opensource.yaml
14+
./build-html.sh manual manual.md appendix-checkers.md --metadata-file=manual-opensource.yaml
15+
16+
./build-pdf.sh manual-premium manual.md appendix-checkers.md --metadata-file=manual-premium.yaml
17+
./build-html.sh manual-premium manual.md appendix-checkers.md --metadata-file=manual-premium.yaml
818

919
./build-pdf.sh reference-cfg-format
1020
./build-html.sh reference-cfg-format

‎man/checkers/checkLibraryUseIgnore.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# checkLibraryUseIgnore
22

3-
**Message**: --check-library: Function f() should have <use>/<leak-ignore> configuration<br/>
3+
**Message**: `--check-library: Function f() should have <use>/<leak-ignore> configuration`<br/>
44
**Category**: Configuration<br/>
55
**Severity**: Information<br/>
66
**Language**: C/C++

‎man/checkers/leakUnsafeArgAlloc.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# leakUnsafeArgAlloc
22

3-
**Message**: Unsafe allocation. If shared_ptr() throws, memory could be leaked. Use make_shared<T>() instead.<br/>
3+
**Message**: `Unsafe allocation. If shared_ptr() throws, memory could be leaked. Use make_shared<T>() instead.`<br/>
44
**Category**: Correctness<br/>
55
**Severity**: Warning (inconclusive)<br/>
66
**Language**: C++

‎man/checkers/premium-misra-config.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
::: {.content-visible when-profile="premium"}
2+
13
# premium-misra-config
24

35
**Message**: Unknown constant x, please review cppcheck options<br/>
@@ -48,3 +50,4 @@ If the code depends on preprocessor macros that are not defined:
4850
cppcheck -DMISSING_MACRO=value file.c
4951
```
5052

53+
:::

‎man/checkers/unknownMacro.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ cppcheck should just ignore the keyword then an `-DKEYWORD=` option is suggested
3636

3737
Warning:
3838

39+
```
3940
canu-2.2/src/seqrequester/src/seqrequester/generate.H:72:41: error: There is an unknown macro here somewhere. Configuration is required. If F_U64 is a macro then please configure it. [unknownMacro]
41+
```
4042

4143
Fix:
4244

@@ -53,7 +55,9 @@ void AES_128::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks)
5355

5456
Warning:
5557

58+
```
5659
botan-2.19.5+dfsg/src/lib/block/aes/aes_power8/aes_power8.cpp:103:1: error: There is an unknown macro here somewhere. Configuration is required. If BOTAN_FUNC_ISA is a macro then please configure it. [unknownMacro]
60+
```
5761

5862
Fix:
5963

‎man/filters/include-files.LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Pandoc Extensions
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)