=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_html.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/mandoc/mdoc_html.c 2009/10/21 19:13:50 1.1 --- src/usr.bin/mandoc/mdoc_html.c 2009/10/27 21:40:07 1.2 *************** *** 1,4 **** ! /* $Id: mdoc_html.c,v 1.1 2009/10/21 19:13:50 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: mdoc_html.c,v 1.2 2009/10/27 21:40:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 16,22 **** */ #include #include - #include #include #include --- 16,21 ---- *************** *** 249,254 **** --- 248,254 ---- {mdoc__x_pre, mdoc__x_post}, /* %Q */ {mdoc_sp_pre, NULL}, /* br */ {mdoc_sp_pre, NULL}, /* sp */ + {mdoc__x_pre, mdoc__x_post}, /* %U */ }; *************** *** 411,417 **** struct tag *t; child = 1; ! t = SLIST_FIRST(&h->tags); bufinit(h); switch (n->type) { --- 411,417 ---- struct tag *t; child = 1; ! t = h->tags.head; bufinit(h); switch (n->type) { *************** *** 451,472 **** static void mdoc_root_post(MDOC_ARGS) { - struct tm tm; struct htmlpair tag[2]; struct tag *t, *tt; ! char b[BUFSIZ]; /* * XXX: this should use divs, but in Firefox, divs with nested * divs for some reason puke when trying to put a border line * below. So I use tables, instead. */ - (void)localtime_r(&m->date, &tm); - - if (0 == strftime(b, BUFSIZ - 1, "%B %e, %Y", &tm)) - err(EXIT_FAILURE, "strftime"); - PAIR_CLASS_INIT(&tag[0], "footer"); bufcat_style(h, "width", "100%"); PAIR_STYLE_INIT(&tag[1], h); --- 451,468 ---- static void mdoc_root_post(MDOC_ARGS) { struct htmlpair tag[2]; struct tag *t, *tt; ! char b[DATESIZ]; + time2a(m->date, b, DATESIZ); + /* * XXX: this should use divs, but in Firefox, divs with nested * divs for some reason puke when trying to put a border line * below. So I use tables, instead. */ PAIR_CLASS_INIT(&tag[0], "footer"); bufcat_style(h, "width", "100%"); PAIR_STYLE_INIT(&tag[1], h); *************** *** 979,985 **** print_otag(h, TAG_SPAN, 1, &tag); break; case (MDOC_Enum): ! ord = SLIST_FIRST(&h->ords); assert(ord); nbuf[BUFSIZ - 1] = 0; (void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++); --- 975,981 ---- print_otag(h, TAG_SPAN, 1, &tag); break; case (MDOC_Enum): ! ord = h->ords.head; assert(ord); nbuf[BUFSIZ - 1] = 0; (void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++); *************** *** 1114,1120 **** err(EXIT_FAILURE, "malloc"); ord->cookie = n; ord->pos = 1; ! SLIST_INSERT_HEAD(&h->ords, ord, entry); return(1); } --- 1110,1117 ---- err(EXIT_FAILURE, "malloc"); ord->cookie = n; ord->pos = 1; ! ord->next = h->ords.head; ! h->ords.head = ord; return(1); } *************** *** 1130,1138 **** if (MDOC_Enum != a2list(n)) return; ! ord = SLIST_FIRST(&h->ords); assert(ord); ! SLIST_REMOVE_HEAD(&h->ords, entry); free(ord); } --- 1127,1135 ---- if (MDOC_Enum != a2list(n)) return; ! ord = h->ords.head; assert(ord); ! h->ords.head = ord->next; free(ord); } *************** *** 1755,1760 **** --- 1752,1760 ---- tag[1].val = nn->string; print_otag(h, TAG_A, 2, tag); + if (NULL == nn->next) + return(1); + for (nn = nn->next; nn; nn = nn->next) print_text(h, nn->string); *************** *** 2145,2200 **** static int mdoc__x_pre(MDOC_ARGS) { ! struct htmlpair tag; switch (n->tok) { case(MDOC__A): ! PAIR_CLASS_INIT(&tag, "ref-auth"); break; case(MDOC__B): ! PAIR_CLASS_INIT(&tag, "ref-book"); break; case(MDOC__C): ! PAIR_CLASS_INIT(&tag, "ref-city"); break; case(MDOC__D): ! PAIR_CLASS_INIT(&tag, "ref-date"); break; case(MDOC__I): ! PAIR_CLASS_INIT(&tag, "ref-issue"); break; case(MDOC__J): ! PAIR_CLASS_INIT(&tag, "ref-jrnl"); break; case(MDOC__N): ! PAIR_CLASS_INIT(&tag, "ref-num"); break; case(MDOC__O): ! PAIR_CLASS_INIT(&tag, "ref-opt"); break; case(MDOC__P): ! PAIR_CLASS_INIT(&tag, "ref-page"); break; case(MDOC__Q): ! PAIR_CLASS_INIT(&tag, "ref-corp"); break; case(MDOC__R): ! PAIR_CLASS_INIT(&tag, "ref-rep"); break; case(MDOC__T): ! PAIR_CLASS_INIT(&tag, "ref-title"); print_text(h, "\\(lq"); h->flags |= HTML_NOSPACE; break; case(MDOC__V): ! PAIR_CLASS_INIT(&tag, "ref-vol"); break; default: abort(); /* NOTREACHED */ } ! print_otag(h, TAG_SPAN, 1, &tag); return(1); } --- 2145,2209 ---- static int mdoc__x_pre(MDOC_ARGS) { ! struct htmlpair tag[2]; switch (n->tok) { case(MDOC__A): ! PAIR_CLASS_INIT(&tag[0], "ref-auth"); break; case(MDOC__B): ! PAIR_CLASS_INIT(&tag[0], "ref-book"); break; case(MDOC__C): ! PAIR_CLASS_INIT(&tag[0], "ref-city"); break; case(MDOC__D): ! PAIR_CLASS_INIT(&tag[0], "ref-date"); break; case(MDOC__I): ! PAIR_CLASS_INIT(&tag[0], "ref-issue"); break; case(MDOC__J): ! PAIR_CLASS_INIT(&tag[0], "ref-jrnl"); break; case(MDOC__N): ! PAIR_CLASS_INIT(&tag[0], "ref-num"); break; case(MDOC__O): ! PAIR_CLASS_INIT(&tag[0], "ref-opt"); break; case(MDOC__P): ! PAIR_CLASS_INIT(&tag[0], "ref-page"); break; case(MDOC__Q): ! PAIR_CLASS_INIT(&tag[0], "ref-corp"); break; case(MDOC__R): ! PAIR_CLASS_INIT(&tag[0], "ref-rep"); break; case(MDOC__T): ! PAIR_CLASS_INIT(&tag[0], "ref-title"); print_text(h, "\\(lq"); h->flags |= HTML_NOSPACE; break; + case(MDOC__U): + PAIR_CLASS_INIT(&tag[0], "link-ref"); + break; case(MDOC__V): ! PAIR_CLASS_INIT(&tag[0], "ref-vol"); break; default: abort(); /* NOTREACHED */ } ! if (MDOC__U != n->tok) { ! print_otag(h, TAG_SPAN, 1, tag); ! return(1); ! } ! ! PAIR_HREF_INIT(&tag[1], n->child->string); ! print_otag(h, TAG_A, 2, tag); return(1); }