summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-21 13:44:56 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-21 13:44:56 +0000
commitaa4258e259a6d13ee38d6b17b19399da51506f43 (patch)
treeec0f5cf33a8e5eff1f39740b515a8718da76b504
parent999f14b2c785abc9f7cc83f32a010821b5f9a1ff (diff)
downloadmandoc-aa4258e259a6d13ee38d6b17b19399da51506f43.tar.gz
Fixed body/divbody structure of html pages.
Added example style.css (example.style.css). Enabled using -Thtml to generate manuals in Makefile. Stopped making text manuals for webpage.
-rw-r--r--Makefile12
-rw-r--r--example.style.css40
-rw-r--r--html.c25
-rw-r--r--index.sgml16
-rw-r--r--mandoc.16
-rw-r--r--style.css59
6 files changed, 95 insertions, 63 deletions
diff --git a/Makefile b/Makefile
index 5848d7c1..586ad4c8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.SUFFIXES: .html .xml .sgml .1.txt .3.txt .7.txt .1 .3 .7 .md5 .tar.gz .1.html .3.html .7.html
+.SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.html .3.html .7.html
BINDIR = $(PREFIX)/bin
INCLUDEDIR = $(PREFIX)/include
@@ -55,16 +55,14 @@ HTMLS = index.html ChangeLog.html mandoc.1.html mdoc.3.html \
man.3.html mdoc.7.html man.7.html mandoc_char.7.html \
manuals.7.html
XMLS = ChangeLog.xml
-STATICS = style.css external.png
+STATICS = index.css style.css external.png
MD5S = mdocml-$(VERSION).md5
TARGZS = mdocml-$(VERSION).tar.gz
MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
man.7 man.3
-TEXTS = mandoc.1.txt mdoc.3.txt mdoc.7.txt manuals.7.txt \
- mandoc_char.7.txt man.7.txt man.3.txt
BINS = mandoc
CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
- $(TARGZS) tags $(TEXTS) $(MD5S) $(XMLS)
+ $(TARGZS) tags $(MD5S) $(XMLS)
INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
$(DATAS) $(XSLS)
@@ -80,10 +78,10 @@ cleanlint:
dist: mdocml-$(VERSION).tar.gz
-www: all $(HTMLS) $(MD5S) $(TARGZS) $(TEXTS)
+www: all $(HTMLS) $(MD5S) $(TARGZS)
installwww: www
- install -m 0444 $(TEXTS) $(HTMLS) $(STATICS) $(PREFIX)/
+ install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
diff --git a/example.style.css b/example.style.css
new file mode 100644
index 00000000..ceb5cc74
--- /dev/null
+++ b/example.style.css
@@ -0,0 +1,40 @@
+div.body { } /* Wraps entire body file. */
+
+span.sec-head { font-weight: bold; } /* Sections (Sh). */
+div.sec-head { }
+div.sec-body { }
+div.sec-block { }
+
+span.ssec-head { font-weight: bold; } /* Sub-sections (Ss). */
+div.ssec-head { }
+div.ssec-body { }
+div.ssec-block { }
+
+span.addr { text-decoration: underline; } /* Address (Ad). */
+span.arg { font-style: italic; } /* Command argument (Ar). */
+span.author { } /* Author name (An). */
+span.config { font-weight: bold; } /* Config statement (Cd). */
+span.define { } /* Defines (Dv). */
+span.desc { } /* Nd. After em-dash. */
+span.diag { font-weight: bold; } /* Diagnostic (Bl -diag). */
+span.emph { font-style: italic; } /* Emphasis (Em). */
+span.env { } /* Environment variables (Ev). */
+span.errno { } /* Error string (Er). */
+span.farg { font-style: underline; } /* Function argument (Fa, Fn). */
+span.file { font-style: italic; } /* File (Pa). */
+span.flag { font-weight: bold; } /* Flag (Fl, Cm). */
+span.macro { } /* Macro-ish thing (Fd). */
+span.name { font-weight: bold; } /* Name of utility (Nm). */
+span.opt { } /* Options (Op, Oo/Oc). */
+span.type { font-weight: italic; } /* Variable types (Vt, Ft, Fn). */
+span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */
+span.utility { font-weight: bold; } /* Name of utility (Ex). */
+
+a.link-man { } /* Manual links (Xr). */
+a.link-sec { } /* Section links (Sx). */
+
+div.lit-block { font-family: monospace; } /* Literal block (D1, Bd -literal, Dl). */
+
+table.header { } /* Document header. */
+table.footer { } /* Document footer. */
+
diff --git a/html.c b/html.c
index a5133932..03f6a35b 100644
--- a/html.c
+++ b/html.c
@@ -558,12 +558,18 @@ static void
print_mdoc(MDOC_ARGS)
{
struct tag *t;
+ struct htmlpair tag;
t = print_otag(h, TAG_HEAD, 0, NULL);
print_mdoc_head(m, n, h);
print_tagq(h, t);
t = print_otag(h, TAG_BODY, 0, NULL);
+
+ tag.key = ATTR_CLASS;
+ tag.val = "body";
+ print_otag(h, TAG_DIV, 1, &tag);
+
print_mdoc_nodelist(m, n, h);
print_tagq(h, t);
}
@@ -915,7 +921,7 @@ static void
print_gen_doctype(struct html *h)
{
- printf("<!DOCTYPE HTML PUBLIC \"%s\" \"%s\">\n", DOCTYPE, DTD);
+ printf("<!DOCTYPE HTML PUBLIC \"%s\" \"%s\">", DOCTYPE, DTD);
}
@@ -1059,14 +1065,10 @@ mdoc_root_pre(MDOC_ARGS)
"%s(%d)", m->title, m->msec);
tag[0].key = ATTR_CLASS;
- tag[0].val = "body";
- t = print_otag(h, TAG_DIV, 1, tag);
-
- tag[0].key = ATTR_CLASS;
tag[0].val = "header";
tag[1].key = ATTR_STYLE;
tag[1].val = "width: 100%;";
- print_otag(h, TAG_TABLE, 2, tag);
+ t = print_otag(h, TAG_TABLE, 2, tag);
tt = print_otag(h, TAG_TR, 0, NULL);
tag[0].key = ATTR_STYLE;
@@ -1085,7 +1087,7 @@ mdoc_root_pre(MDOC_ARGS)
tag[0].val = "width: 33%; text-align: right;";
print_otag(h, TAG_TD, 1, tag);
print_text(h, b);
- print_stagq(h, t);
+ print_tagq(h, t);
return(1);
}
@@ -1261,6 +1263,7 @@ mdoc_op_pre(MDOC_ARGS)
/* XXX - this can contain block elements! */
print_text(h, "\\(lB");
+ h->flags |= HTML_NOSPACE;
tag.key = ATTR_CLASS;
tag.val = "opt";
print_otag(h, TAG_SPAN, 1, &tag);
@@ -1422,8 +1425,12 @@ mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c)
break;
}
- if ( ! c && n->prev && n->prev->body->child)
- bufcat("padding-top: 1em;");
+ if ( ! c && MDOC_Column != t) {
+ if (n->prev && n->prev->body->child)
+ bufcat("padding-top: 1em;");
+ else if (NULL == n->prev)
+ bufcat("padding-top: 1em;");
+ }
tag.key = ATTR_STYLE;
tag.val = buf;
diff --git a/index.sgml b/index.sgml
index 44345573..db9112fa 100644
--- a/index.sgml
+++ b/index.sgml
@@ -133,7 +133,7 @@
</h1>
<p>
- These manuals are generated automatically (with <a href="mandoc.1.txt">mandoc(1)</a>) and refer to the
+ These manuals are generated automatically (with <a href="mandoc.1.html">mandoc(1)</a> -Thtml) and refer to the
current snapshot.
</p>
@@ -142,31 +142,31 @@
<col>
<tbody>
<tr>
- <td><a href="mandoc.1.txt">mandoc(1)</a></td>
+ <td><a href="mandoc.1.html">mandoc(1)</a></td>
<td>format and display UNIX manuals</td>
</tr>
<tr>
- <td><a href="mandoc_char.7.txt">mandoc_char(7)</a></td>
+ <td><a href="mandoc_char.7.html">mandoc_char(7)</a></td>
<td>mandoc special characters</td>
</tr>
<tr>
- <td><a href="mdoc.7.txt">mdoc(7)</a></td>
+ <td><a href="mdoc.7.html">mdoc(7)</a></td>
<td>mdoc language reference</td>
</tr>
<tr>
- <td><a href="man.7.txt">man(7)</a></td>
+ <td><a href="man.7.html">man(7)</a></td>
<td>man language reference</td>
</tr>
<tr>
- <td><a href="manuals.7.txt">manuals(7)</a></td>
+ <td><a href="manuals.7.html">manuals(7)</a></td>
<td>a guide to writing UNIX manuals</td>
</tr>
<tr>
- <td><a href="mdoc.3.txt">mdoc(3)</a></td>
+ <td><a href="mdoc.3.html">mdoc(3)</a></td>
<td>mdoc macro compiler library</td>
</tr>
<tr>
- <td><a href="man.3.txt">man(3)</a></td>
+ <td><a href="man.3.html">man(3)</a></td>
<td>man macro compiler library</td>
</tr>
</tbody>
diff --git a/mandoc.1 b/mandoc.1
index 68b6c08d..fc5086aa 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -277,6 +277,12 @@ To page manuals to the terminal:
.D1 % mandoc mandoc.1 mdoc.3 mdoc.7 | less
.
.Pp
+To produce HTML manuals with
+.Pa http://localhost/
+as the base URI:
+.Pp
+.D1 % mandoc \-Thtml -obase=http://localhost/ mdoc.7 > mdoc.7.html
+.Pp
To check over a large set of manuals:
.
.Pp
diff --git a/style.css b/style.css
index ceb5cc74..40c71590 100644
--- a/style.css
+++ b/style.css
@@ -1,40 +1,21 @@
-div.body { } /* Wraps entire body file. */
-
-span.sec-head { font-weight: bold; } /* Sections (Sh). */
-div.sec-head { }
-div.sec-body { }
-div.sec-block { }
-
-span.ssec-head { font-weight: bold; } /* Sub-sections (Ss). */
-div.ssec-head { }
-div.ssec-body { }
-div.ssec-block { }
-
-span.addr { text-decoration: underline; } /* Address (Ad). */
-span.arg { font-style: italic; } /* Command argument (Ar). */
-span.author { } /* Author name (An). */
-span.config { font-weight: bold; } /* Config statement (Cd). */
-span.define { } /* Defines (Dv). */
-span.desc { } /* Nd. After em-dash. */
-span.diag { font-weight: bold; } /* Diagnostic (Bl -diag). */
-span.emph { font-style: italic; } /* Emphasis (Em). */
-span.env { } /* Environment variables (Ev). */
-span.errno { } /* Error string (Er). */
-span.farg { font-style: underline; } /* Function argument (Fa, Fn). */
-span.file { font-style: italic; } /* File (Pa). */
-span.flag { font-weight: bold; } /* Flag (Fl, Cm). */
-span.macro { } /* Macro-ish thing (Fd). */
-span.name { font-weight: bold; } /* Name of utility (Nm). */
-span.opt { } /* Options (Op, Oo/Oc). */
-span.type { font-weight: italic; } /* Variable types (Vt, Ft, Fn). */
-span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */
-span.utility { font-weight: bold; } /* Name of utility (Ex). */
-
-a.link-man { } /* Manual links (Xr). */
-a.link-sec { } /* Section links (Sx). */
-
-div.lit-block { font-family: monospace; } /* Literal block (D1, Bd -literal, Dl). */
-
-table.header { } /* Document header. */
-table.footer { } /* Document footer. */
+div.body { color: #333333;
+ max-width: 800px;
+ padding-left: 10px;
+ font-size: smaller;
+ font-family: Verdana, Tahoma, Arial, sans-serif; }
+span.sec-head { font-weight: bold; color: blue; }
+span.ssec-head { font-weight: bold; color: blue; }
+span.addr { text-decoration: underline; }
+span.arg { font-style: italic; }
+span.config { font-weight: bold; }
+span.diag { font-weight: bold; }
+span.emph { font-style: italic; }
+span.farg { font-style: underline; }
+span.file { font-style: italic; }
+span.flag { font-weight: bold; }
+span.name { font-weight: bold; }
+span.type { font-weight: italic; }
+span.utility { font-weight: bold; }
+table.header { border-bottom: 1px dotted #cccccc; }
+table.footer { border-top: 1px dotted #cccccc; }