diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index abe62daaf..ca73f06e7 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. + *** When ~org-link-file-path-type~ is a function, its argument is now a filename as it is read by ~org-insert-link~; not an absolute path Previously, when ~org-link-file-path-type~ is set to a function, the 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 @@ INFO is a plist holding contextual information. See (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 @@ INFO is a plist holding contextual information. See (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 7c9cb0ce7..3a7c645d4 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2943,12 +2943,10 @@ INFO is a plist holding contextual information. See 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 5ef4dc63f..958740da8 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -615,10 +615,8 @@ INFO is a plist holding contextual information. See ;; 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 ccbb95575..fa2beeb95 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -544,11 +544,9 @@ INFO is a plist holding contextual information. See (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 a7323c657..666d5da1a 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2246,11 +2246,9 @@ used as a communication channel." (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 22b556751..4aef9c41c 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1326,11 +1326,9 @@ INFO is a plist holding contextual information. See (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)