diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-24 21:40:14 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-24 21:40:14 +0000 |
commit | 2176678845e3bde85db6f82732ecbedba450f755 (patch) | |
tree | 80a548165d108ed595e84014d036751d9ceac8d8 /html.c | |
parent | 4b3a9caedf7632dd837b5d786c41d0d124c06ee4 (diff) | |
download | mandoc-2176678845e3bde85db6f82732ecbedba450f755.tar.gz |
Use the correct Unicode value for the zero-width space, which means that
spec2cp never needs to fall through to spec2str. Then clean out html.c
of its unnecessary print_res() function.
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 27 |
1 files changed, 5 insertions, 22 deletions
@@ -108,7 +108,6 @@ static const char *const roffscales[SCALE_MAX] = { }; static void bufncat(struct html *, const char *, size_t); -static void print_spec(struct html *, const char *, size_t); static void print_ctag(struct html *, enum htmltag); static int print_encode(struct html *, const char *, int); static void print_metaf(struct html *, enum mandoc_esc); @@ -218,26 +217,6 @@ print_gen_head(struct html *h) } static void -print_spec(struct html *h, const char *p, size_t len) -{ - int cp; - const char *rhs; - size_t sz; - - if ((cp = mchars_spec2cp(h->symtab, p, len)) > 0) { - printf("&#%d;", cp); - return; - } else if (-1 == cp && 1 == len) { - fwrite(p, 1, len, stdout); - return; - } else if (-1 == cp) - return; - - if (NULL != (rhs = mchars_spec2str(h->symtab, p, len, &sz))) - fwrite(rhs, 1, sz, stdout); -} - -static void print_metaf(struct html *h, enum mandoc_esc deco) { enum htmlfont font; @@ -367,7 +346,11 @@ print_encode(struct html *h, const char *p, int norecurse) putchar(c); break; case (ESCAPE_SPECIAL): - print_spec(h, seq, len); + c = mchars_spec2cp(h->symtab, seq, len); + if (c > 0) + printf("&#%d;", c); + else if (-1 == c && 1 == len) + putchar((int)*seq); break; case (ESCAPE_FONT): /* FALLTHROUGH */ |