* mdocml: Use the correct Unicode value for the zero-width space, which
@ 2011-05-24 21:40 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-05-24 21:40 UTC (permalink / raw)
To: source
Log Message:
-----------
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.
Modified Files:
--------------
mdocml:
chars.in
html.c
Revision Data
-------------
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -Lhtml.c -Lhtml.c -u -p -r1.146 -r1.147
--- html.c
+++ html.c
@@ -108,7 +108,6 @@ static const char *const roffscales[SCAL
};
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
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 */
Index: chars.in
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.in,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lchars.in -Lchars.in -u -p -r1.38 -r1.39
--- chars.in
+++ chars.in
@@ -33,15 +33,15 @@ static const char ascii_nbrsp[2] = { ASC
CHAR_TBL_START
/* Spacing. */
-CHAR("c", "", 0)
+CHAR("c", "", 8203)
CHAR("0", " ", 8194)
CHAR(" ", ascii_nbrsp, 160)
CHAR("~", ascii_nbrsp, 160)
-CHAR("%", "", 0)
-CHAR("&", "", 0)
-CHAR("^", "", 0)
-CHAR("|", "", 0)
-CHAR("}", "", 0)
+CHAR("%", "", 8203)
+CHAR("&", "", 8203)
+CHAR("^", "", 8203)
+CHAR("|", "", 8203)
+CHAR("}", "", 8203)
/* Accents. */
CHAR("a\"", "\"", 779)
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-24 21:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 21:40 mdocml: Use the correct Unicode value for the zero-width space, which kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).