-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate-generated-docs.sh
More file actions
executable file
·44 lines (33 loc) · 1.4 KB
/
Copy pathupdate-generated-docs.sh
File metadata and controls
executable file
·44 lines (33 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
############################
# See README.md
############################
if ! pandoc -v 2>&1 >/dev/null; then
echo "Please install the pandoc package."
exit 1
fi
# generate the md file from the source csv file
echo "Processing csv file to generate .md file for input to other tools"
python3 csv-to-md.py
# generate the plain text table [api-doc.txt](api-doc.txt).
echo "Generating the plain text table ..."
python3 md-to-doc.py api-doc.md > api-doc.txt
# generate the OpenAPI specification [hamclock-openapi.yaml](hamclock-openapi.yaml).
echo "Generating the OpenAPI specification ..."
python3 md-to-openapi.py api-doc.md hamclock-openapi.yaml
# generate the interactive HTML documentation [hamclock-api-docs.html](hamclock-api-docs.html).
echo "Generating the interactive OpenAPI HTML documentation ..."
python3 openapi-to-html.py
# convert MarkDown to HTML via pandoc then inject enum definitions and hyperlinks
echo "Converting MarkDown to HTML ..."
# Wrap api-doc.css in <style> tags so pandoc -H embeds it correctly
STYLE_HEADER=$(mktemp /tmp/api-doc-header-XXXX.html)
echo "<style>" > "$STYLE_HEADER"
cat api-doc.css >> "$STYLE_HEADER"
echo "</style>" >> "$STYLE_HEADER"
pandoc api-doc.md -so api-doc-raw.html \
--metadata title="HamClock API Documentation" \
-H "$STYLE_HEADER"
rm -f "$STYLE_HEADER"
python3 post-process.py api-doc-raw.html api-doc.md api-doc.html
rm -f api-doc-raw.html