chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
help menu can now pop up the man page
[disorder]
/
scripts
/
htmlman
diff --git
a/scripts/htmlman
b/scripts/htmlman
index c579151dcd9679dba61e6e4cabd5e34288d1f13e..82a33ca20c822bb3650fb29f0261665d16470b62 100755
(executable)
--- a/
scripts/htmlman
+++ b/
scripts/htmlman
@@
-21,20
+21,41
@@
set -e
set -e
+stdhead=false
+
+while test $# -gt 0; do
+ case "$1" in
+ -stdhead )
+ stdhead=true
+ ;;
+ -* )
+ echo >&2 "ERROR: unknown option $1"
+ exit 1
+ ;;
+ * )
+ break
+ esac
+ shift
+done
+
title=$(basename $1)
title=$(basename $1)
-cat <<EOF
-<html>
- <head>
-@include{stdhead}@
- <title>$title</title>
- </head>
- <body>
-@include{@label{menu}@}@
-EOF
+echo "<html>"
+echo " <head>"
+if $stdhead; then
+ echo "@include{stdhead}@"
+fi
+echo " <title>$title</title>"
+echo " </head>"
+echo " <body>"
+if $stdhead; then
+ echo "@include{@label{menu}@}@"
+fi
printf " <pre class=manpage>"
# this is kind of painful using only BREs
printf " <pre class=manpage>"
# this is kind of painful using only BREs
-nroff -man "$1" | sed 's/&/\&/g;
+nroff -man "$1" | sed \
+ '1d;$d;
+ s/&/\&/g;
s/</\</g;
s/>/\>/g;
s/@/\@/g;
s/</\</g;
s/>/\>/g;
s/@/\@/g;
@@
-43,9
+64,9
@@
nroff -man "$1" | sed 's/&/\&/g;
s!_
\b
\(.\)!<i>\1</i>!g;
s!_
\b
\(&[#0-9a-z][0-9a-z]*;\)!<i>\1</i>!g;
s!</\([bi]\)><\1>!!g'
s!_
\b
\(.\)!<i>\1</i>!g;
s!_
\b
\(&[#0-9a-z][0-9a-z]*;\)!<i>\1</i>!g;
s!</\([bi]\)><\1>!!g'
-cat <<EOF
-</pre>
-@include{@label{menu}@end}@
- </body>
-</html>
-EOF
+echo "</pre>"
+if $stdhead; then
+ echo "@include{@label{menu}@end}@"
+fi
+echo " </body>"
+echo "</html>"