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
|
|
|
|
doc_file_names=$(fd -d 1 -t f --extension adoc --exclude "README.adoc")
|
|
|
|
|
2022-03-19 21:42:13 +00:00
|
|
|
for doc_file_name in "${doc_file_names[@]}"; do
|
2022-01-16 15:13:48 +00:00
|
|
|
doc_file_name_without_extension=${doc_file_name::-5}
|
|
|
|
output_path=../advlabdb/templates/docs/$doc_file_name_without_extension.html
|
|
|
|
|
|
|
|
# Convert to html with asciidoctor
|
2022-03-19 21:42:13 +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-03-19 21:42:13 +00:00
|
|
|
sed -i "1i {% raw %}" "$output_path"
|
|
|
|
echo -e "\n{% endraw %}" >>"$output_path"
|
2022-01-16 15:13:48 +00:00
|
|
|
|
|
|
|
# Done
|
|
|
|
echo "Generated $output_path"
|
|
|
|
done
|