=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.105 retrieving revision 1.107 diff -u -p -r1.105 -r1.107 --- mandoc/html.c 2010/07/06 12:37:17 1.105 +++ mandoc/html.c 2010/07/16 22:33:30 1.107 @@ -1,6 +1,6 @@ -/* $Id: html.c,v 1.105 2010/07/06 12:37:17 kristaps Exp $ */ +/* $Id: html.c,v 1.107 2010/07/16 22:33:30 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -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; - fwrite(rhs, 1, sz, stdout); + } else if (-1 == cp) + return; + + 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; - fwrite(rhs, 1, sz, stdout); + } else if (-1 == cp) + return; + + if (NULL != (rhs = chars_res2str(h->symtab, p, len, &sz))) + fwrite(rhs, 1, sz, stdout); }