=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.122 retrieving revision 1.125 diff -u -p -r1.122 -r1.125 --- mandoc/html.c 2010/12/24 00:46:49 1.122 +++ mandoc/html.c 2011/01/13 14:30:13 1.125 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.122 2010/12/24 00:46:49 kristaps Exp $ */ +/* $Id: html.c,v 1.125 2011/01/13 14:30:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -72,7 +72,6 @@ static const struct htmldata htmltags[TAG_MAX] = { {"pre", HTML_CLRLINE }, /* TAG_PRE */ {"b", 0 }, /* TAG_B */ {"i", 0 }, /* TAG_I */ - {"u", 0 }, /* TAG_U */ {"code", 0 }, /* TAG_CODE */ {"small", 0 }, /* TAG_SMALL */ }; @@ -91,6 +90,7 @@ static const char *const htmlattrs[ATTR_MAX] = { "id", /* ATTR_ID */ "summary", /* ATTR_SUMMARY */ "align", /* ATTR_ALIGN */ + "colspan", /* ATTR_COLSPAN */ }; static void print_spec(struct html *, enum roffdeco, @@ -582,8 +582,14 @@ print_tagq(struct html *h, const struct tag *until) struct tag *tag; while ((tag = h->tags.head) != NULL) { + /* + * Remember to close out and nullify the current + * meta-font and table, if applicable. + */ if (tag == h->metaf) h->metaf = NULL; + if (tag == h->tblt) + h->tblt = NULL; print_ctag(h, tag->tag); h->tags.head = tag->next; free(tag); @@ -601,8 +607,14 @@ print_stagq(struct html *h, const struct tag *suntil) while ((tag = h->tags.head) != NULL) { if (suntil && tag == suntil) return; + /* + * Remember to close out and nullify the current + * meta-font and table, if applicable. + */ if (tag == h->metaf) h->metaf = NULL; + if (tag == h->tblt) + h->tblt = NULL; print_ctag(h, tag->tag); h->tags.head = tag->next; free(tag); @@ -772,20 +784,24 @@ html_idcat(char *dst, const char *src, int sz) { int ssz; - assert(sz); + assert(sz > 2); /* Cf. . */ - for ( ; *dst != '\0' && sz; dst++, sz--) - /* Jump to end. */ ; - - assert(sz > 2); - /* We can't start with a number (bah). */ - *dst++ = 'x'; - *dst = '\0'; - sz--; + if ('#' == *dst) { + dst++; + sz--; + } + if ('\0' == *dst) { + *dst++ = 'x'; + *dst = '\0'; + sz--; + } + + for ( ; *dst != '\0' && sz; dst++, sz--) + /* Jump to end. */ ; for ( ; *src != '\0' && sz > 1; src++) { ssz = snprintf(dst, (size_t)sz, "%.2x", *src);