source@mandoc.bsd.lv
 help / color / 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, back to index

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

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git