aports

Custom Alpine Linux aports

git clone https://git.8pit.net/aports.git

 1Patch-Source: https://cvsweb.bsd.lv/mandoc/tag.c.diff?r1=1.36&r2=1.37
 2---
 3===================================================================
 4RCS file: /cvs/mandoc/tag.c,v
 5retrieving revision 1.36
 6retrieving revision 1.37
 7diff -u -p -r1.36 -r1.37
 8--- mandoc/tag.c	2020/04/19 16:36:16	1.36
 9+++ mandoc/tag.c	2022/04/26 11:38:38	1.37
10@@ -1,6 +1,7 @@
11-/* $Id: tag.c,v 1.36 2020/04/19 16:36:16 schwarze Exp $ */
12+/* $Id: tag.c,v 1.37 2022/04/26 11:38:38 schwarze Exp $ */
13 /*
14- * Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org>
15+ * Copyright (c) 2015, 2016, 2018, 2019, 2020, 2022
16+ *               Ingo Schwarze <schwarze@openbsd.org>
17  *
18  * Permission to use, copy, modify, and distribute this software for any
19  * purpose with or without fee is hereby granted, provided that the above
20@@ -80,7 +81,7 @@ tag_free(void)
21 
22 /*
23  * Set a node where a term is defined,
24- * unless it is already defined at a lower priority.
25+ * unless the term is already defined at a lower priority.
26  */
27 void
28 tag_put(const char *s, int prio, struct roff_node *n)
29@@ -93,6 +94,18 @@ tag_put(const char *s, int prio, struct roff_node *n)
30 
31 	assert(prio <= TAG_FALLBACK);
32 
33+	/*
34+	 * If the node is already tagged, the existing tag is
35+	 * explicit and we are now about to add an implicit tag.
36+	 * Don't do that; just skip implicit tagging if the author
37+	 * specified an explicit tag.
38+	 */
39+
40+	if (n->flags & NODE_ID)
41+		return;
42+
43+	/* Determine the implicit tag. */
44+
45 	if (s == NULL) {
46 		if (n->child == NULL || n->child->type != ROFFT_TEXT)
47 			return;
48@@ -150,7 +163,7 @@ tag_put(const char *s, int prio, struct roff_node *n)
49 	 */
50 
51 	else if (entry->prio < prio)
52-			return;
53+		return;
54 
55 	/*
56 	 * If the existing entry is worse, clear it.