From 7e120ae54929e67f6c54d41ad0789f48600cfb3a Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 19 Jan 2017 13:35:02 +0000 Subject: Start cleanup: trim useless HTML comments,
elements, and CSS rules on the and levels. --- cgi.c | 13 ++++--------- man_html.c | 16 +++++++--------- mandoc.css | 41 +++++++++++++++++++---------------------- mdoc_html.c | 16 +++++++--------- 4 files changed, 37 insertions(+), 49 deletions(-) diff --git a/cgi.c b/cgi.c index 214f7152..5f8683b8 100644 --- a/cgi.c +++ b/cgi.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons - * Copyright (c) 2014, 2015, 2016 Ingo Schwarze + * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -356,8 +356,7 @@ resp_begin_html(int code, const char *msg) " type=\"text/css\" media=\"all\">\n" "%s\n" "\n" - "\n" - "\n", + "\n", CSS_DIR, CUSTOMIZE_TITLE); resp_copy(MAN_DIR "/header.html"); @@ -378,9 +377,7 @@ resp_searchform(const struct req *req, enum focus focus) { int i; - puts(""); - printf("
\n" - "
\n" + printf("\n" "
\n" "Manual Page Search Parameters\n", scriptname); @@ -448,9 +445,7 @@ resp_searchform(const struct req *req, enum focus focus) } puts("
\n" - "
\n" - "
"); - puts(""); + ""); } static int diff --git a/man_html.c b/man_html.c index bf552e88..77650d89 100644 --- a/man_html.c +++ b/man_html.c @@ -148,24 +148,22 @@ html_man(void *arg, const struct roff_man *man) { struct mhtml mh; struct html *h; - struct tag *t, *tt; + struct tag *t; memset(&mh, 0, sizeof(mh)); h = (struct html *)arg; - if ( ! (HTML_FRAGMENT & h->oflags)) { + if ((h->oflags & HTML_FRAGMENT) == 0) { print_gen_decls(h); - t = print_otag(h, TAG_HTML, ""); - tt = print_otag(h, TAG_HEAD, ""); + print_otag(h, TAG_HTML, ""); + t = print_otag(h, TAG_HEAD, ""); print_man_head(&man->meta, man->first, &mh, h); - print_tagq(h, tt); + print_tagq(h, t); print_otag(h, TAG_BODY, ""); - print_otag(h, TAG_DIV, "c", "mandoc"); - } else - t = print_otag(h, TAG_DIV, "c", "mandoc"); + } print_man_nodelist(&man->meta, man->first, &mh, h); - print_tagq(h, t); + print_tagq(h, NULL); } static void diff --git a/mandoc.css b/mandoc.css index d5ba3c48..44d956bb 100644 --- a/mandoc.css +++ b/mandoc.css @@ -1,29 +1,26 @@ /* $Id$ */ - /* - * This is an example style-sheet provided for mandoc(1) and the -Thtml - * or -Txhtml output mode. - * - * It mimics the appearance of the traditional cvsweb output. - * - * See mdoc(7) and man(7) for macro explanations. + * Standard style sheet for mandoc(1) -Thtml and man.cgi(8). */ -html { max-width: 880px; margin-left: 1em; } -body { font-size: smaller; font-family: Helvetica,Arial,sans-serif; } -body > div { padding-left: 2em; - padding-top: 1em; } -body > div.mandoc, -body > div#mancgi { padding-left: 0em; - padding-top: 0em; } -body > div.results { font-size: smaller; } -#mancgi fieldset { text-align: center; - border: thin solid silver; - border-radius: 1em; - font-size: small; } -#mancgi input[name=expr] { width: 25%; } -.results td.title { vertical-align: top; - padding-right: 1em; } +/* Global defaults. */ + +html { max-width: 100ex; } +body { font-family: Helvetica,Arial,sans-serif; } + +/* Search form and search results. */ + +fieldset { border: thin solid silver; + border-radius: 1em; + text-align: center; } +input[name=expr] { + width: 25%; } + +div.results { margin-top: 1em; + margin-left: 2em; + font-size: smaller; } + + 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). */ diff --git a/mdoc_html.c b/mdoc_html.c index a3916945..d90e6447 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -299,25 +299,23 @@ void html_mdoc(void *arg, const struct roff_man *mdoc) { struct html *h; - struct tag *t, *tt; + struct tag *t; h = (struct html *)arg; - if ( ! (HTML_FRAGMENT & h->oflags)) { + if ((h->oflags & HTML_FRAGMENT) == 0) { print_gen_decls(h); - t = print_otag(h, TAG_HTML, ""); - tt = print_otag(h, TAG_HEAD, ""); + print_otag(h, TAG_HTML, ""); + t = print_otag(h, TAG_HEAD, ""); print_mdoc_head(&mdoc->meta, mdoc->first->child, h); - print_tagq(h, tt); + print_tagq(h, t); print_otag(h, TAG_BODY, ""); - print_otag(h, TAG_DIV, "c", "mandoc"); - } else - t = print_otag(h, TAG_DIV, "c", "mandoc"); + } mdoc_root_pre(&mdoc->meta, mdoc->first->child, h); print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h); mdoc_root_post(&mdoc->meta, mdoc->first->child, h); - print_tagq(h, t); + print_tagq(h, NULL); } static void -- cgit