summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--html.c3
-rw-r--r--man.78
-rw-r--r--man_term.c13
-rw-r--r--mandoc_char.71
-rw-r--r--out.c5
-rw-r--r--out.h1
-rw-r--r--term.c3
7 files changed, 15 insertions, 19 deletions
diff --git a/html.c b/html.c
index 8b6279f5..7a18c976 100644
--- a/html.c
+++ b/html.c
@@ -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;
}
}
diff --git a/man.7 b/man.7
index 0130540e..13ce8be0 100644
--- a/man.7
+++ b/man.7
@@ -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
diff --git a/man_term.c b/man_term.c
index 939bc049..03f5cfdf 100644
--- a/man_term.c
+++ b/man_term.c
@@ -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
diff --git a/out.c b/out.c
index 11f463e5..dd584d7a 100644
--- a/out.c
+++ b/out.c
@@ -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;
diff --git a/out.h b/out.h
index 9c6b3356..46273b9d 100644
--- a/out.h
+++ b/out.h
@@ -44,6 +44,7 @@ enum roffdeco {
DECO_ROMAN,
DECO_PREVIOUS,
DECO_SIZE,
+ DECO_NOSPACE,
DECO_MAX
};
diff --git a/term.c b/term.c
index 057d5e2f..4ab35a2d 100644
--- a/term.c
+++ b/term.c
@@ -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])