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.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 4337 invoked from network); 21 Jun 2022 12:28:09 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 21 Jun 2022 12:28:09 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id f27158c1 for ; Tue, 21 Jun 2022 07:28:09 -0500 (EST) Received: from sysrq.in (sysrq.in [37.79.202.136]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 17036340 for ; Tue, 21 Jun 2022 07:28:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysrq.in; s=sysrq.in; t=1655814473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2FLtiQmxTcfCwITBisY8VUT88bQatOWDxVsw4lZiLzQ=; b=uDAMRhpqsLR/f7grxKdPL0amilnUbpX32aj0PBtFgKVj4u/IkP/xcaGvA+Nw6suNmv58mF 5Bh8NFEXK7a5FlzmZ71lw4hpPmqu5ldymXJmYY2wf+9Xt/QtMrxevs+ixQvifuYyB+kq1p uqa5gnEVW9VLhDfGo3pk2NLOZJvtLBryMBpEvSvka1nuB5+7J4qSzvBvnYQsUTDz2rQeml PbIP9erKR/Ys4r3kthZkXgr44eYA2PHRo6awFjPAOuzVEuC6FAmgoCV+++6uUHuxGaLcsn 8d3NlhEYm8L893JkZJr+BnyMEVlTF9HchnqNrE+dWYjC67PFZEFt6MRgDPHnlQ== Received: from sysrq.in (localhost [127.0.0.1]) by sysrq.in (OpenSMTPD) with ESMTPSA id d57266d8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 21 Jun 2022 12:27:53 +0000 (UTC) From: =?UTF-8?q?Anna=20=E2=80=9CCyberTailor=E2=80=9D?= To: tech@mandoc.bsd.lv Subject: [PATCH 6/8] mdoc_html: Add accessible description to crosslinks Date: Tue, 21 Jun 2022 17:27:47 +0500 Message-Id: <20220621122749.11417-7-cyber@sysrq.in> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220621122749.11417-1-cyber@sysrq.in> References: <20220621122749.11417-1-cyber@sysrq.in> X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Never hear "mdoc, left parenthesis, 7, right parenthesis" again. --- html.c | 3 +++ mdoc_html.c | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/html.c b/html.c index 4710bab7..3239a09b 100644 --- a/html.c +++ b/html.c @@ -709,6 +709,9 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) case 'i': attr = "id"; break; + case 'l': + attr = "aria-label"; + break; case 'r': attr = "role"; break; diff --git a/mdoc_html.c b/mdoc_html.c index 076a6bac..cf2e8804 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -667,26 +667,35 @@ mdoc_nm_pre(MDOC_ARGS) static int mdoc_xr_pre(MDOC_ARGS) { + char *name = NULL, *section = NULL, *label = NULL; + if (NULL == n->child) return 0; + name = n->child->string; + label = name; + if (NULL != n->child->next) + section = n->child->next->string; + + if (NULL != section) + mandoc_asprintf(&label, "%s, section %s", name, section); + if (h->base_man1) - print_otag(h, TAG_A, "chM", "Xr", - n->child->string, n->child->next == NULL ? - NULL : n->child->next->string); + print_otag(h, TAG_A, "clhM", "Xr", label, name, section); else - print_otag(h, TAG_A, "c", "Xr"); + print_otag(h, TAG_A, "cl", "Xr", label); - n = n->child; - print_text(h, n->string); + free(label); + + print_text(h, name); - if (NULL == (n = n->next)) + if (NULL == section) return 0; h->flags |= HTML_NOSPACE; print_text(h, "("); h->flags |= HTML_NOSPACE; - print_text(h, n->string); + print_text(h, section); h->flags |= HTML_NOSPACE; print_text(h, ")"); return 0; -- 2.35.1 -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv