From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2NyBFPwAwWXC0wAAqHPOHw:P1 (envelope-from ) for ; Mon, 05 Feb 2024 16:38:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 2NyBFPwAwWXC0wAAqHPOHw (envelope-from ) for ; Mon, 05 Feb 2024 16:38:36 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oOl38PD0; 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=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707147516; 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=huUJC0vmwxBKqB4CnMCCzM+dJltCFwwKjSYXnO6lorM=; b=QbXBFK7fwccMbIiYtzvrOmhD1aS49gMvOSKY9yl93z3TuCtXumGV/ArAKNTtlWXpPbwjim yLCOKSVMuOVYFVjVR+ev5SjZuQdWXx2dHpBWP/4nGuBVKjc66MxUrD9d79IRyVcZYHJGbn u45ZbI1alkTPruRmnXmDn+T5SCsMpQX9ukgCQ1rZJrXqpt0+3Qop5pHDCY9B6ujOEai4Jt RU1WcZ0LZNlO5UsJBBJNHne2LXPZdRJ2fYeNVBLW7j2eA/MIVvu400XggCr+rgWif1gACB 3e9r++MfQsPoo2E+d6qc9Mo5JHy/jT0eSkMyoC/SRRsESwYXnIyU7lrEEHIM3w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oOl38PD0; 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=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707147516; a=rsa-sha256; cv=none; b=kkWgm6XOJeTWoEE4UEKvh0EjcwbTRVMP05Bp7TplYqSun4uA7jSovM3tKaqxqoGy+uQCiC 1g1NDRVwNM61qHRaRSRiw3kXvYWV692zGwXWa6ycNILSaIWvLmFl/jax5BRdWPsba7co1m V68BFsc22pWob4LQPHUtyQNbtk1InZiv8actU3isL2RwZlxgNM8wIY+ZVIZ3kcsYxtli3t KKZhvQpH3zqe6PkboN4qEKU9OBhCoeVLtpT7zFpHESS8vHaaqRUW53NT9l5hCn5oQ6fczs CRE/jlPzhXf5G623bFoWFk3sgFEf7ldnqQdxb4p4excUriC0gtvvDS/YKWcAEg== 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 CC3D8459A9 for ; Mon, 5 Feb 2024 16:38:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX12g-0000Mc-V5; Mon, 05 Feb 2024 10:37:54 -0500 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 1rX12e-0000ML-AP for emacs-orgmode@gnu.org; Mon, 05 Feb 2024 10:37:52 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX12W-0008QV-Dc for emacs-orgmode@gnu.org; Mon, 05 Feb 2024 10:37:51 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id AEED4240103 for ; Mon, 5 Feb 2024 16:37:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707147461; bh=/b4HXNvbr8nijT5wY1icgJDI5cDw4v7SDfbbO6YLSA8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=oOl38PD000eqHOjX83Efs1vsBWKiVFK2hLRSfyrQn0AEm7twT9cya85k//dRDqepp F1rX2XOTtDJW1fWJOjJX4SdnjrcBU6AQU2kMu2Bk8vsqrp/QaPBAbIf9MLa5HdUSZC I6fQUSkq3H9/6JeYqensUmG9Y9lV3OngAQWf92dwZqNBTMLuNsqzyjdAyErDp3Kr+e xmFrrr1oV5FDf9F8v/PbPhbkYbCwkYkJTAJI9YGtI9qIIFe87hWhpe5VbKcRM/Xjn/ yDW9EslXW+FTeQIcoDfKLF/bXUMc7/PpOxK384AN6DlTWViiTOMke1+AfhcMLateSj mwOGEM5HJdjbQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TT9Vr4VSnz9rxN; Mon, 5 Feb 2024 16:37:40 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] URI handling is overly complicated and nonstandard [9.6.7 (N/A @ /gnu/store/mg7223g8mw90lccp6mm5g6f3mpjk70si-emacs-org-9.6.7/share/emacs/site-lisp/org-9.6.7/)] In-Reply-To: References: <87il8v2q00.fsf@riseup.net> <89434f4f-8aea-23f2-bbfc-3961c18f2154@gmail.com> <87a5u6tgb3.fsf@localhost> <878r9nofpw.fsf@localhost> <8734ztvtvk.fsf@localhost> Date: Mon, 05 Feb 2024 15:41:10 +0000 Message-ID: <8734u6apgp.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: -9.89 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -9.89 X-Migadu-Queue-Id: CC3D8459A9 X-TUID: SHI67YTMUr3Q --=-=-= Content-Type: text/plain Max Nikulin writes: > On 05/09/2023 16:42, Ihor Radchenko wrote: >> Max Nikulin writes: >>> >>> From my point of view it will be more sane behavior. However it may >>> require update of 3rd party ox backends. >> >> Yes. The main problem is that I fail to understand the motivation behind >> the current behaviour. git logs reveal that the code is there from the >> initial version of the library. > > Just a guess, likely unrelated to actual decision. For links like > "lisp:" or "shell:" keeping link type does not have much sense (however > stripping it is questionable as well). > > From my point of view, e.g. should be exported > as plain text (identity "a") rather than an (invalid due to > not escaped quotes inside href) link (identity > "a"). > > I still believe that fallback export should preserve link type. Code > links should define their export functions. Let's get started on tackling this problem from not stripping the link type. I am attaching tentative patch to that effect, as a first step. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-export-Do-not-strip-link-type-by-default-during-.patch >From d0b6d3ff62749aaee40ca37964095bbaa3120128 Mon Sep 17 00:00:00 2001 Message-ID: From: Ihor Radchenko Date: Mon, 5 Feb 2024 16:39:05 +0100 Subject: [PATCH] org-export: Do not strip link type by default during export * lisp/ox-html.el (org-html-link): * lisp/ox-latex.el (org-latex-link): * lisp/ox-man.el (org-man-link): * lisp/ox-md.el (org-md-link): * lisp/ox-odt.el (org-odt-link--inline-image): * lisp/ox-texinfo.el (org-texinfo-link): Preserve link type during export for all the links, not just for a hard-coded subset. * etc/ORG-NEWS (Built-in HTML, LaTeX, Man, Markdown, ODT, and Texinfo exporters preserve the link protocol during export): Document the breaking change. Link: https://list.orgmode.org/orgmode/878r9nofpw.fsf@localhost/ --- etc/ORG-NEWS | 18 ++++++++++++++++++ lisp/ox-html.el | 4 +--- lisp/ox-latex.el | 4 +--- lisp/ox-man.el | 4 +--- lisp/ox-md.el | 4 +--- lisp/ox-odt.el | 6 ++---- lisp/ox-texinfo.el | 4 +--- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 965872d23..c5e84b7c7 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,24 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** Important announcements and breaking changes +*** Built-in HTML, LaTeX, Man, Markdown, ODT, and Texinfo exporters preserve the link protocol during export + +Previously, some link types where not exported as =protocol:uri= but +as bare =uri=. This is now changed. + +When a link is known by Org mode and does not have a custom ~:export~ +parameter (see A.3 Adding Hyperlink Types section of the manual), the +link protocol is now not stripped. + +For example, if one adds a link type =tel=, but does not define +~:export~ parameter +: (org-link-set-parameters "tel") +=[[tel:12345][John Doe]]= link will be correctly exported to LaTeX as +=\href{tel:12345}{John Doe}=, not =\href{12345}{John Doe}=. + +However, links like =[[elisp:(+ 1 2)]]= will be exported as +=\url{elisp:(+ 1 2)}=, which may be somewhat unexpected. + *** Org mode now fontifies whole table lines (including newline) according to ~org-table~ face Previously, leading indentation and trailing newline in table rows diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 976c24584..9812ac2b7 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -3231,8 +3231,6 @@ (defun org-html-link (link desc info) (desc (org-string-nw-p desc)) (path (cond - ((member type '("http" "https" "ftp" "mailto" "news")) - (url-encode-url (concat type ":" raw-path))) ((string= "file" type) ;; During publishing, turn absolute file names belonging ;; to base directory into relative file names. Otherwise, @@ -3259,7 +3257,7 @@ (defun org-html-link (link desc info) (concat raw-path "#" (org-publish-resolve-external-link option path t)))))) - (t raw-path))) + (t (url-encode-url (concat type ":" raw-path))))) (attributes-plist (org-combine-plists ;; Extract attributes from parent's paragraph. HACK: Only diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index e3edef3bd..060a01b0e 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2925,12 +2925,10 @@ (defun org-latex-link (link desc info) link (plist-get info :latex-inline-image-rules))) (path (org-latex--protect-text (pcase type - ((or "http" "https" "ftp" "mailto" "doi") - (concat type ":" raw-path)) ("file" (org-export-file-uri raw-path)) (_ - raw-path))))) + (concat type ":" raw-path)))))) (cond ;; Link type is handled by a special function. ((org-export-custom-protocol-maybe link desc 'latex info)) diff --git a/lisp/ox-man.el b/lisp/ox-man.el index 1f296baeb..16058fb9a 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -614,10 +614,8 @@ (defun org-man-link (link desc info) ;; Ensure DESC really exists, or set it to nil. (desc (and (not (string= desc "")) desc)) (path (pcase type - ((or "http" "https" "ftp" "mailto") - (concat type ":" raw-path)) ("file" (org-export-file-uri raw-path)) - (_ raw-path)))) + (_ (concat type ":" raw-path))))) (cond ;; Link type is handled by a special function. ((org-export-custom-protocol-maybe link desc 'man info)) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index b40d75031..5233ec3eb 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -541,11 +541,9 @@ (defun org-md-link (link desc info) (type (org-element-property :type link)) (raw-path (org-element-property :path link)) (path (cond - ((member type '("http" "https" "ftp" "mailto")) - (concat type ":" raw-path)) ((string-equal type "file") (org-export-file-uri (funcall link-org-files-as-md raw-path))) - (t raw-path)))) + (t (concat type ":" raw-path))))) (cond ;; Link type is handled by a special function. ((org-export-custom-protocol-maybe link desc 'md info)) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index f46b25a9a..778cc62cf 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2246,11 +2246,9 @@ (defun org-odt-link--inline-image (element info) (cl-assert (org-element-type-p element 'link)) (let* ((src (let* ((type (org-element-property :type element)) (raw-path (org-element-property :path element))) - (cond ((member type '("http" "https")) - (concat type ":" raw-path)) - ((file-name-absolute-p raw-path) + (cond ((file-name-absolute-p raw-path) (expand-file-name raw-path)) - (t raw-path)))) + (t (concat type ":" raw-path))))) (src-expanded (if (file-name-absolute-p src) src (expand-file-name src (file-name-directory (plist-get info :input-file))))) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index cfbef0c09..f9b73ac6f 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1321,11 +1321,9 @@ (defun org-texinfo-link (link desc info) (desc (and (not (string= desc "")) desc)) (path (org-texinfo--sanitize-content (cond - ((member type '("http" "https" "ftp")) - (concat type ":" raw-path)) ((string-equal type "file") (org-export-file-uri raw-path)) - (t raw-path))))) + (t (concat type ":" raw-path)))))) (cond ((org-export-custom-protocol-maybe link desc 'texinfo info)) ((org-export-inline-image-p link org-texinfo-inline-image-rules) -- 2.43.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--