From aa4258e259a6d13ee38d6b17b19399da51506f43 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Mon, 21 Sep 2009 13:44:56 +0000 Subject: 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. --- Makefile | 12 +++++------ example.style.css | 40 +++++++++++++++++++++++++++++++++++++ html.c | 25 ++++++++++++++--------- index.sgml | 16 +++++++-------- mandoc.1 | 6 ++++++ style.css | 59 +++++++++++++++++++------------------------------------ 6 files changed, 95 insertions(+), 63 deletions(-) create mode 100644 example.style.css 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("\n", DOCTYPE, DTD); + printf("", DOCTYPE, DTD); } @@ -1058,15 +1064,11 @@ mdoc_root_pre(MDOC_ARGS) (void)snprintf(title, BUFSIZ - 1, "%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 @@

- These manuals are generated automatically (with mandoc(1)) and refer to the + These manuals are generated automatically (with mandoc(1) -Thtml) and refer to the current snapshot.

@@ -142,31 +142,31 @@ - mandoc(1) + mandoc(1) format and display UNIX manuals - mandoc_char(7) + mandoc_char(7) mandoc special characters - mdoc(7) + mdoc(7) mdoc language reference - man(7) + man(7) man language reference - manuals(7) + manuals(7) a guide to writing UNIX manuals - mdoc(3) + mdoc(3) mdoc macro compiler library - man(3) + man(3) man macro compiler library 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; } -- cgit