summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-28 08:00:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-28 08:00:17 +0000
commitb54610ec3ea88d830ee9843b468ad8f396ef41ab (patch)
tree28cdc0bcf547a7b145eb264cc0c9a4b02919a747 /html.c
parent727efc61ff79f9a152dc0ec1ff6aae25907a32fb (diff)
downloadmandoc-b54610ec3ea88d830ee9843b468ad8f396ef41ab.tar.gz
Fixed `sp', `br', `Pp', etc. so as not to have an empty div (-Thtml, -man, -mdoc).
Made html_idcat be completely correct (messy standard) (-Thtml). Fixed warnings about -ohang and -item lists (-Thtml, -mdoc). Fixed typo in index.sgml.
Diffstat (limited to 'html.c')
-rw-r--r--html.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/html.c b/html.c
index 041e1061..ce623c8a 100644
--- a/html.c
+++ b/html.c
@@ -651,46 +651,28 @@ bufcat_su(struct html *h, const char *p, const struct roffsu *su)
void
-html_idcpy(char *dst, const char *src, int sz)
+html_idcat(char *dst, const char *src, int sz)
{
+ int ssz;
assert(sz);
- dst[0] = '\0';
- html_idcat(dst, src, sz);
-}
-
-
-void
-html_idcat(char *dst, const char *src, int sz)
-{
- int i;
/* Cf. <http://www.w3.org/TR/html4/types.html#h-6.2>. */
- for (i = 0; *dst != '\0' && i < sz - 1; dst++, i++)
+ for ( ; *dst != '\0' && sz; dst++, sz--)
/* Jump to end. */ ;
- for ( ; *src != '\0' && i < sz - 1; src++, i++, dst++) {
- if (isalnum((u_char)*src)) {
- *dst = *src;
- continue;
- }
+ assert(sz > 2);
- switch (*src) {
- case (';'):
- *dst = ';';
- break;
- case ('-'):
- *dst = '-';
- break;
- case (':'):
- *dst = ':';
- break;
- default:
- *dst = '_';
- break;
- }
- }
+ /* 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;
+ }
}