From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KBA6JBZO52bE9AAA62LTzQ:P1 (envelope-from ) for ; Sun, 15 Sep 2024 21:13:58 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id KBA6JBZO52bE9AAA62LTzQ (envelope-from ) for ; Sun, 15 Sep 2024 23:13:58 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=adamkovic.org header.s=fm3 header.b="i CCTIbR"; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=hk1uPPHR; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=adamkovic.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726434838; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7QunwPXJlHvVhZom4uKUtnGA/tm72QgjZvlZnXbMBIA=; b=t9Fmy6xTS8c90qf51dxR22JCLWvAjrURDrt1OIALz/BskKJSIA5GaJXUQTOJSUEDdjWKGd UCZrpQhWYXgYChDVSIlXoFYX3z78+ZJWbYSatJjnIpGzJTvgXwBE+zvzzFqb0aDQMhoeaK fA2T0Z6RdrmWSXT3bS6UWII+r7OFy13oS9KX/ARriummWCr+p5oNwYMpOwKPIluoZKex6n h6+6dL87VbA6UEupXt1XwhmBnTwLfy2A5G/AtXV4DO4OwjYrph6yoUsFqTGf0UBnXaZTSh jjXqFfbjRKyN9ZSWeKarDVGGbEivuXnqV68Wfp4MoTrEkzU/XCKH86FDhVpcTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=adamkovic.org header.s=fm3 header.b="i CCTIbR"; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=hk1uPPHR; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=adamkovic.org (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726434838; a=rsa-sha256; cv=none; b=sYk5rag1YApM2bN2jEcAjP4e3S42yDauikTn6JCKKx/N7WbS/GeK366QC8/vwSU93ZtWxA lnCVPPhRaysIUebsgL31SsHhguNl3U296/+gsN6Wvu+pTHmlXIKIc069Ah16JOuOLH6fXi UjVJDXTxJzobctX33G18Y/QzIsXXUwK2PlbYkNjSAEk5+GhgNNOztXs3Ma0OZVLjGyZUSR 0DzvDDpwK84J/Lv4dHIdxb62bZqMjL68crQ6N96qogzfVofVB9oCzG+LLXKIjQmfIK4pRR UD3QOCCt6RRcHjnQlPtwkJ/FPcWIu39uqLqjUd3MBOHaft7cS1h2APY5Bxo0OA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AF30C32100 for ; Sun, 15 Sep 2024 23:13:57 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spwYK-0000iq-Fd; Sun, 15 Sep 2024 17:13:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1spwYI-0000ih-Bw for emacs-orgmode@gnu.org; Sun, 15 Sep 2024 17:13:02 -0400 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1spwYG-0004hT-DN for emacs-orgmode@gnu.org; Sun, 15 Sep 2024 17:13:02 -0400 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 208FE114008E; Sun, 15 Sep 2024 17:12:57 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sun, 15 Sep 2024 17:12:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1726434777; x= 1726521177; bh=9wsTrwhso9sz8vVX7CpxcABSC08J8BH84TsK7he4zG8=; b=i CCTIbRL+bvVlWyhzhq7AFlGg2dnZ3qiAURXILSt0voNy45K8xknWa32zIpCBKq0v nZFkuWRcEA9NlpZQToWquQdOJNLWZsoWZeiwT+lEsgN2o+WIb3BLwTrw7n1WN+sz flTeLxLJC+Nb+j3hHsNIwN3GjqRANr8AsyQHT7gZy5UxdcgbF0GNxVqHgcYby/cu vILDp0kSCTbDLdsd2OpyrGpJN5GyQazOYo0jLG3koAerwWJtNFKb5S5nbu6NTa12 LI6K/EiIJOrS8HKSu5X4xFE8pf/Hc8sXnRmpETHAbvIy1sx0vTqGon5w+wVmZq2R HJrHRx28bFuY+VglUYIhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1726434777; x=1726521177; bh=9wsTrwhso9sz8vVX7CpxcABSC08J 8BH84TsK7he4zG8=; b=hk1uPPHRYQAHjeKNZR++5PlO7Xei8/D3nJsyfBGJQTwG q5qfwAOwfdpGZTe7yfSyYgpWgss9HlzQUpnH1shJcqtToU6SiEOnHK52WK5AzVTf WqCPgyc38LNt34WnGoDPiuhHwWcg2vX9LjGlao7uN8SaBNYlly3HIlLfwXbobfwU zvSJxPcuzmpn5NCsm01zfSaC5j6GAreVc6TRPDtNeuYSP1qnQTLXWOtiB3R3j48w +Phs0TCgQMREOL1TOhEKJFb2/V7idhU64RmZ+ecqbckOcnxMwcr/GML2WTIT1Ty1 I5bHBtETmgbxve9ONJM8dfiqGc7h++2M8RDOLgVOwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudekfedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvve fujghffffkgggtsehmtderredttdejnecuhfhrohhmpeftuhguohhlfhcutegurghmkhho vhhitgcuoehruhguohhlfhesrggurghmkhhovhhitgdrohhrgheqnecuggftrfgrthhtvg hrnhepveekkefhuedvteehtdejjeehudeludeuleeiudfggeevfeejkeejvedtteelgfev necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhuug holhhfsegruggrmhhkohhvihgtrdhorhhgpdhnsggprhgtphhtthhopedvpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopegvmhgrtghsqdhorhhgmhhouggvsehgnhhurdhorh hgpdhrtghpthhtohephigrnhhtrghrledvsehpohhsthgvohdrnhgvth X-ME-Proxy: Feedback-ID: i88214938:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 15 Sep 2024 17:12:55 -0400 (EDT) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ox-texinfo: Support links in headings In-Reply-To: <87plp53xf9.fsf@localhost> References: <20240831203526.31509-1-rudolf@adamkovic.org> <87plp53xf9.fsf@localhost> Date: Sun, 15 Sep 2024 23:12:53 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.152; envelope-from=rudolf@adamkovic.org; helo=fhigh1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.41 X-Spam-Score: -3.41 X-Migadu-Queue-Id: AF30C32100 X-Migadu-Scanner: mx10.migadu.com X-TUID: 4eB919YazpOD --=-=-= Content-Type: text/plain Ihor Radchenko writes: > I tried to run make test and your new test fails: [...] Yup, `4829bacff', which you merged in the meantime, broke the test, as it changed how `@ref's are generated. > May you please fix this and also rebase the patch onto the latest main? Rebased. Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ox-texinfo-Support-links-in-headings.patch >From 56ff9d12d9644b076bb59e36715b3f82ed76b6a2 Mon Sep 17 00:00:00 2001 From: Rudolf Adamkovic Date: Sat, 24 Aug 2024 21:37:29 +0200 Subject: [PATCH] ox-texinfo: Support links in headings * etc/ORG-NEWS (Texinfo exporter now supports links in headings): Announce the new feature. * lisp/ox-texinfo.el: (org-texinfo--format-entries, org-texinfo--get-node, org-texinfo--sanitize-title-reference, org-texinfo--sanitize-title): A 2-step change: (1) Rename `--sanitize-title' to `--sanitize-title-reference' and (2) create a new `--sanitize-title' sanitation function. The new function is less strict in that does not remove links, which should be allowed in sectioning commands, such as `@unnumbered'. The old function remains more strict, which is useful for generating `@node' names, for example. * testing/lisp/test-ox-texinfo.el: (test-ox-texinfo/headings-with-links): Test the new functionality to avoid regressions in the future. --- etc/ORG-NEWS | 6 ++++++ lisp/ox-texinfo.el | 17 +++++++++++++++-- testing/lisp/test-ox-texinfo.el | 29 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 392788055..a9357aa28 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -223,6 +223,12 @@ This way, attachments will remain accessible when opening symlinked Org file. When no attach dir exists, Org mode will still prefer creating it in the "default" directory - where the symlink is located. +*** Texinfo exporter now supports links in headings + +The Texinfo exporter no longer removes links from headings. This +applies to all headings, below and above the =H= and =toc= export +=#+OPTIONS:=. + * Version 9.7 ** Important announcements and breaking changes diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 2da90ca0f..d3cd5cde1 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -524,7 +524,7 @@ node or anchor name is unique." (org-texinfo--sanitize-node (pcase (org-element-type datum) (`headline - (org-texinfo--sanitize-title + (org-texinfo--sanitize-title-reference (org-export-get-alt-title datum info) info)) (`radio-target (org-export-data (org-element-contents datum) info)) @@ -569,6 +569,19 @@ periods, commas and colons." (defun org-texinfo--sanitize-title (title info) "Make TITLE suitable as a section name. TITLE is a string or a secondary string. INFO is the current +export state, as a plist." + (org-export-data-with-backend + title + (org-export-create-backend + :parent 'texinfo + :transcoders `((footnote-reference . ,#'ignore) + (radio-target . ,(lambda (_r c _) c)) + (target . ,#'ignore))) + info)) + +(defun org-texinfo--sanitize-title-reference (title info) + "Make TITLE suitable as a section reference. +TITLE is a string or a secondary string. INFO is the current export state, as a plist." (org-export-data-with-backend title (org-export-toc-entry-backend 'texinfo) info)) @@ -1468,7 +1481,7 @@ a plist containing contextual information." ;; name. Remove them. (replace-regexp-in-string "[ \t]*:+" "" - (org-texinfo--sanitize-title + (org-texinfo--sanitize-title-reference (org-export-get-alt-title h info) info))) (node (org-texinfo--get-node h info)) (entry (concat "* " title ":" diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el index d4552459d..d74760024 100644 --- a/testing/lisp/test-ox-texinfo.el +++ b/testing/lisp/test-ox-texinfo.el @@ -374,5 +374,34 @@ body (re-search-forward "@ref{B, , B}") (re-search-forward "@ref{B, , C}"))))))) + +;;; Headings with links + +(ert-deftest test-ox-texinfo/headings-with-links () + "Test node and chapter names." + (should + (org-test-with-temp-text + (string-join + (list "* Heading 1" + " ...." + "* Heading 2 ([[* Heading 1][Heading 1]])" + " ....") + "\n") + (let ((export-buffer "*Test Texinfo Export*") + (org-export-show-temporary-export-buffer nil)) + (org-export-to-buffer 'texinfo export-buffer + nil nil nil nil nil + #'texinfo-mode) + (with-current-buffer export-buffer + (goto-char (point-min)) + (and + (re-search-forward "^* Heading 1::$") + (re-search-forward "^* Heading 2 (Heading 1)::$") + (re-search-forward "^@node Heading 1$") + (re-search-forward "^@chapter Heading 1$") + (re-search-forward "^@node Heading 2 (Heading 1)$") + (re-search-forward + "^@chapter Heading 2 (@ref{Heading 1, , Heading 1})$"))))))) + (provide 'test-ox-texinfo) ;;; test-ox-texinfo.el end here -- 2.39.3 (Apple Git-146) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "I love deadlines. I love the whooshing noise they make as they go by." --- Douglas Adams, The Salmon of Doubt, 2002 Rudolf Adamkovi=C4=8D [he/him] http://adamkovic.org --=-=-=--