]> git.cameronkatri.com Git - mandoc.git/commitdiff
Use the correct Unicode value for the zero-width space, which means that
authorKristaps Dzonsons <kristaps@bsd.lv>
Tue, 24 May 2011 21:40:14 +0000 (21:40 +0000)
committerKristaps Dzonsons <kristaps@bsd.lv>
Tue, 24 May 2011 21:40:14 +0000 (21:40 +0000)
spec2cp never needs to fall through to spec2str.  Then clean out html.c
of its unnecessary print_res() function.

chars.in
html.c

index 6cbf34ed3a12520e19302a7484de6f6c45057df7..483a2bb82818626cb9aae505b6561e3e976ada61 100644 (file)
--- a/chars.in
+++ b/chars.in
@@ -1,4 +1,4 @@
-/*     $Id: chars.in,v 1.38 2011/05/24 21:24:16 kristaps Exp $ */
+/*     $Id: chars.in,v 1.39 2011/05/24 21:40:14 kristaps Exp $ */
 /*
  * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -33,15 +33,15 @@ static const char ascii_nbrsp[2] = { ASCII_NBRSP, '\0' };
 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)
diff --git a/html.c b/html.c
index 9299c976b787d8d4cbb92acbe47df3ee0cc3adb3..45471fe3b050c7456a57abd8ea68aee51d4c3008 100644 (file)
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/*     $Id: html.c,v 1.146 2011/05/24 21:31:23 kristaps Exp $ */
+/*     $Id: html.c,v 1.147 2011/05/24 21:40:14 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
@@ -217,26 +216,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)
 {
@@ -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 */