diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-16 22:33:30 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-16 22:33:30 +0000 |
commit | 0b50b90cf4efcd1646b2517a4777605ab2e844df (patch) | |
tree | 9a4b11349f5dc2acdd4280d4f9425d7b766be9a7 /html.c | |
parent | 4d45f12df9f220592a0c1b2eabe51d82cdc74daa (diff) | |
download | mandoc-0b50b90cf4efcd1646b2517a4777605ab2e844df.tar.gz |
Change chars.in HTML encoding to be a Unicode codepoint (int), which is
later formatted in html.c.
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -217,28 +217,36 @@ 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; - rhs = chars_a2ascii(h->symtab, p, len, &sz); - - if (NULL == rhs) + if ((cp = chars_spec2cp(h->symtab, p, len)) > 0) { + printf("&#%d;", cp); + return; + } else if (-1 == cp) return; - fwrite(rhs, 1, sz, stdout); + + if (NULL != (rhs = chars_spec2str(h->symtab, p, len, &sz))) + fwrite(rhs, 1, sz, stdout); } static void print_res(struct html *h, const char *p, size_t len) { + int cp; const char *rhs; size_t sz; - rhs = chars_a2res(h->symtab, p, len, &sz); - - if (NULL == rhs) + if ((cp = chars_res2cp(h->symtab, p, len)) > 0) { + printf("&#%d;", cp); + return; + } else if (-1 == cp) return; - fwrite(rhs, 1, sz, stdout); + + if (NULL != (rhs = chars_res2str(h->symtab, p, len, &sz))) + fwrite(rhs, 1, sz, stdout); } |