? Makefile.depend.patch ? apropos ? article-template.xml ? article1.html ? article1.xml ? cgi.h ? config.h ? config.log ? demandoc ? foo.1 ? foo.man ? foo.ps ? gluPerspective.3 ? gluPerspective.html ? hspaces.diff ? html5.diff ? html5_test2.diff ? makewhatis ? mandoc ? mandoc.1.html ? mandoc.html ? mandocdb ? patch ? preconv ? roff_res_charwidth.patch ? scale.diff ? test-dirent-namlen.dSYM ? test-fgetln.dSYM ? test-fts.dSYM ? test-getsubopt.dSYM ? test-mmap.dSYM ? test-strcasestr.dSYM ? test-strlcat.dSYM ? test-strlcpy.dSYM ? test-strptime.dSYM ? test-strsep.dSYM ? test.1 ? test.1.html ? test.1.ps ? test.2 ? test.2.ps ? test.ps ? testm.ps ? testn.ps ? unit_charwidth.patch Index: html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v retrieving revision 1.162 diff -u -p -r1.162 html.c --- html.c 13 Aug 2014 20:34:29 -0000 1.162 +++ html.c 13 Aug 2014 21:29:43 -0000 @@ -68,13 +68,14 @@ static const struct htmldata htmltags[TA {"dt", HTML_CLRLINE}, /* TAG_DT */ {"dd", HTML_CLRLINE}, /* TAG_DD */ {"blockquote", HTML_CLRLINE}, /* TAG_BLOCKQUOTE */ - {"p", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */ + {"p", HTML_CLRLINE}, /* TAG_P */ {"pre", HTML_CLRLINE }, /* TAG_PRE */ {"b", 0 }, /* TAG_B */ {"i", 0 }, /* TAG_I */ {"code", 0 }, /* TAG_CODE */ {"small", 0 }, /* TAG_SMALL */ {"em", 0 }, /* TAG_EM */ + {"style", HTML_CLRLINE }, /* TAG_STYLE */ }; static const char *const htmlattrs[ATTR_MAX] = { @@ -92,6 +93,7 @@ static const char *const htmlattrs[ATTR_ "summary", /* ATTR_SUMMARY */ "align", /* ATTR_ALIGN */ "colspan", /* ATTR_COLSPAN */ + "charset", /* ATTR_CHARSET */ }; static const char *const roffscales[SCALE_MAX] = { @@ -167,7 +169,7 @@ void * xhtml_alloc(char *outopts) { - return(ml_alloc(outopts, HTML_XHTML_1_0_STRICT)); + return(ml_alloc(outopts, HTML_HTML5)); } void @@ -193,18 +195,47 @@ void print_gen_head(struct html *h) { struct htmlpair tag[4]; + struct tag *t; - tag[0].key = ATTR_HTTPEQUIV; - tag[0].val = "Content-Type"; - tag[1].key = ATTR_CONTENT; - tag[1].val = "text/html; charset=utf-8"; - print_otag(h, TAG_META, 2, tag); - - tag[0].key = ATTR_NAME; - tag[0].val = "resource-type"; - tag[1].key = ATTR_CONTENT; - tag[1].val = "document"; - print_otag(h, TAG_META, 2, tag); + if (HTML_HTML5 == h->type) { + tag[0].key = ATTR_CHARSET; + tag[0].val = "utf-8"; + print_otag(h, TAG_META, 1, tag); + } else { + tag[0].key = ATTR_HTTPEQUIV; + tag[0].val = "Content-Type"; + tag[1].key = ATTR_CONTENT; + tag[1].val = "text/html; charset=utf-8"; + print_otag(h, TAG_META, 2, tag); + + tag[0].key = ATTR_NAME; + tag[0].val = "resource-type"; + tag[1].key = ATTR_CONTENT; + tag[1].val = "document"; + print_otag(h, TAG_META, 2, tag); + } + + if (HTML_HTML5 == h->type) { + /* + * To preserve the general look of a manual, we begin + * with some default CSS rules for the header and + * footer. + * Put these before the so that any CSS file + * will override them. + */ + t = print_otag(h, TAG_STYLE, 0, NULL); + print_text(h, + "table.head, table.foot { width: 100%; }\n" + "table.head td:last-child, " + "table.foot td:last-child " + "{ text-align: right; }\n" + "table.head td.head-ltitle.head-rtitle " + "{ width: 10%; }\n" + "table.head td.head-vol " + "{ width: 80%; text-align: center; }\n" + "table.foot td { width: 50%; }\n"); + print_tagq(h, t); + } if (h->style) { tag[0].key = ATTR_REL; @@ -216,7 +247,7 @@ print_gen_head(struct html *h) tag[3].key = ATTR_MEDIA; tag[3].val = "all"; print_otag(h, TAG_LINK, 4, tag); - } + } } static void @@ -506,6 +537,7 @@ print_otag(struct html *h, enum htmltag if (HTML_AUTOCLOSE & htmltags[tag].flags) switch (h->type) { + case HTML_HTML5: case HTML_XHTML_1_0_STRICT: putchar('/'); break; @@ -542,6 +574,9 @@ print_gen_decls(struct html *h) const char *name; switch (h->type) { + case HTML_HTML5: + puts(""); + return; case HTML_HTML_4_01_STRICT: name = "HTML"; doctype = "-//W3C//DTD HTML 4.01//EN"; Index: html.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.h,v retrieving revision 1.52 diff -u -p -r1.52 html.h --- html.h 13 Aug 2014 15:25:22 -0000 1.52 +++ html.h 13 Aug 2014 21:29:43 -0000 @@ -51,6 +51,7 @@ enum htmltag { TAG_CODE, TAG_SMALL, TAG_EM, + TAG_STYLE, TAG_MAX }; @@ -69,6 +70,7 @@ enum htmlattr { ATTR_SUMMARY, ATTR_ALIGN, ATTR_COLSPAN, + ATTR_CHARSET, ATTR_MAX }; @@ -108,7 +110,8 @@ struct htmlpair { enum htmltype { HTML_HTML_4_01_STRICT, - HTML_XHTML_1_0_STRICT + HTML_XHTML_1_0_STRICT, + HTML_HTML5 }; struct html { Index: man_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v retrieving revision 1.97 diff -u -p -r1.97 man_html.c --- man_html.c 10 Aug 2014 23:54:41 -0000 1.97 +++ man_html.c 13 Aug 2014 21:29:44 -0000 @@ -307,14 +307,19 @@ man_root_pre(MAN_ARGS) assert(man->msec); mandoc_asprintf(&title, "%s(%s)", man->title, man->msec); - PAIR_SUMMARY_INIT(&tag[0], "Document Header"); - PAIR_CLASS_INIT(&tag[1], "head"); - PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); - t = print_otag(h, TAG_TABLE, 3, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + if (h->type != HTML_HTML5) { + PAIR_SUMMARY_INIT(&tag[0], "Document Header"); + PAIR_CLASS_INIT(&tag[1], "head"); + PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); + t = print_otag(h, TAG_TABLE, 3, tag); + PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + } else { + PAIR_CLASS_INIT(&tag[0], "head"); + t = print_otag(h, TAG_TABLE, 1, tag); + } print_otag(h, TAG_TBODY, 0, NULL); @@ -326,15 +331,21 @@ man_root_pre(MAN_ARGS) print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-vol"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); if (NULL != man->vol) print_text(h, man->vol); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); print_text(h, title); print_tagq(h, t); free(title); @@ -346,13 +357,18 @@ man_root_post(MAN_ARGS) struct htmlpair tag[3]; struct tag *t, *tt; - PAIR_SUMMARY_INIT(&tag[0], "Document Footer"); - PAIR_CLASS_INIT(&tag[1], "foot"); - PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); - t = print_otag(h, TAG_TABLE, 3, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + if (h->type != HTML_HTML5) { + PAIR_SUMMARY_INIT(&tag[0], "Document Footer"); + PAIR_CLASS_INIT(&tag[1], "foot"); + PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); + t = print_otag(h, TAG_TABLE, 3, tag); + PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + } else { + PAIR_CLASS_INIT(&tag[0], "foot"); + t = print_otag(h, TAG_TABLE, 1, tag); + } tt = print_otag(h, TAG_TR, 0, NULL); @@ -364,8 +380,11 @@ man_root_post(MAN_ARGS) print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "foot-os"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); if (man->source) print_text(h, man->source); Index: mdoc_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v retrieving revision 1.197 diff -u -p -r1.197 mdoc_html.c --- mdoc_html.c 13 Aug 2014 15:25:22 -0000 1.197 +++ mdoc_html.c 13 Aug 2014 21:29:44 -0000 @@ -487,13 +487,18 @@ mdoc_root_post(MDOC_ARGS) struct htmlpair tag[3]; struct tag *t, *tt; - PAIR_SUMMARY_INIT(&tag[0], "Document Footer"); - PAIR_CLASS_INIT(&tag[1], "foot"); - PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); - t = print_otag(h, TAG_TABLE, 3, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + if (HTML_HTML5 != h->type) { + PAIR_SUMMARY_INIT(&tag[0], "Document Footer"); + PAIR_CLASS_INIT(&tag[1], "foot"); + PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); + t = print_otag(h, TAG_TABLE, 3, tag); + PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + } else { + PAIR_CLASS_INIT(&tag[0], "foot"); + t = print_otag(h, TAG_TABLE, 1, tag); + } print_otag(h, TAG_TBODY, 0, NULL); @@ -505,8 +510,11 @@ mdoc_root_post(MDOC_ARGS) print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "foot-os"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); print_text(h, meta->os); print_tagq(h, t); } @@ -530,14 +538,19 @@ mdoc_root_pre(MDOC_ARGS) mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); - PAIR_SUMMARY_INIT(&tag[0], "Document Header"); - PAIR_CLASS_INIT(&tag[1], "head"); - PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); - t = print_otag(h, TAG_TABLE, 3, tag); - PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); - print_otag(h, TAG_COL, 1, tag); + if (HTML_HTML5 != h->type) { + PAIR_SUMMARY_INIT(&tag[0], "Document Header"); + PAIR_CLASS_INIT(&tag[1], "head"); + PAIR_INIT(&tag[2], ATTR_WIDTH, "100%"); + t = print_otag(h, TAG_TABLE, 3, tag); + PAIR_INIT(&tag[0], ATTR_WIDTH, "30%"); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + print_otag(h, TAG_COL, 1, tag); + } else { + PAIR_CLASS_INIT(&tag[0], "head"); + t = print_otag(h, TAG_TABLE, 1, tag); + } print_otag(h, TAG_TBODY, 0, NULL); @@ -549,14 +562,20 @@ mdoc_root_pre(MDOC_ARGS) print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-vol"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); print_text(h, volume); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); - PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); - print_otag(h, TAG_TD, 2, tag); + if (HTML_HTML5 != h->type) { + PAIR_INIT(&tag[1], ATTR_ALIGN, "right"); + print_otag(h, TAG_TD, 2, tag); + } else + print_otag(h, TAG_TD, 1, tag); print_text(h, title); print_tagq(h, t);