source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: When setting automatic tags, skip initial hyphens and minus
Date: Fri, 20 Mar 2020 19:18:01 -0500 (EST)	[thread overview]
Message-ID: <11ff177570ae5a4a@mandoc.bsd.lv> (raw)

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


                 reply	other threads:[~2020-03-21  0:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11ff177570ae5a4a@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    --subject='Re: mandoc: When setting automatic tags, skip initial hyphens and minus' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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