diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-09-01 22:25:53 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-09-01 22:25:53 +0000 |
commit | c78c9e8936467a043d7391bd6994eb881eb0cc70 (patch) | |
tree | c23f82e7005e0866a7a1100df4fd5bfa0462f3fe /demandoc.c | |
parent | 20e26486c747057a6426ded8d6a1f89bf2154c6e (diff) | |
download | mandoc-c78c9e8936467a043d7391bd6994eb881eb0cc70.tar.gz |
Finishing touches on demandoc. It now backs over ending punctuation as
well as leading punctuation. Again, this isn't the same as deroff
(which uses, I think, some punctuation as delimiters), but it's easier
to explain and simpler to audit.
Diffstat (limited to 'demandoc.c')
-rw-r--r-- | demandoc.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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 |