source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: When setting automatic tags, skip initial hyphens and minus
@ 2020-03-21  0:18 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2020-03-21  0:18 UTC (permalink / raw)
  To: source

Log Message:
-----------
When setting automatic tags, skip initial hyphens and minus signs,
bringing the behaviour for mdoc(7) closer to what is already done
for man(7).  
Triggered by the observation of kn@ that automatic tagging didn't
work very well for find(1) primaries.
OK kn@

Modified Files:
--------------
    mandoc:
        tag.c

Revision Data
-------------
Index: tag.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tag.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -Ltag.c -Ltag.c -u -p -r1.29 -r1.30
--- tag.c
+++ tag.c
@@ -89,8 +89,24 @@ tag_put(const char *s, int prio, struct 
 		if (n->child == NULL || n->child->type != ROFFT_TEXT)
 			return;
 		s = n->child->string;
-		if (s[0] == '\\' && (s[1] == '&' || s[1] == 'e'))
-			s += 2;
+		switch (s[0]) {
+		case '-':
+			s++;
+			break;
+		case '\\':
+			switch (s[1]) {
+			case '&':
+			case '-':
+			case 'e':
+				s += 2;
+				break;
+			default:
+				break;
+			}
+			break;
+		default:
+			break;
+		}
 	}
 
 	/*
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


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

only message in thread, other threads:[~2020-03-21  0:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21  0:18 mandoc: When setting automatic tags, skip initial hyphens and minus schwarze

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).