summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-12-31 11:11:02 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-01-10 09:40:03 +0000
commit10402b45d9e4bcf9e7fe49ac8f09f9bfcbd3c14c (patch)
treef485ecd39cef1791904f3ed8958ebd5df46f73fc
parent8162b612f6365d6111b4aea32673094865c0e0cf (diff)
downloadlibguestfs-10402b45d9e4bcf9e7fe49ac8f09f9bfcbd3c14c.tar.gz
libguestfs-10402b45d9e4bcf9e7fe49ac8f09f9bfcbd3c14c.tar.xz
libguestfs-10402b45d9e4bcf9e7fe49ac8f09f9bfcbd3c14c.zip
podwrapper: Fix up the HTML output so most inter-page links work.
(cherry picked from commit 5c9e8a65fe89e5e6baca8651000885d8467356ff)
-rwxr-xr-xpodwrapper.sh.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/podwrapper.sh.in b/podwrapper.sh.in
index bd710059..c7660547 100755
--- a/podwrapper.sh.in
+++ b/podwrapper.sh.in
@@ -182,4 +182,23 @@ if [ -n "$html_output" ]; then
--css "pod.css" --htmldir "$abs_top_builddir/html" \
< $tmpdir/full.pod > "$html_output".tmp
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 <em>manpage(n)</em> to <a href=...>manpage(n)</a> 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,<em>$m</em>,<a href=$f>$m</a>,g'"
+ done
+ echo $sed_cmd
+ eval $sed_cmd < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
+
+ # Fix links like L<guestfs-foo(3)>
+ sed 's,<a href="#\([a-z]\+\)">guestfs-\1(\([1-9]\)),<a href="guestfs-\1.\2.html">guestfs-\1(\2),g' < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
fi