diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-11-12 08:21:05 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-11-12 08:21:05 +0000 |
commit | 627a4caec7519aa0479398c3e48bdd78999d2fc8 (patch) | |
tree | 09daefac911456b7ccab04fae0d27464db17e1b2 | |
parent | 8f5752d2fe1a20c227cf2afa8c9253a374b6d0b2 (diff) | |
download | mandoc-627a4caec7519aa0479398c3e48bdd78999d2fc8.tar.gz |
Fixed \c support for all input and output modes (documented in mandoc_char.7).
-rw-r--r-- | html.c | 3 | ||||
-rw-r--r-- | man.7 | 8 | ||||
-rw-r--r-- | man_term.c | 13 | ||||
-rw-r--r-- | mandoc_char.7 | 1 | ||||
-rw-r--r-- | out.c | 5 | ||||
-rw-r--r-- | out.h | 1 | ||||
-rw-r--r-- | term.c | 3 |
7 files changed, 15 insertions, 19 deletions
@@ -262,6 +262,9 @@ print_encode(struct html *h, const char *p) } p += len - 1; + + if (DECO_NOSPACE == deco && '\0' == *(p + 1)) + h->flags |= HTML_NOSPACE; } } @@ -67,14 +67,6 @@ line termination. Blank lines are acceptable; where found, the output will assert a vertical space. . -.Pp -The -.Sq \ec -escape is common in historical -.Nm -documents; if encountered at the end of a word, it ensures that the -subsequent word isn't off-set by whitespace. -. . .Ss Comments Text following a @@ -783,7 +783,7 @@ post_RS(DECL_ARGS) static void print_man_node(DECL_ARGS) { - int c, sz; + int c; c = 1; @@ -793,17 +793,8 @@ print_man_node(DECL_ARGS) term_vspace(p); break; } - /* - * Note! This is hacky. Here, we recognise the `\c' - * escape embedded in so many -man pages. It's supposed - * to remove the subsequent space, so we mark NOSPACE if - * it's encountered in the string. - */ - sz = (int)strlen(n->string); + term_word(p, n->string); - if (sz >= 2 && n->string[sz - 1] == 'c' && - n->string[sz - 2] == '\\') - p->flags |= TERMP_NOSPACE; /* FIXME: this means that macro lines are munged! */ diff --git a/mandoc_char.7 b/mandoc_char.7 index 7513a7be..5196318f 100644 --- a/mandoc_char.7 +++ b/mandoc_char.7 @@ -110,6 +110,7 @@ Spacing: .It \e& Ta zero-width space .It \e| Ta zero-width space .It \e0 Ta breaking, non-collapsing digit-width space +.It \ec Ta removes any trailing space (if applicable) .El . .Pp @@ -331,6 +331,11 @@ a2roffdeco(enum roffdeco *d, case ('['): break; + case ('c'): + *d = DECO_NOSPACE; + *sz = 1; + return(1); + default: *d = DECO_SPECIAL; *word = wp; @@ -44,6 +44,7 @@ enum roffdeco { DECO_ROMAN, DECO_PREVIOUS, DECO_SIZE, + DECO_NOSPACE, DECO_MAX }; @@ -487,7 +487,10 @@ term_word(struct termp *p, const char *word) default: break; } + word += sz; + if (DECO_NOSPACE == deco && '\0' == *word) + p->flags |= TERMP_NOSPACE; } if (sv[0] && 0 == sv[1]) |