=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_html.c,v retrieving revision 1.41 retrieving revision 1.42 diff -c -r1.41 -r1.42 *** src/usr.bin/mandoc/mdoc_html.c 2010/12/19 12:18:15 1.41 --- src/usr.bin/mandoc/mdoc_html.c 2010/12/22 00:33:25 1.42 *************** *** 1,4 **** ! /* $Id: mdoc_html.c,v 1.41 2010/12/19 12:18:15 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: mdoc_html.c,v 1.42 2010/12/22 00:33:25 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * *************** *** 459,474 **** static void mdoc_root_post(MDOC_ARGS) { ! struct htmlpair tag[2]; struct tag *t, *tt; char b[DATESIZ]; time2a(m->date, b, DATESIZ); ! PAIR_CLASS_INIT(&tag[0], "foot"); ! PAIR_SUMMARY_INIT(&tag[1], "Document Footer"); ! t = print_otag(h, TAG_TABLE, 2, tag); tt = print_otag(h, TAG_TR, 0, NULL); PAIR_CLASS_INIT(&tag[0], "foot-date"); --- 459,483 ---- static void mdoc_root_post(MDOC_ARGS) { ! struct htmlpair tag[3]; struct tag *t, *tt; char b[DATESIZ]; time2a(m->date, b, DATESIZ); ! PAIR_SUMMARY_INIT(&tag[0], "Document Footer"); ! PAIR_CLASS_INIT(&tag[1], "foot"); ! if (NULL == h->style) { ! PAIR_INIT(&tag[1], ATTR_WIDTH, "100%"); ! t = print_otag(h, TAG_TABLE, 2, tag); ! PAIR_INIT(&tag[0], ATTR_WIDTH, "50%"); ! print_otag(h, TAG_COL, 1, tag); ! print_otag(h, TAG_COL, 1, tag); ! } else ! t = print_otag(h, TAG_TABLE, 2, tag); + t = print_otag(h, TAG_TBODY, 0, NULL); + tt = print_otag(h, TAG_TR, 0, NULL); PAIR_CLASS_INIT(&tag[0], "foot-date"); *************** *** 478,484 **** print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "foot-os"); ! print_otag(h, TAG_TD, 1, tag); print_text(h, m->os); print_tagq(h, t); --- 487,497 ---- print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "foot-os"); ! if (NULL == h->style) { ! 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, m->os); print_tagq(h, t); *************** *** 503,512 **** snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec); ! PAIR_CLASS_INIT(&tag[0], "head"); ! PAIR_SUMMARY_INIT(&tag[1], "Document Header"); ! t = print_otag(h, TAG_TABLE, 2, tag); tt = print_otag(h, TAG_TR, 0, NULL); PAIR_CLASS_INIT(&tag[0], "head-ltitle"); --- 516,535 ---- snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec); ! PAIR_SUMMARY_INIT(&tag[0], "Document Header"); ! PAIR_CLASS_INIT(&tag[1], "head"); ! if (NULL == h->style) { ! 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 ! t = print_otag(h, TAG_TABLE, 2, tag); + print_otag(h, TAG_TBODY, 0, NULL); + tt = print_otag(h, TAG_TR, 0, NULL); PAIR_CLASS_INIT(&tag[0], "head-ltitle"); *************** *** 516,528 **** print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-vol"); ! print_otag(h, TAG_TD, 1, tag); print_text(h, b); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); ! print_otag(h, TAG_TD, 1, tag); print_text(h, title); print_tagq(h, t); --- 539,559 ---- print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-vol"); ! if (NULL == h->style) { ! 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, b); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); ! if (NULL == h->style) { ! 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); *************** *** 591,597 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "flag"); ! print_otag(h, TAG_SPAN, 1, &tag); /* `Cm' has no leading hyphen. */ --- 622,628 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "flag"); ! print_otag(h, TAG_B, 1, &tag); /* `Cm' has no leading hyphen. */ *************** *** 638,644 **** case (MDOC_ELEM): synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "name"); ! print_otag(h, TAG_SPAN, 1, &tag); if (NULL == n->child && m->name) print_text(h, m->name); return(1); --- 669,675 ---- case (MDOC_ELEM): synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "name"); ! print_otag(h, TAG_B, 1, &tag); if (NULL == n->child && m->name) print_text(h, m->name); return(1); *************** *** 730,736 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "arg"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 761,767 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "arg"); ! print_otag(h, TAG_I, 1, &tag); return(1); } *************** *** 836,841 **** --- 867,876 ---- bufcat_su(h, "margin-top", &su); PAIR_STYLE_INIT(&tag[1], h); print_otag(h, TAG_DT, 2, tag); + if (LIST_diag != type) + break; + PAIR_CLASS_INIT(&tag[0], "diag"); + print_otag(h, TAG_B, 1, tag); break; case(LIST_column): break; *************** *** 905,910 **** --- 940,946 ---- size_t i; struct htmlpair tag[3]; struct roffsu su; + char buf[BUFSIZ]; if (MDOC_BODY == n->type) { if (LIST_column == n->data.Bl->type) *************** *** 943,961 **** PAIR_STYLE_INIT(&tag[0], h); assert(lists[n->data.Bl->type]); ! bufinit(h); ! bufcat(h, "list "); ! bufcat(h, lists[n->data.Bl->type]); ! PAIR_INIT(&tag[1], ATTR_CLASS, h->buf); ! i = 2; /* Set the block's left-hand margin. */ if (n->data.Bl->offs) { a2offs(n->data.Bl->offs, &su); bufcat_su(h, "margin-left", &su); - PAIR_STYLE_INIT(&tag[2], h); - i = 3; } switch (n->data.Bl->type) { --- 979,993 ---- PAIR_STYLE_INIT(&tag[0], h); assert(lists[n->data.Bl->type]); ! strlcpy(buf, "list ", BUFSIZ); ! strlcat(buf, lists[n->data.Bl->type], BUFSIZ); ! PAIR_INIT(&tag[1], ATTR_CLASS, buf); /* Set the block's left-hand margin. */ if (n->data.Bl->offs) { a2offs(n->data.Bl->offs, &su); bufcat_su(h, "margin-left", &su); } switch (n->data.Bl->type) { *************** *** 966,975 **** case(LIST_hyphen): /* FALLTHROUGH */ case(LIST_item): ! print_otag(h, TAG_UL, i, tag); break; case(LIST_enum): ! print_otag(h, TAG_OL, i, tag); break; case(LIST_diag): /* FALLTHROUGH */ --- 998,1007 ---- case(LIST_hyphen): /* FALLTHROUGH */ case(LIST_item): ! print_otag(h, TAG_UL, 2, tag); break; case(LIST_enum): ! print_otag(h, TAG_OL, 2, tag); break; case(LIST_diag): /* FALLTHROUGH */ *************** *** 980,989 **** case(LIST_ohang): /* FALLTHROUGH */ case(LIST_tag): ! print_otag(h, TAG_DL, i, tag); break; case(LIST_column): ! print_otag(h, TAG_TABLE, i, tag); break; default: abort(); --- 1012,1021 ---- case(LIST_ohang): /* FALLTHROUGH */ case(LIST_tag): ! print_otag(h, TAG_DL, 2, tag); break; case(LIST_column): ! print_otag(h, TAG_TABLE, 2, tag); break; default: abort(); *************** *** 1008,1014 **** print_text(h, "The"); for (nn = n->child; nn; nn = nn->next) { ! t = print_otag(h, TAG_SPAN, 1, &tag); print_text(h, nn->string); print_tagq(h, t); --- 1040,1046 ---- print_text(h, "The"); for (nn = n->child; nn; nn = nn->next) { ! t = print_otag(h, TAG_B, 1, &tag); print_text(h, nn->string); print_tagq(h, t); *************** *** 1090,1095 **** --- 1122,1128 ---- PAIR_CLASS_INIT(&tag[0], "link-sec"); PAIR_HREF_INIT(&tag[1], buf); + print_otag(h, TAG_I, 1, tag); print_otag(h, TAG_A, 2, tag); return(1); } *************** *** 1186,1192 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "file"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1219,1225 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "file"); ! print_otag(h, TAG_I, 1, &tag); return(1); } *************** *** 1198,1204 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "addr"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1231,1237 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "addr"); ! print_otag(h, TAG_I, 1, &tag); return(1); } *************** *** 1225,1231 **** synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "config"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1258,1264 ---- synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "config"); ! print_otag(h, TAG_B, 1, &tag); return(1); } *************** *** 1276,1287 **** PAIR_CLASS_INIT(&tag, "farg"); if (n->parent->tok != MDOC_Fo) { ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } for (nn = n->child; nn; nn = nn->next) { ! t = print_otag(h, TAG_SPAN, 1, &tag); print_text(h, nn->string); print_tagq(h, t); if (nn->next) --- 1309,1320 ---- PAIR_CLASS_INIT(&tag, "farg"); if (n->parent->tok != MDOC_Fo) { ! print_otag(h, TAG_I, 1, &tag); return(1); } for (nn = n->child; nn; nn = nn->next) { ! t = print_otag(h, TAG_I, 1, &tag); print_text(h, nn->string); print_tagq(h, t); if (nn->next) *************** *** 1304,1310 **** synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "macro"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1337,1343 ---- synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "macro"); ! print_otag(h, TAG_B, 1, &tag); return(1); } *************** *** 1337,1343 **** synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "ftype"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1370,1376 ---- synopsis_pre(h, n); PAIR_CLASS_INIT(&tag, "ftype"); ! print_otag(h, TAG_I, 1, &tag); return(1); } *************** *** 1362,1368 **** ep = strchr(sp, ' '); if (NULL != ep) { PAIR_CLASS_INIT(&tag[0], "ftype"); ! t = print_otag(h, TAG_SPAN, 1, tag); while (ep) { sz = MIN((int)(ep - sp), BUFSIZ - 1); --- 1395,1401 ---- ep = strchr(sp, ' '); if (NULL != ep) { PAIR_CLASS_INIT(&tag[0], "ftype"); ! t = print_otag(h, TAG_I, 1, tag); while (ep) { sz = MIN((int)(ep - sp), BUFSIZ - 1); *************** *** 1393,1399 **** } #endif ! t = print_otag(h, TAG_SPAN, 1, tag); if (sp) { strlcpy(nbuf, sp, BUFSIZ); --- 1426,1432 ---- } #endif ! t = print_otag(h, TAG_B, 1, tag); if (sp) { strlcpy(nbuf, sp, BUFSIZ); *************** *** 1414,1420 **** i = 1; if (MDOC_SYNPRETTY & n->flags) i = 2; ! t = print_otag(h, TAG_SPAN, i, tag); print_text(h, nn->string); print_tagq(h, t); if (nn->next) --- 1447,1453 ---- i = 1; if (MDOC_SYNPRETTY & n->flags) i = 2; ! t = print_otag(h, TAG_I, i, tag); print_text(h, nn->string); print_tagq(h, t); if (nn->next) *************** *** 1591,1597 **** synopsis_pre(h, n); PAIR_CLASS_INIT(&tag[0], "includes"); ! print_otag(h, TAG_SPAN, 1, tag); if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) print_text(h, "#include"); --- 1624,1630 ---- synopsis_pre(h, n); PAIR_CLASS_INIT(&tag[0], "includes"); ! print_otag(h, TAG_B, 1, tag); if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) print_text(h, "#include"); *************** *** 1627,1633 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "cmd"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1660,1666 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "cmd"); ! print_otag(h, TAG_B, 1, &tag); return(1); } *************** *** 1669,1675 **** "-1 is returned and the global variable"); PAIR_CLASS_INIT(&tag, "var"); ! t = print_otag(h, TAG_SPAN, 1, &tag); print_text(h, "errno"); print_tagq(h, t); print_text(h, "is set to indicate the error."); --- 1702,1708 ---- "-1 is returned and the global variable"); PAIR_CLASS_INIT(&tag, "var"); ! t = print_otag(h, TAG_B, 1, &tag); print_text(h, "errno"); print_tagq(h, t); print_text(h, "is set to indicate the error."); *************** *** 1684,1690 **** struct htmlpair tag; PAIR_CLASS_INIT(&tag, "var"); ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 1717,1723 ---- struct htmlpair tag; PAIR_CLASS_INIT(&tag, "var"); ! print_otag(h, TAG_B, 1, &tag); return(1); } *************** *** 1852,1858 **** --- 1885,1894 ---- mdoc__x_pre(MDOC_ARGS) { struct htmlpair tag[2]; + enum htmltag t; + t = TAG_SPAN; + switch (n->tok) { case(MDOC__A): PAIR_CLASS_INIT(&tag[0], "ref-auth"); *************** *** 1862,1867 **** --- 1898,1904 ---- break; case(MDOC__B): PAIR_CLASS_INIT(&tag[0], "ref-book"); + t = TAG_I; break; case(MDOC__C): PAIR_CLASS_INIT(&tag[0], "ref-city"); *************** *** 1871,1879 **** --- 1908,1918 ---- break; case(MDOC__I): PAIR_CLASS_INIT(&tag[0], "ref-issue"); + t = TAG_I; break; case(MDOC__J): PAIR_CLASS_INIT(&tag[0], "ref-jrnl"); + t = TAG_I; break; case(MDOC__N): PAIR_CLASS_INIT(&tag[0], "ref-num"); *************** *** 1892,1897 **** --- 1931,1937 ---- break; case(MDOC__T): PAIR_CLASS_INIT(&tag[0], "ref-title"); + t = TAG_U; break; case(MDOC__U): PAIR_CLASS_INIT(&tag[0], "link-ref"); *************** *** 1905,1911 **** } if (MDOC__U != n->tok) { ! print_otag(h, TAG_SPAN, 1, tag); return(1); } --- 1945,1951 ---- } if (MDOC__U != n->tok) { ! print_otag(h, t, 1, tag); return(1); }