diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-19 15:27:34 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-19 15:27:34 +0000 |
commit | b7bb50b52763fb6212e5896c4f48f67e7e24944a (patch) | |
tree | 583c64d0cb3bdbe36623d41735307a67c32571fc | |
parent | 222d77f1d5049da7ae7750ce19f63c21c231c567 (diff) | |
download | mandoc-b7bb50b52763fb6212e5896c4f48f67e7e24944a.tar.gz mandoc-b7bb50b52763fb6212e5896c4f48f67e7e24944a.tar.zst mandoc-b7bb50b52763fb6212e5896c4f48f67e7e24944a.zip |
Clean up CSS rules for sections and paragraphs.
Start using real macro names for CSS classes.
-rw-r--r-- | html.c | 6 | ||||
-rw-r--r-- | man_html.c | 22 | ||||
-rw-r--r-- | mandoc.css | 22 | ||||
-rw-r--r-- | mdoc_html.c | 18 |
4 files changed, 34 insertions, 34 deletions
@@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.197 2017/01/19 01:00:14 schwarze Exp $ */ +/* $Id: html.c,v 1.198 2017/01/19 15:27:34 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -182,7 +182,7 @@ print_gen_head(struct html *h) print_endline(h); print_text(h, "table.head td { width: 33%; }"); print_endline(h); - print_text(h, "div.spacer { margin: 1em 0; }"); + print_text(h, "div.Pp { margin: 1ex 0ex; }"); print_tagq(h, t); if (h->style) @@ -769,7 +769,7 @@ print_paragraph(struct html *h) { struct tag *t; - t = print_otag(h, TAG_DIV, "c", "spacer"); + t = print_otag(h, TAG_DIV, "c", "Pp"); print_tagq(h, t); } @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.126 2017/01/19 13:35:02 schwarze Exp $ */ +/* $Id: man_html.c,v 1.127 2017/01/19 15:27:34 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -162,7 +162,11 @@ html_man(void *arg, const struct roff_man *man) print_otag(h, TAG_BODY, ""); } - print_man_nodelist(&man->meta, man->first, &mh, h); + man_root_pre(&man->meta, man->first, &mh, h); + t = print_otag(h, TAG_DIV, "c", "manual-text"); + print_man_nodelist(&man->meta, man->first->child, &mh, h); + print_tagq(h, t); + man_root_post(&man->meta, man->first, &mh, h); print_tagq(h, NULL); } @@ -198,9 +202,6 @@ print_man_node(MAN_ARGS) t = h->tags.head; switch (n->type) { - case ROFFT_ROOT: - man_root_pre(man, n, mh, h); - break; case ROFFT_TEXT: if ('\0' == *n->string) { print_paragraph(h); @@ -254,9 +255,6 @@ print_man_node(MAN_ARGS) print_stagq(h, t); switch (n->type) { - case ROFFT_ROOT: - man_root_post(man, n, mh, h); - break; case ROFFT_EQN: break; default: @@ -353,12 +351,11 @@ man_SH_pre(MAN_ARGS) { if (n->type == ROFFT_BLOCK) { mh->fl &= ~MANH_LITERAL; - print_otag(h, TAG_DIV, "c", "section"); return 1; } else if (n->type == ROFFT_BODY) return 1; - print_otag(h, TAG_H1, ""); + print_otag(h, TAG_H1, "c", "Sh"); return 1; } @@ -432,12 +429,11 @@ man_SS_pre(MAN_ARGS) { if (n->type == ROFFT_BLOCK) { mh->fl &= ~MANH_LITERAL; - print_otag(h, TAG_DIV, "c", "subsection"); return 1; } else if (n->type == ROFFT_BODY) return 1; - print_otag(h, TAG_H2, ""); + print_otag(h, TAG_H2, "c", "Ss"); return 1; } @@ -510,7 +506,7 @@ man_HP_pre(MAN_ARGS) sui.scale = -sum.scale; print_bvspace(h, n); - print_otag(h, TAG_DIV, "csului", "spacer", &sum, &sui); + print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui); return 1; } @@ -1,4 +1,4 @@ -/* $Id: mandoc.css,v 1.4 2017/01/19 14:29:53 schwarze Exp $ */ +/* $Id: mandoc.css,v 1.5 2017/01/19 15:27:34 schwarze Exp $ */ /* * Standard style sheet for mandoc(1) -Thtml and man.cgi(8). */ @@ -40,17 +40,23 @@ td.foot-date { width: 50%; } td.foot-os { width: 50%; text-align: right; } +/* Sections and paragraphs. */ + +div.manual-text { + margin-left: 5ex; } +h1.Sh { margin-top: 2ex; + margin-bottom: 1ex; + margin-left: -4ex; + font-size: 110%; } +h2.Ss { margin-top: 2ex; + margin-bottom: 1ex; + margin-left: -2ex; + font-size: 105%; } +div.Pp { margin: 1ex 0ex; } -h1 { margin-bottom: 1ex; font-size: 110% } -div.section > h1 { margin-left: -4ex; } /* Section header (Sh, SH). */ -h2 { margin-bottom: 1ex; font-size: 105%; margin-left: -2ex; } /* Sub-section header (Ss, SS). */ -p { } /* Paragraph: Pp, Lp. */ blockquote { margin-left: 5ex; margin-top: 0ex; margin-bottom: 0ex; } /* D1. */ -div.section { margin-bottom: 2ex; margin-left: 5ex; } /* Sections (Sh, SH). */ -div.subsection { } /* Sub-sections (Ss, SS). */ table.synopsis { } /* SYNOPSIS section table. */ -div.spacer { margin: 1em 0; } /* General font modes. */ diff --git a/mdoc_html.c b/mdoc_html.c index 62a319ac..49881ff0 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.252 2017/01/19 13:35:02 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.253 2017/01/19 15:27:34 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -313,7 +313,9 @@ html_mdoc(void *arg, const struct roff_man *mdoc) } mdoc_root_pre(&mdoc->meta, mdoc->first->child, h); + t = print_otag(h, TAG_DIV, "c", "manual-text"); print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h); + print_tagq(h, t); mdoc_root_post(&mdoc->meta, mdoc->first->child, h); print_tagq(h, NULL); } @@ -519,7 +521,6 @@ mdoc_sh_pre(MDOC_ARGS) switch (n->type) { case ROFFT_BLOCK: - print_otag(h, TAG_DIV, "c", "section"); return 1; case ROFFT_BODY: if (n->sec == SEC_AUTHORS) @@ -530,10 +531,10 @@ mdoc_sh_pre(MDOC_ARGS) } if ((id = make_id(n)) != NULL) { - print_otag(h, TAG_H1, "i", id); + print_otag(h, TAG_H1, "ci", "Sh", id); free(id); } else - print_otag(h, TAG_H1, ""); + print_otag(h, TAG_H1, "c", "Sh"); return 1; } @@ -543,17 +544,14 @@ mdoc_ss_pre(MDOC_ARGS) { char *id; - if (n->type == ROFFT_BLOCK) { - print_otag(h, TAG_DIV, "c", "subsection"); - return 1; - } else if (n->type == ROFFT_BODY) + if (n->type != ROFFT_HEAD) return 1; if ((id = make_id(n)) != NULL) { - print_otag(h, TAG_H2, "i", id); + print_otag(h, TAG_H2, "ci", "Ss", id); free(id); } else - print_otag(h, TAG_H2, ""); + print_otag(h, TAG_H2, "c", "Ss"); return 1; } |