aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/troff2html
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-14 03:45:44 +0000
committerrsc <devnull@localhost>2005-01-14 03:45:44 +0000
commit78e51a8c6678b6e3dff3d619aa786669f531f4bc (patch)
tree015e00fde4fc837fd31b705e18d17dc913829388 /src/cmd/troff2html
parent2634795b5f0053bc0ff08e5d7bbc0eda8efea061 (diff)
downloadplan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.gz
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.bz2
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.zip
checkpoint
Diffstat (limited to 'src/cmd/troff2html')
-rw-r--r--src/cmd/troff2html/troff2html.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/cmd/troff2html/troff2html.c b/src/cmd/troff2html/troff2html.c
index 1bb40cff..20d48d1f 100644
--- a/src/cmd/troff2html/troff2html.c
+++ b/src/cmd/troff2html/troff2html.c
@@ -1,6 +1,7 @@
#include <u.h>
#include <libc.h>
#include <bio.h>
+#include <ctype.h>
enum{
Nfont = 11,
@@ -430,19 +431,28 @@ flush(void)
void
header(char *s)
{
+ char *p;
+
Bprint(&bout, "<head>\n");
- Bprint(&bout, "<title>%s</title>\n", s);
+ if(pagename && section){
+ char buf[512];
+ strecpy(buf, buf+sizeof buf, pagename);
+ for(p=buf; *p; p++)
+ *p = tolower(*p);
+ Bprint(&bout, "<title>%s(%s) - %s</title>\n", buf, section, s);
+ }else
+ Bprint(&bout, "<title>%s</title>\n", s);
Bprint(&bout, "<meta content=\"text/html; charset=utf-8\" http-equiv=Content-Type>\n");
Bprint(&bout, "</head>\n");
Bprint(&bout, "<body bgcolor=#ffffff>\n");
- Bprint(&bout, "<table>\n");
+ Bprint(&bout, "<table border=0 cellpadding=0 cellspacing=0 width=100%%>\n");
Bprint(&bout, "<tr height=10><td>\n");
- Bprint(&bout, "<tr><td width=10><td>\n");
+ Bprint(&bout, "<tr><td width=20><td>\n");
if(pagename && section){
Bprint(&bout, "<tr><td width=20><td><b>%s(%s)</b><td align=right><b>%s(%s)</b>\n",
pagename, section, pagename, section);
}
- Bprint(&bout, "<tr><td width=10><td colspan=2>\n");
+ Bprint(&bout, "<tr><td width=20><td colspan=2>\n");
}
void
@@ -605,15 +615,27 @@ xcmd(Biobuf *b)
if(strcmp(fld[3], "start") == 0){
/* set anchor attribute and remember string */
attr |= (1<<Anchor);
+#if 0
snprint(buf, sizeof buf,
- "<a href=\"/magic/man2html/%c/%s\">",
+ "<a href=\"/magic/man2html/man%c/%s\">",
fld[5][1], fld[4]);
+#else
+ snprint(buf, sizeof buf,
+ "<a href=\"../man%c/%s.html\">", fld[5][1], fld[4]);
+#endif
nanchors++;
anchors = erealloc(anchors, nanchors*sizeof(char*));
anchors[nanchors-1] = estrdup(buf);
}else if(strcmp(fld[3], "end") == 0)
attr &= ~(1<<Anchor);
}
+ }else if(nfld >= 4 && strcmp(fld[2], "href") == 0){
+ attr |= 1<<Anchor;
+ nanchors++;
+ anchors = erealloc(anchors, nanchors*sizeof(char*));
+ anchors[nanchors-1] = smprint("<a href=\"%s\">", fld[3]);
+ }else if(strcmp(fld[2], "/href") == 0){
+ attr &= ~(1<<Anchor);
}else if(strcmp(fld[2], "manPP") == 0){
didP = 1;
emitul(Epp, 1);