1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-19 04:22:46 +01:00
qmckl/tools/build_doc.sh

46 lines
1.0 KiB
Bash
Raw Normal View History

2021-03-23 22:23:49 +01:00
#!/bin/bash
2021-05-12 00:22:51 +02:00
# Extracts documentation from an org-mode file.
2021-03-10 12:58:38 +01:00
2021-05-11 11:45:49 +02:00
set -e
2021-03-10 12:58:38 +01:00
2021-05-11 17:03:13 +02:00
srcdir=$PWD
2021-03-23 22:23:49 +01:00
2021-05-11 11:45:49 +02:00
readonly DOCS=${srcdir}/share/doc/qmckl/
readonly ORG=${srcdir}/org/
readonly HTMLIZE=${DOCS}/html/htmlize.el
readonly CONFIG_DOC=${srcdir}/tools/config_doc.el
readonly CONFIG_TANGLE=${srcdir}/tools/config_tangle.el
2021-03-23 22:23:49 +01:00
2021-03-10 12:58:38 +01:00
function extract_doc()
{
2021-05-12 00:22:51 +02:00
org=$1
local_html=${org%.org}.html
local_text=${org%.org}.txt
html=${DOCS}/html/$(basename ${org%.org}.html)
text=${DOCS}/text/$(basename ${org%.org}.txt)
2021-06-03 01:32:50 +02:00
./tools/missing emacs --batch \
2021-05-12 00:22:51 +02:00
--load ${HTMLIZE} \
--load ${CONFIG_DOC} \
${org} \
--load ${CONFIG_TANGLE} \
-f org-html-export-to-html \
-f org-ascii-export-to-ascii
mv ${local_html} ${html}
mv ${local_text} ${text}
2021-03-10 12:58:38 +01:00
}
2021-05-12 00:22:51 +02:00
for i in $@
do
exported=${i%.org}.exported
2021-06-03 01:32:50 +02:00
exported=$(dirname $exported)/.$(basename $exported)
2021-05-12 00:22:51 +02:00
NOW=$(date +"%m%d%H%M.%S")
2021-06-03 01:32:50 +02:00
extract_doc ${i} > $exported
2021-03-10 12:58:38 +01:00
2021-05-12 00:22:51 +02:00
# Make log file older than the exported files
touch -t ${NOW} $exported
done
2021-03-10 12:58:38 +01:00
2021-03-23 22:23:49 +01:00