Skip to content

Commit 416db58

Browse files
Enable auto-generation of linklist.md
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 172a86c commit 416db58

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

make_linklist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
url='https://github.com/ossf/secure-sw-dev-fundamentals/blob/main/secure_software_development_fundamentals.md'
4+
while read line; do
5+
case "$line" in
6+
\#*)
7+
name=$(printf '%s\n' "$line" | sed -e 's/^#* //')
8+
link=$(printf '%s\n' "$name" | tr -dc 'A-Za-z0-9 -' | tr 'A-Z ' 'a-z-')
9+
printf '%s\n' "[${name}](${url}#${link})"
10+
;;
11+
esac
12+
done

makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ toc.md: secure_software_development_fundamentals.md tocignore
1010
grep -E '^#{1,3} ' secure_software_development_fundamentals.md | \
1111
grep -E -v -f tocignore | while read line; do echo "$$line"; echo; done > toc.md
1212

13+
linklist.md: toc.md make_linklist
14+
./make_linklist < toc.md > linklist.md
15+
1316
# This requires wkhtmltopdf because it goes via HTML
1417
# https://plaintextproject.online/articles/2022/04/06/pdf.html
1518
# https://stackoverflow.com/questions/38455078/specifying-papersize-for-md-to-pdf-conversion
@@ -18,4 +21,4 @@ toc.md: secure_software_development_fundamentals.md tocignore
1821
book.pdf: secure_software_development_fundamentals.md
1922
pandoc -f gfm --pdf-engine=wkhtmltopdf \
2023
--css=print.css -V geometry:a4paper -o book.pdf \
21-
secure_software_development_fundamentals.md
24+
secure_software_development_fundamentals.md

0 commit comments

Comments
 (0)