source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Add \v and \h to ignored escapes.
@ 2010-08-16  9:37 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-08-16  9:37 UTC (permalink / raw)
  To: source

Log Message:
-----------
Add \v and \h to ignored escapes.  These are in the category of \s.
Also made sign-less \s-style escapes be ok (this is technically against
what's in the groff.7 manual, but seems pretty widespread).  Noted by
Thomas Jeunet as uglifying the gcc.1 manual.

Modified Files:
--------------
    mdocml:
        mandoc.c
        out.c

Revision Data
-------------
Index: mandoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lmandoc.c -Lmandoc.c -u -p -r1.27 -r1.28
--- mandoc.c
+++ mandoc.c
@@ -57,8 +57,6 @@ mandoc_special(char *p)
 		/* FALLTHROUGH */
 	case ('w'):
 		/* FALLTHROUGH */
-	case ('v'):
-		/* FALLTHROUGH */
 	case ('S'):
 		/* FALLTHROUGH */
 	case ('R'):
@@ -91,13 +89,19 @@ mandoc_special(char *p)
 		term = '\'';
 		break;
 #endif
+	case ('h'):
+		/* FALLTHROUGH */
+	case ('v'):
+		/* FALLTHROUGH */
 	case ('s'):
 		if (ASCII_HYPH == *p)
 			*p = '-';
-		if ('+' == *p || '-' == *p)
-			p++;
 
-		i = ('s' != *(p - 1));
+		i = 0;
+		if ('+' == *p || '-' == *p) {
+			p++;
+			i = 1;
+		}
 
 		switch (*p++) {
 		case ('('):
@@ -110,7 +114,7 @@ mandoc_special(char *p)
 			term = '\'';
 			break;
 		case ('0'):
-			i++;
+			i = 1;
 			/* FALLTHROUGH */
 		default:
 			len = 1;
@@ -121,13 +125,11 @@ mandoc_special(char *p)
 		if (ASCII_HYPH == *p)
 			*p = '-';
 		if ('+' == *p || '-' == *p) {
-			if (i++)
+			if (i)
 				return(0);
 			p++;
 		} 
 		
-		if (0 == i)
-			return(0);
 		break;
 #if 0
 	case ('Y'):
Index: out.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -Lout.c -Lout.c -u -p -r1.23 -r1.24
--- out.c
+++ out.c
@@ -240,11 +240,16 @@ a2roffdeco(enum roffdeco *d, const char 
 			break;
 		}
 		break;
+	case ('h'):
+		/* FALLTHROUGH */
+	case ('v'):
+		/* FALLTHROUGH */
 	case ('s'):
-		if ('+' == wp[i] || '-' == wp[i])
+		j = 0;
+		if ('+' == wp[i] || '-' == wp[i]) {
 			i++;
-
-		j = ('s' != wp[i - 1]);
+			j = 1;
+		}
 
 		switch (wp[i++]) {
 		case ('('):
@@ -257,7 +262,7 @@ a2roffdeco(enum roffdeco *d, const char 
 			term = '\'';
 			break;
 		case ('0'):
-			j++;
+			j = 1;
 			/* FALLTHROUGH */
 		default:
 			i--;
@@ -266,13 +271,11 @@ a2roffdeco(enum roffdeco *d, const char 
 		}
 
 		if ('+' == wp[i] || '-' == wp[i]) {
-			if (j++)
+			if (j)
 				return(i);
 			i++;
 		} 
 		
-		if (0 == j)
-			return(i);
 		break;
 	case ('['):
 		*d = DECO_SPECIAL;
--
 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:[~2010-08-16  9:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-16  9:37 mdocml: Add \v and \h to ignored escapes 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).