version 1.36, 2020/04/19 16:36:16 |
version 1.37, 2022/04/26 11:38:38 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2015, 2016, 2018, 2019, 2020, 2022 |
|
* Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
|
|
/* |
/* |
* Set a node where a term is defined, |
* Set a node where a term is defined, |
* unless it is already defined at a lower priority. |
* unless the term is already defined at a lower priority. |
*/ |
*/ |
void |
void |
tag_put(const char *s, int prio, struct roff_node *n) |
tag_put(const char *s, int prio, struct roff_node *n) |
Line 93 tag_put(const char *s, int prio, struct roff_node *n) |
|
Line 94 tag_put(const char *s, int prio, struct roff_node *n) |
|
|
|
assert(prio <= TAG_FALLBACK); |
assert(prio <= TAG_FALLBACK); |
|
|
|
/* |
|
* If the node is already tagged, the existing tag is |
|
* explicit and we are now about to add an implicit tag. |
|
* Don't do that; just skip implicit tagging if the author |
|
* specified an explicit tag. |
|
*/ |
|
|
|
if (n->flags & NODE_ID) |
|
return; |
|
|
|
/* Determine the implicit tag. */ |
|
|
if (s == NULL) { |
if (s == NULL) { |
if (n->child == NULL || n->child->type != ROFFT_TEXT) |
if (n->child == NULL || n->child->type != ROFFT_TEXT) |
return; |
return; |
Line 150 tag_put(const char *s, int prio, struct roff_node *n) |
|
Line 163 tag_put(const char *s, int prio, struct roff_node *n) |
|
*/ |
*/ |
|
|
else if (entry->prio < prio) |
else if (entry->prio < prio) |
return; |
return; |
|
|
/* |
/* |
* If the existing entry is worse, clear it. |
* If the existing entry is worse, clear it. |