32 lines
755 B
Bash
Executable File
32 lines
755 B
Bash
Executable File
#!/bin/bash
|
|
|
|
orig="${PWD}"
|
|
|
|
if ! command -v asciidoctor &> /dev/null;
|
|
then
|
|
exit 0
|
|
fi
|
|
|
|
set -e
|
|
|
|
for f in $(find . -type f -iname "README.adoc"); do
|
|
filename=$(basename -- "${f}")
|
|
docsdir=$(dirname -- "${f}")
|
|
nosuffix="${filename%.*}"
|
|
pfx="${docsdir}/${nosuffix}"
|
|
|
|
newf="${pfx}.html"
|
|
asciidoctor -a ROOTDIR="${orig}/" -o "${newf}" "${f}"
|
|
echo "Generated ${newf} from ${f}"
|
|
git add "${newf}"
|
|
if command -v pandoc &> /dev/null;
|
|
then
|
|
newf="${pfx}.md"
|
|
asciidoctor -a ROOTDIR="${orig}/" -b docbook -o - "${f}" | pandoc -f docbook -t markdown_strict -o "${newf}"
|
|
echo "Generated ${newf} from ${f}"
|
|
git add "${newf}"
|
|
fi
|
|
cd ${orig}
|
|
done
|
|
echo "Regenerated docs"
|