#! /bin/sh # # A shell script to post-process doxy-generated files; the purpose # is to make the menu on the left in the file match the actually # generated files (ie. leave out namespaces if there are none). # # Usage: doxyndex.sh # # Typically, this means $(top_builddir)/apidocs and something like # libfoo/html for the output. For the top-level dig, set relative-html # to "." . In non-top directories, both and # are calculated and replaced. Top directories get an empty # if any. WRKDIR="$1/$2" TOPDIR=`echo "$2" | sed -e 's+[^/][^/]*/+../+g' -e 's+html$+..+'` echo "Postprocessing files in $WRKDIR ($TOPDIR)" # Special case top-level to have an empty MENU. if test "x$2" = "x." ; then MENU="" else MENU="" fi # Get the list of global Menu entries. GMENU=`cat "$1"/subdirs | tr -d '\n'` PMENU=`grep '++' | awk '{ c=split($0,a,"/"); for (j=1; j<=c; j++) { printf " / %s\n" , a[j]; } }' | tr -d '\n'` # Now substitute in the MENU in every file. This depends # on HTML_HEADER (ie. header.html) containing the comment. for i in "$WRKDIR"/*.html do sed -e "s++$MENU+" -e "s++$GMENU+" -e "s++$PMENU+" < "$i" | sed -e "s+@topdir@+$TOPDIR+g" > "$i.new" && mv "$i.new" "$i" done