]> git.cameronkatri.com Git - mandoc.git/blobdiff - man_validate.c
Promote section headers that can can be used unmodified as fragment
[mandoc.git] / man_validate.c
index ee634f50600b81d4c89215e770e3221837a96b84..57f05b25e8ff9b47f8dde98d98986805513231fd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.152 2020/04/04 20:33:33 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.155 2020/10/30 13:24:33 schwarze Exp $ */
 /*
  * Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
 #include "mandoc_aux.h"
 #include "mandoc.h"
 #include "roff.h"
-#include "tag.h"
 #include "man.h"
 #include "libmandoc.h"
 #include "roff_int.h"
 #include "libman.h"
+#include "tag.h"
 
 #define        CHKARGS   struct roff_man *man, struct roff_node *n
 
@@ -324,7 +324,7 @@ post_SH(CHKARGS)
                                        *cp = '_';
                        if (nc != NULL && nc->type == ROFFT_TEXT &&
                            strcmp(nc->string, tag) == 0)
-                               tag_put(NULL, TAG_WEAK, n);
+                               tag_put(NULL, TAG_STRONG, n);
                        else
                                tag_put(tag, TAG_FALLBACK, n);
                        free(tag);
@@ -510,9 +510,14 @@ post_TH(CHKARGS)
 
        if (n != NULL)
                n = n->next;
-       if (n != NULL && n->string != NULL)
+       if (n != NULL && n->string != NULL) {
                man->meta.msec = mandoc_strdup(n->string);
-       else {
+               if (man->filesec != '\0' &&
+                   man->filesec != *n->string &&
+                   *n->string >= '1' && *n->string <= '9')
+                       mandoc_msg(MANDOCERR_MSEC_FILE, n->line, n->pos,
+                           "*.%c vs TH ... %c", man->filesec, *n->string);
+       } else {
                man->meta.msec = mandoc_strdup("");
                mandoc_msg(MANDOCERR_MSEC_MISSING,
                    nb->line, nb->pos, "TH %s", man->meta.title);