Added automated manual generation.

Bash script which rebuilds the indexes (index.txt and the links listed in git-extras.md) based on the collection of .md file documents avalable.
By interrogating the .md file for the documented description we null and void yet another possible consistency issue and avoid manual duplication mistakes.
Once the indexes are up to date we start from the begining of the directory listing again calling ronn on each .md to generate the man and html files as well as renaming the incerrectly name html file.

Result several incorrectly named .html documents are now removed, and all the documentation is up to date.
Documentation also updated.
This commit is contained in:
nickl- 2012-07-21 23:20:54 +02:00
parent 2aeb45a160
commit 7007b6e6e5
2 changed files with 37 additions and 11 deletions

View file

@ -9,29 +9,36 @@ To generate documentation:
2) Then use a program ronn. Get ronn from github.
3) Run ronn:
3) Run ronn:
$ronn <filename>.md
$ronn <filename>.md
4) Remember, we use the following naming convention for files:
git-<command>.html
git-<command>.1
git-<command>.md
4) Remember, we use the following naming convention for files:
git-<command>.html
git-<command>.1
git-<command>.md
You'll need to rename the html file, as ronn probably inserted a 1 into the filename.
You'll need to rename the html file, as ronn probably inserted a 1 into the filename.
## EXAMPLE
$ ronn git-effort.md
$ ronn git-effort.md
roff: ./git-effort.1
html: ./git-effort.1.html +man
roff: ./git-effort.1
html: ./git-effort.1.html +man
$mv git-effort.1.html git-effort.html
$mv git-effort.1.html git-effort.html
## SHELL SCRIPT
Alternatively you can run the `manning-up.sh` automated shell script included in the man folder. The script will recreate the git-extras index based on the list of .md files available before it runs `ronn` against each one to generate the documents as well as renaming the generated `.html` files to their desired form.
$ ./manning-up.sh
## AUTHOR
Written by Leila Muhtasib &lt;<muhtasib@gmail.com>&gt;
Shell Script by Nick Lombard &lt;<github@jigsoft.co.za>&gt;
## REPORTING BUGS

19
man/manning-up.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
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