X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=podwrapper.sh.in;h=c7660547f95878a285cf0e4ee489864d0f2a7632;hb=1b1db82d64a9664f0da1c628ee896a113a605739;hp=175368a55859c048e32cc0e6119ced23288f7ff0;hpb=7a8c60e1c8fbaf09fb2fa2fe10b50df39c0d9650;p=libguestfs.git
diff --git a/podwrapper.sh.in b/podwrapper.sh.in
index 175368a..c766054 100755
--- a/podwrapper.sh.in
+++ b/podwrapper.sh.in
@@ -168,18 +168,37 @@ if [ -n "$man_output" ]; then
--section "$section" -c "Virtualization Support" --name "$name" \
--release "$PACKAGE_NAME-$PACKAGE_VERSION" \
< $tmpdir/full.pod > "$man_output".tmp
- mv "$man_output".tmp "$man_output"
+ mv "$man_output".tmp "$man_output"
fi
if [ -n "$text_output" ]; then
"$POD2TEXT" --stderr -u \
< $tmpdir/full.pod > "$text_output".tmp
- mv "$text_output".tmp "$text_output"
+ mv "$text_output".tmp "$text_output"
fi
if [ -n "$html_output" ]; then
"$POD2HTML" \
--css "pod.css" --htmldir "$abs_top_builddir/html" \
< $tmpdir/full.pod > "$html_output".tmp
- mv "$html_output".tmp "$html_output"
+ mv "$html_output".tmp "$html_output"
+
+ # Fix up some of the mess in the HTML output, mainly to make links
+ # between man pages work properly.
+
+ # Rewrite manpage(n) to manpage(n) if
+ # there is a linkable manual page.
+ sed_cmd="sed"
+ for f in $(cd "$abs_top_builddir/html" && ls -1 *.html); do
+ b=$(basename $f .html)
+ m=$(echo $b | sed 's/\(.*\)\.\([1-9]\)$/\1(\2)/')
+ sed_cmd="$sed_cmd -e 's,$m,$m,g'"
+ done
+ echo $sed_cmd
+ eval $sed_cmd < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
+
+ # Fix links like L
+ sed 's,guestfs-\1(\([1-9]\)),guestfs-\1(\2),g' < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
fi