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/
This commit is contained in:
parent
b0c3c90574
commit
72b0e9ff04
18
etc/ORG-NEWS
18
etc/ORG-NEWS
|
@ -13,6 +13,24 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
|
||||||
|
|
||||||
* Version 9.7 (not released yet)
|
* Version 9.7 (not released yet)
|
||||||
** Important announcements and breaking changes
|
** 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
|
*** 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
|
Previously, when ~org-link-file-path-type~ is set to a function, the
|
||||||
|
|
|
@ -3231,8 +3231,6 @@ INFO is a plist holding contextual information. See
|
||||||
(desc (org-string-nw-p desc))
|
(desc (org-string-nw-p desc))
|
||||||
(path
|
(path
|
||||||
(cond
|
(cond
|
||||||
((member type '("http" "https" "ftp" "mailto" "news"))
|
|
||||||
(url-encode-url (concat type ":" raw-path)))
|
|
||||||
((string= "file" type)
|
((string= "file" type)
|
||||||
;; During publishing, turn absolute file names belonging
|
;; During publishing, turn absolute file names belonging
|
||||||
;; to base directory into relative file names. Otherwise,
|
;; to base directory into relative file names. Otherwise,
|
||||||
|
@ -3259,7 +3257,7 @@ INFO is a plist holding contextual information. See
|
||||||
(concat raw-path
|
(concat raw-path
|
||||||
"#"
|
"#"
|
||||||
(org-publish-resolve-external-link option path t))))))
|
(org-publish-resolve-external-link option path t))))))
|
||||||
(t raw-path)))
|
(t (url-encode-url (concat type ":" raw-path)))))
|
||||||
(attributes-plist
|
(attributes-plist
|
||||||
(org-combine-plists
|
(org-combine-plists
|
||||||
;; Extract attributes from parent's paragraph. HACK: Only
|
;; Extract attributes from parent's paragraph. HACK: Only
|
||||||
|
|
|
@ -2943,12 +2943,10 @@ INFO is a plist holding contextual information. See
|
||||||
link (plist-get info :latex-inline-image-rules)))
|
link (plist-get info :latex-inline-image-rules)))
|
||||||
(path (org-latex--protect-text
|
(path (org-latex--protect-text
|
||||||
(pcase type
|
(pcase type
|
||||||
((or "http" "https" "ftp" "mailto" "doi")
|
|
||||||
(concat type ":" raw-path))
|
|
||||||
("file"
|
("file"
|
||||||
(org-export-file-uri raw-path))
|
(org-export-file-uri raw-path))
|
||||||
(_
|
(_
|
||||||
raw-path)))))
|
(concat type ":" raw-path))))))
|
||||||
(cond
|
(cond
|
||||||
;; Link type is handled by a special function.
|
;; Link type is handled by a special function.
|
||||||
((org-export-custom-protocol-maybe link desc 'latex info))
|
((org-export-custom-protocol-maybe link desc 'latex info))
|
||||||
|
|
|
@ -615,10 +615,8 @@ INFO is a plist holding contextual information. See
|
||||||
;; Ensure DESC really exists, or set it to nil.
|
;; Ensure DESC really exists, or set it to nil.
|
||||||
(desc (and (not (string= desc "")) desc))
|
(desc (and (not (string= desc "")) desc))
|
||||||
(path (pcase type
|
(path (pcase type
|
||||||
((or "http" "https" "ftp" "mailto")
|
|
||||||
(concat type ":" raw-path))
|
|
||||||
("file" (org-export-file-uri raw-path))
|
("file" (org-export-file-uri raw-path))
|
||||||
(_ raw-path))))
|
(_ (concat type ":" raw-path)))))
|
||||||
(cond
|
(cond
|
||||||
;; Link type is handled by a special function.
|
;; Link type is handled by a special function.
|
||||||
((org-export-custom-protocol-maybe link desc 'man info))
|
((org-export-custom-protocol-maybe link desc 'man info))
|
||||||
|
|
|
@ -544,11 +544,9 @@ INFO is a plist holding contextual information. See
|
||||||
(type (org-element-property :type link))
|
(type (org-element-property :type link))
|
||||||
(raw-path (org-element-property :path link))
|
(raw-path (org-element-property :path link))
|
||||||
(path (cond
|
(path (cond
|
||||||
((member type '("http" "https" "ftp" "mailto"))
|
|
||||||
(concat type ":" raw-path))
|
|
||||||
((string-equal type "file")
|
((string-equal type "file")
|
||||||
(org-export-file-uri (funcall link-org-files-as-md raw-path)))
|
(org-export-file-uri (funcall link-org-files-as-md raw-path)))
|
||||||
(t raw-path))))
|
(t (concat type ":" raw-path)))))
|
||||||
(cond
|
(cond
|
||||||
;; Link type is handled by a special function.
|
;; Link type is handled by a special function.
|
||||||
((org-export-custom-protocol-maybe link desc 'md info))
|
((org-export-custom-protocol-maybe link desc 'md info))
|
||||||
|
|
|
@ -2246,11 +2246,9 @@ used as a communication channel."
|
||||||
(cl-assert (org-element-type-p element 'link))
|
(cl-assert (org-element-type-p element 'link))
|
||||||
(let* ((src (let* ((type (org-element-property :type element))
|
(let* ((src (let* ((type (org-element-property :type element))
|
||||||
(raw-path (org-element-property :path element)))
|
(raw-path (org-element-property :path element)))
|
||||||
(cond ((member type '("http" "https"))
|
(cond ((file-name-absolute-p raw-path)
|
||||||
(concat type ":" raw-path))
|
|
||||||
((file-name-absolute-p raw-path)
|
|
||||||
(expand-file-name raw-path))
|
(expand-file-name raw-path))
|
||||||
(t raw-path))))
|
(t (concat type ":" raw-path)))))
|
||||||
(src-expanded (if (file-name-absolute-p src) src
|
(src-expanded (if (file-name-absolute-p src) src
|
||||||
(expand-file-name src (file-name-directory
|
(expand-file-name src (file-name-directory
|
||||||
(plist-get info :input-file)))))
|
(plist-get info :input-file)))))
|
||||||
|
|
|
@ -1326,11 +1326,9 @@ INFO is a plist holding contextual information. See
|
||||||
(desc (and (not (string= desc "")) desc))
|
(desc (and (not (string= desc "")) desc))
|
||||||
(path (org-texinfo--sanitize-content
|
(path (org-texinfo--sanitize-content
|
||||||
(cond
|
(cond
|
||||||
((member type '("http" "https" "ftp"))
|
|
||||||
(concat type ":" raw-path))
|
|
||||||
((string-equal type "file")
|
((string-equal type "file")
|
||||||
(org-export-file-uri raw-path))
|
(org-export-file-uri raw-path))
|
||||||
(t raw-path)))))
|
(t (concat type ":" raw-path))))))
|
||||||
(cond
|
(cond
|
||||||
((org-export-custom-protocol-maybe link desc 'texinfo info))
|
((org-export-custom-protocol-maybe link desc 'texinfo info))
|
||||||
((org-export-inline-image-p link org-texinfo-inline-image-rules)
|
((org-export-inline-image-p link org-texinfo-inline-image-rules)
|
||||||
|
|
Loading…
Reference in New Issue