Automatic generation of bash script function documentation for hugo deployed to gitlab pages
Since hugo and other static site generators use markdown, shdoc documentation generator was engaged.
notes:⌗
- system needs bash , make and gawk
A File named generate-doc.sh
was created
#!/bin/bash
startpoint=$(pwd);
cd tools/shddoc/;make -j$(nproc) install;
ls /usr/local/bin/shdoc ; chmod +x /usr/local/bin/shdoc
cd "${startpoint}"
pwd;
header='+++
date = "'$(date +%F)'"
description = "About Page"
title = "doc://gitlab.com/b4sh-stack/b4sh-l1b.git"
lastmod = "$(date +%F)"
tags = ["documentation","shell"]
+++
'
test -d ${startpoint}/content/librarydoc/ || mkdir ${startpoint}/content/librarydoc/ -p
( echo "$header" ;/usr/local/bin/shdoc < b4sh-l1b/_b4shl1b.sh ) | tee ${startpoint}/content/librarydoc/index.md
echo
(the space before the second +++ was inserted into this post since hugo failed to compile the site )⌗
also a line containing:
- apk add bash make gawk git
and another one containing:
- /bin/bash -c "bash fix-pubdate.sh"
had to be inserted in .gitlab-ci.yml
The final result can be viewed here