summaryrefslogtreecommitdiffstats
path: root/demandoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'demandoc.c')
-rw-r--r--demandoc.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/demandoc.c b/demandoc.c
index b61e1fe8..8b6533f2 100644
--- a/demandoc.c
+++ b/demandoc.c
@@ -132,7 +132,7 @@ static void
pstring(const char *p, int col, int *colp, int list)
{
enum mandoc_esc esc;
- const char *start;
+ const char *start, *end;
int emit;
/*
@@ -161,8 +161,20 @@ again:
} else if (isspace((unsigned char)*p))
break;
- if (emit && p - start >= 2) {
- for ( ; start != p; start++)
+ end = p - 1;
+
+ while (end > start)
+ if ('.' == *end || ',' == *end ||
+ '\'' == *end || '"' == *end ||
+ ')' == *end || '!' == *end ||
+ '?' == *end || ':' == *end ||
+ ';' == *end)
+ end--;
+ else
+ break;
+
+ if (emit && end - start >= 1) {
+ for ( ; start <= end; start++)
if (ASCII_HYPH == *start)
putchar('-');
else