=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.66 retrieving revision 1.71 diff -u -p -r1.66 -r1.71 --- mandoc/html.c 2009/10/26 08:18:15 1.66 +++ mandoc/html.c 2009/10/30 04:57:17 1.71 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.66 2009/10/26 08:18:15 kristaps Exp $ */ +/* $Id: html.c,v 1.71 2009/10/30 04:57:17 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -80,6 +81,7 @@ static const char *const htmlattrs[ATTR_MAX] = { "valign", "target", "id", + "summary", }; #ifdef __linux__ @@ -389,11 +391,11 @@ print_ctag(struct html *h, enum htmltag tag) { printf("", htmltags[tag].name); - if (HTML_CLRLINE & htmltags[tag].flags) + if (HTML_CLRLINE & htmltags[tag].flags) { h->flags |= HTML_NOSPACE; - if (HTML_CLRLINE & htmltags[tag].flags) h->flags |= HTML_NEWLINE; - else + printf("\n"); + } else h->flags &= ~HTML_NEWLINE; } @@ -647,3 +649,30 @@ bufcat_su(struct html *h, const char *p, const struct buffmt(h, "%s: %d%s;", p, (int)v, u); } + +void +html_idcat(char *dst, const char *src, int sz) +{ + int ssz; + + assert(sz); + + /* 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--; + + for ( ; *src != '\0' && sz > 1; src++) { + ssz = snprintf(dst, sz, "%.2x", *src); + sz -= ssz; + dst += ssz; + } +}