Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

hg-autodoc: add optional creation of toc helperfile
authorMichael Gebetsroither <michael.geb@gmx.at>
Sun Mar 30 15:26:52 2008 +0200 (7 months ago)
changeset 56aaf872eeb81c
manifestaaf872eeb81c
parent 553a6bed4aad8d
child 577e2cbab72300
hg-autodoc: add optional creation of toc helperfile
files/hg-autodoc
--- a/files/hg-autodoc Sun Mar 30 14:20:46 2008 +0200
+++ b/files/hg-autodoc Sun Mar 30 15:26:52 2008 +0200
@@ -4,6 +4,10 @@ FORCE_REBUILD_='false'
FORCE_REBUILD_='false'
OPT_IGNORE_FILE_=''
OPT_EXCLUDE_=''
+OPT_TOCFILE_='/dev/null'
+
+# global var which holds the repo currently processed
+BASEREPO_=''
function printUsage
{
@@ -11,10 +15,16 @@ Usage: $PROG_NAME [Options] <destination
Usage: $PROG_NAME [Options] <destination of doc files> <source>
Options:
- -f Force rebuild of dokumentation cache
- -e Exclude given projects (<p1>,<p2>, ...)
- -i Ignorefile (one project to ignore per line)
- -h This help text
+ -f Force rebuild of dokumentation cache
+ -e Exclude given projects (<p1>,<p2>, ...)
+ -i <file> Ignorefile (one project to ignore per line)
+ -t <file> Create helpfile for toc creation (default: /dev/null)
+ -h This help text
+
+Toc helpfile:
+ Consist of one entry per line:
+ <repository> <html-file> <future tags>
+
EOT
# -i Ignore files (not implemented yet)
}
@@ -26,11 +36,12 @@ function die()
exit 1
}
-while getopts "fi:e:h" opt; do
+while getopts "fi:e:t:h" opt; do
case "$opt" in
f) FORCE_REBUILD_='true' ;;
i) OPT_IGNORE_FILE_="$OPTARG" ;;
e) OPT_EXCLUDE_="$OPTARG" ;;
+ t) OPT_TOCFILE_="$OPTARG" ;;
h) printUsage; exit 0 ;;
?) die "E: Unknown option \"$opt\"" ;;
esac
@@ -63,7 +74,7 @@ function copyhtml
asciidoc -b xhtml11 -o "$DST/`basename $htmlfile`" $1
return
fi
- cp -uv $htmlfile $DST
+ cp -uv $htmlfile $DST |grep -q ' -> ' && echo "$BASEREPO_ $htmlfile" >>$OPT_TOCFILE_
}
function processDir
@@ -101,6 +112,7 @@ hg-reposearch "$SRC" |while read repo_;
fi
pushd $repo_ >/dev/null || continue
+ BASEREPO_="$baserepo_"
# process valied packages
for target_ in "Makefile" "docs/Makefile" "doc/Makefile"; do
@@ -119,5 +131,6 @@ hg-reposearch "$SRC" |while read repo_;
cp -ru images $DST
fi
+ BASEREPO_=''
popd >/dev/null || exit $?
done