diff options
author | 2020-04-04 20:23:06 +0000 | |
---|---|---|
committer | 2020-04-04 20:23:06 +0000 | |
commit | e9f36175dfbf22a58e6781c9fdf13f33ca379f4f (patch) | |
tree | 31adf1bcd7b5aba292faba9934e241f7965fe42c /usr.bin/mandoc/man_validate.c | |
parent | Prevent the destruction of a session owned by another interface. (diff) | |
download | wireguard-openbsd-e9f36175dfbf22a58e6781c9fdf13f33ca379f4f.tar.xz wireguard-openbsd-e9f36175dfbf22a58e6781c9fdf13f33ca379f4f.zip |
automatically tag .SH and .SS in man(7) terminal output
in the same way as it was done for .Sh and .Ss in mdoc(7)
Diffstat (limited to 'usr.bin/mandoc/man_validate.c')
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index 4ab8c2cce11..0b28fe4a173 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.121 2020/03/13 00:31:05 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.122 2020/04/04 20:23:07 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -309,9 +309,32 @@ static void post_SH(CHKARGS) { struct roff_node *nc; + char *cp, *tag; - if (n->type != ROFFT_BODY || (nc = n->child) == NULL) + nc = n->child; + switch (n->type) { + case ROFFT_HEAD: + tag = NULL; + deroff(&tag, n); + if (tag != NULL) { + for (cp = tag; *cp != '\0'; cp++) + if (*cp == ' ') + *cp = '_'; + if (nc != NULL && nc->type == ROFFT_TEXT && + strcmp(nc->string, tag) == 0) + tag_put(NULL, TAG_WEAK, n); + else + tag_put(tag, TAG_FALLBACK, n); + free(tag); + } + return; + case ROFFT_BODY: + if (nc != NULL) + break; return; + default: + return; + } if (nc->tok == MAN_PP && nc->body->child != NULL) { while (nc->body->last != NULL) { |