summaryrefslogtreecommitdiffstats
path: root/tag.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-01-19 18:02:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-01-19 18:02:00 +0000
commitc52cbdd1ba579d2163f2000582c15c6002df18e9 (patch)
tree6b9836bd7f87a1c917fca71747149eecdf66d7ac /tag.c
parent997afdc8d9bfb322c69f12820e5299a5cbca4fba (diff)
downloadmandoc-c52cbdd1ba579d2163f2000582c15c6002df18e9.tar.gz
Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a place
as defining a term. Please only use it when automatic tagging does not work. Manual page authors will not be required to add the new macro; using it remains optional. HTML output is still rudimentary in this version and will be polished later. Thanks to kn@ for reminding me that i have been considering since BSDCan 2014 whether something like this might be useful. Given that possibilities of making automatic tagging better are running out and there are still several situations where automatic tagging cannot do the job, i think the time is now ripe. Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tag.c b/tag.c
index bc4d7484..f5809f21 100644
--- a/tag.c
+++ b/tag.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*
- * Copyright (c) 2015, 2016, 2018, 2019 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -196,12 +196,13 @@ tag_put(const char *s, int prio, size_t line)
/* A better entry is already present, ignore the new one. */
- if (entry->prio > 0 && entry->prio < prio)
+ if (entry->prio != -1 && entry->prio < prio)
return;
/* The existing entry is worse, clear it. */
- if (entry->prio < 1 || entry->prio > prio)
+ if (entry->prio == -1 || entry->prio == 0 ||
+ entry->prio > prio)
entry->nlines = 0;
}
@@ -241,7 +242,7 @@ tag_write(void)
empty = 1;
entry = ohash_first(&tag_data, &slot);
while (entry != NULL) {
- if (stream != NULL && entry->prio >= 0) {
+ if (stream != NULL && entry->prio != -1) {
for (i = 0; i < entry->nlines; i++) {
fprintf(stream, "%s %s %zu\n",
entry->s, tag_files.ofn, entry->lines[i]);