Improve workflow for one-page annotated spec

This commit is contained in:
Ben Edgington
2021-11-24 10:04:58 +00:00
parent 3789648859
commit 5cde68fcbc
3 changed files with 13 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/gawk -f
# Split out the annotated spec chapter as a single page doc and update links
#
# Sends output to stdout
BEGIN {
@@ -27,6 +27,8 @@ in_part_3 {
# Change the chapter title
if (in_part_3 == 1) {
print "# One Page Annotated Spec"
print ""
print "**Note:** This page has been automatically generated from the chapters in [Part 3](/part3). You may find that some internal links are broken."
in_part_3 = 2
next
}
@@ -39,5 +41,10 @@ in_part_3 {
# Rewrite urls that are internal to the chapter
gsub(/]\(\/part3\/[^#)]*/, "](", $0)
# Remove page path comments from titles
if ($0 ~ /^#.*<!--/) {
sub(/ <!--.*-->/, "", $0)
}
print
}

View File

@@ -5,5 +5,10 @@
cd "$(dirname "$0")/../../src"
# Build the markdown pages
rm -rf md/pages/
../bin/build/split.awk book.md
# Build the one page annotated spec
rm -f md/annotated.md
../bin/build/annotated.awk book.md > md/annotated.md