source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Finishing touches on demandoc.
@ 2011-09-01 22:25 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-09-01 22:25 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        demandoc.1
        demandoc.c

Revision Data
-------------
Index: demandoc.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/demandoc.1,v
retrieving revision 1.3
retrieving revision 1.4
diff -Ldemandoc.1 -Ldemandoc.1 -u -p -r1.3 -r1.4
--- demandoc.1
+++ demandoc.1
@@ -41,8 +41,10 @@ This outputs each word of text on its ow
 A
 .Qq word ,
 in this case, refers to whitespace-delimited terms beginning with at
-least two letters after opening punctuation and not consisting of any
-escape sequences.
+least two letters and not consisting of any escape sequences.
+Terms have their leading and trailing punctuation
+.Pq double-quotes, sentence punctuation, etc.
+stripped.
 .It Ar
 The input files.
 .El
@@ -84,6 +86,14 @@ Such errors cause
 to exit at once, possibly in the middle of parsing or formatting a file.
 The output databases are corrupt and should be removed .
 .El
+.Sh EXAMPLES
+The traditional usage of
+.Nm
+is for spell-checking manuals on
+.Bx .
+This is accomplished as follows (assuming British spelling):
+.Pp
+.Dl $ demandoc -w file.1 | spell -b
 .Sh SEE ALSO
 .Xr mandoc 1 ,
 .Xr man 7
Index: demandoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/demandoc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Ldemandoc.c -Ldemandoc.c -u -p -r1.5 -r1.6
--- demandoc.c
+++ 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
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-01 22:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 22:25 mdocml: Finishing touches on demandoc kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).