tj.git-extras/man/manning-up.sh
nickl- f076565a98 Generate only a single manual.
Added the ability to pass the .md document template as argument to manning-up.sh which will only generate the single document and rename the .1.html correctly before exiting and thus not building the index and all the docs again.
Includes updated documentation.
2012-07-22 22:27:38 +02:00

22 lines
799 B
Bash
Executable file

#!/bin/bash
test "$1" && ronn $1 && mv -f ${1/.md/}.1.html ${1/.md/}.html && exit 0
echo '# manuals' > index.txt.tmp
ln=$(awk '/## COMMANDS/{print NR};' ./git-extras.md)
awk "NR <= $ln+1" git-extras.md > git-extras.md.tmp
for file in $(ls git*.md); do
extra=${file/.md/}
spaced=" "
echo "$extra(1)${spaced:${#extra}}$extra" >> index.txt.tmp;
title=$(grep -m=1 $extra"(1) -- " $file)
test "$extra" != "git-extras" && echo " - **"${title/" --"/"**"} >> git-extras.md.tmp
done
ln=$(awk '/## AUTHOR/{print NR};' ./git-extras.md)
awk "NR >= $ln-1" git-extras.md >> git-extras.md.tmp && mv -f index.txt.tmp index.txt && mv -f git-extras.md.tmp git-extras.md
for file in $(ls git*.md); do
extra=${file/.md/}
ronn $file && mv -f $extra.1.html $extra.html
done