From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5546 invoked from network); 30 Oct 2020 13:35:25 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 30 Oct 2020 13:35:25 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id bd0739a9 for ; Fri, 30 Oct 2020 08:35:22 -0500 (EST) Received: from scc-mailout-kit-01.scc.kit.edu (scc-mailout-kit-01.scc.kit.edu [129.13.231.81]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 3548f038 for ; Fri, 30 Oct 2020 08:35:20 -0500 (EST) Received: from hekate.asta.kit.edu ([141.3.145.153] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1kYUYn-0008Cd-Sq; Fri, 30 Oct 2020 14:35:19 +0100 Received: from donnerwolke.asta.kit.edu ([141.3.145.61] helo=donnerwolke.usta.de) by hekate.usta.de with esmtp (Exim 4.92.2) (envelope-from ) id 1kYUYn-0004Hj-5U; Fri, 30 Oct 2020 14:35:17 +0100 Received: from athene.asta.kit.edu ([141.3.145.60] helo=athene.usta.de) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1kYUYm-0003e7-UY; Fri, 30 Oct 2020 14:35:17 +0100 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id c129fb53; Fri, 30 Oct 2020 14:35:16 +0100 (CET) Date: Fri, 30 Oct 2020 14:35:16 +0100 From: Ingo Schwarze To: Aman Verma Cc: discuss@mandoc.bsd.lv Subject: Re: Not all section headers have id in HTML output Message-ID: <20201030133516.GA90785@athene.usta.de> References: X-Mailinglist: mandoc-discuss Reply-To: discuss@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Hello Aman, Aman Verma wrote on Wed, Oct 28, 2020 at 06:40:45PM -0400: > Thanks for the fix for the `pre` bug. I have another (possible) > bug to report: > > In the HTML output for mdoc(7)[1] the first two section headers don't > have an id attribute. In fact, it seems that two other elements down the > page have taken the ids ("NAME" and "DESCRIPTION") that the first two > headers were supposed to have. That is true. Automatic tagging of the .It macro tagged with TAG_STRONG whereas .Sh only tagged with TAG_WEAK. > This makes it impossible to link to those headers and also breaks the > table of contents generated with the `-O toc` option to mandoc. You are right; arguably, that is not ideal. So i changed the priority from TAG_WEAK to TAG_STRONG for all headers where the header text can be used as the fragment identifier without any modification; that includes single-word titles, in particular NAME and DESCRIPTION, see the patch below. I do see value in having ...#DESCRIPTION always linking to the description, just as you say. I have also installed the changed code on https://man.openbsd.org/ such that the new behaviour can be easily inspected. Thanks for the suggestion, Ingo Log Message: ----------- Promote section headers that can can be used unmodified as fragment identifiers from TAG_WEAK to TAG_STRONG, such that for example ...#DESCRIPTION always works. Suggested by Aman Verma on the discuss@ list. Modified Files: -------------- mandoc: man_validate.c mdoc_validate.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v retrieving revision 1.387 retrieving revision 1.388 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.387 -r1.388 --- mdoc_validate.c +++ mdoc_validate.c @@ -2617,7 +2617,7 @@ post_section(POST_ARGS) if ((nch = n->child) != NULL && nch->type == ROFFT_TEXT && strcmp(nch->string, tag) == 0) - tag_put(NULL, TAG_WEAK, n); + tag_put(NULL, TAG_STRONG, n); else tag_put(tag, TAG_FALLBACK, n); free(tag); Index: man_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v retrieving revision 1.154 retrieving revision 1.155 diff -Lman_validate.c -Lman_validate.c -u -p -r1.154 -r1.155 --- man_validate.c +++ man_validate.c @@ -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); -- To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv