-/* $Id: demandoc.c,v 1.5 2011/09/01 22:09:50 kristaps Exp $ */
+/* $Id: demandoc.c,v 1.10 2014/03/19 22:20:43 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
argc -= optind;
argv += optind;
- mp = mparse_alloc(MPARSE_AUTO, MANDOCLEVEL_FATAL, NULL, NULL);
+ mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, NULL);
assert(mp);
if (0 == argc)
return;
}
- mparse_result(mp, &mdoc, &man);
+ mparse_result(mp, &mdoc, &man, NULL);
line = 1;
col = 0;
pstring(const char *p, int col, int *colp, int list)
{
enum mandoc_esc esc;
- const char *start;
+ const char *start, *end;
int emit;
/*
} 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