diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-01-19 17:59:02 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-01-19 17:59:02 +0000 |
commit | a8e6f24e2ef2416c9dca10c01cfe1565024fe06e (patch) | |
tree | 86f53c689529c22446706c45fae20c1a1741faf4 /usr.bin/mandoc/tag.c | |
parent | 8cbb81e0ba47de832eaeb3bf897a432b0ba95b3b (diff) |
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 'usr.bin/mandoc/tag.c')
-rw-r--r-- | usr.bin/mandoc/tag.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c index 31caad35c2e..394a08b1d5a 100644 --- a/usr.bin/mandoc/tag.c +++ b/usr.bin/mandoc/tag.c @@ -1,6 +1,6 @@ -/* $OpenBSD: tag.c,v 1.25 2019/07/27 13:40:42 schwarze Exp $ */ +/* $OpenBSD: tag.c,v 1.26 2020/01/19 17:59:01 schwarze Exp $ */ /* - * 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 @@ -194,12 +194,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; } @@ -239,7 +240,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]); |