Extend fixlinks to fix the completely broken cross-linking in maverick
[senf.git] / site_scons / lib / doxygen.sh
index 958a87b..7815cea 100755 (executable)
@@ -5,6 +5,9 @@ do_html_cleanup()
     sed -e 's/id="current"/class="current"/' \
        | tidy -ascii -q --wrap 0 --show-warnings no --fix-uri no \
        | sed -e 's/name="\([^"]*\)"\([^>]*\) id="\1"/name="\1"\2/g' \
+              -e 's/id="\([^"]*\)"\([^>]*\) name="\1"/name="\1"\2/g' \
+              -e 's/\(<area shape="rect"\) id="[^"]*"/\1/g' \
+              -e 's/<a name="member-group"><\/a>//g' \
        | xsltproc --novalid --nonet --html --stringparam topdir "$reltopdir" \
              "$base/html-munge.xsl" -
 }
@@ -32,8 +35,10 @@ abspath()
 # Create relative path from absolute directory $1 to absolute path $2
 relpath()
 {
-    local src="${1#/}"
-    local dst="${2#/}"
+    local src="`abspath "$1"`" # `"
+    local dst="`abspath "$2"`" # `"
+    src="${src#/}"
+    dst="${dst#/}"
     while true; do
        if [ -z "$src" -a -z "$dst" ]; then
            echo "Internal error in relpath()" 1>&2
@@ -137,13 +142,16 @@ doxydir="`abspath "$doxydir"`" #`"
 
 ## Find $TOPDIR
 
-cd "$doxydir"
-while [ ! -r "SConstruct" -a "`pwd`" != "/" ]; do cd ..; done
-if [ ! -r "SConstruct" ]; then
-    echo "topdir not found"
-    exit 1;
+if [ -z "$TOPDIR" ]; then
+    cd "$doxydir"
+    while [ ! -r "SConstruct" -a "`pwd`" != "/" ]; do cd ..; done
+    if [ ! -r "SConstruct" ]; then
+       echo "topdir not found"
+       exit 1;
+    fi
+    TOPDIR="`pwd`";
 fi
-TOPDIR="`pwd`";
+
 reltopdir="`relpath "$doxydir/$output_dir/$html_dir" "$TOPDIR"`" #`"
 cd "$doxydir"
 
@@ -160,6 +168,15 @@ if [ -n "$tagfile_name" ]; then
     done
 fi
 
+## Remove empty tagfiles from list of tagfiles
+
+x="$tagfiles"; tagfiles=""
+for f in $x; do
+    if [ -s "$f" ]; then
+       tagfiles="$tagfiles${tagfiles:+ }$f"
+    fi
+done
+
 ## Call doxygen proper
 
 generate_tagfile=""
@@ -168,6 +185,7 @@ if [ "$tagfile" = "YES" ]; then
 fi
 export TOPDIR LIBDIR html tagfile tagfile_name tagfiles output_dir html_dir generate_tagfile
 
+echo "+ cd $doxydir"
 cmd ${DOXYGEN:-doxygen}