1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-12 21:40:41 +00:00
AdvLabDB/docs/update_docs.sh

24 lines
701 B
Bash
Raw Normal View History

2022-01-16 15:13:48 +00:00
#!/usr/bin/bash
# Needed packages: fd (find alternative), asciidoctor
# You have to cd into the docs directory where this script is located before running it!
# List of documentation files
2022-04-20 00:10:17 +00:00
DOC_FILE_NAMES=$(fd -d 1 -t f --extension adoc --exclude "README.adoc")
2022-01-16 15:13:48 +00:00
2022-04-20 00:10:17 +00:00
for doc_file_name in "${DOC_FILE_NAMES[@]}"; do
DOC_FILE_NAME_WITHOUT_EXTENSION=${doc_file_name::-5}
OUTPUT_PATH=../advlabdb/templates/docs/$DOC_FILE_NAME_WITHOUT_EXTENSION.html
2022-01-16 15:13:48 +00:00
# Convert to html with asciidoctor
2022-04-20 00:10:17 +00:00
asciidoctor -v --backend html5 "$doc_file_name" -o "$OUTPUT_PATH"
2022-01-16 15:13:48 +00:00
# Add the Jinja raw tag
2022-04-20 00:10:17 +00:00
sed -i "1i {% raw %}" "$OUTPUT_PATH"
echo -e "\n{% endraw %}" >>"$OUTPUT_PATH"
2022-01-16 15:13:48 +00:00
# Done
2022-04-20 00:10:17 +00:00
echo "Generated $OUTPUT_PATH"
2022-01-16 15:13:48 +00:00
done