mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-26 04:32:52 +00:00
org.el: don't escape image links with no description.
(org-make-link-string): Don't escape image links when no description is provided by the user. Otherwise those images won't be recognized as images when trying to display inline pictures.
This commit is contained in:
parent
f0bbfe50aa
commit
dbde087a21
13
lisp/org.el
13
lisp/org.el
|
@ -8686,16 +8686,19 @@ according to FMT (default from `org-email-link-description-format')."
|
||||||
(setq description (replace-match "{" t t description)))
|
(setq description (replace-match "{" t t description)))
|
||||||
(while (string-match "\\]" description)
|
(while (string-match "\\]" description)
|
||||||
(setq description (replace-match "}" t t description))))
|
(setq description (replace-match "}" t t description))))
|
||||||
(when (equal (org-link-escape link) description)
|
(when (equal link description)
|
||||||
;; No description needed, it is identical
|
;; No description needed, it is identical
|
||||||
(setq description nil))
|
(setq description nil))
|
||||||
(when (and (not description)
|
(when (and (not description)
|
||||||
|
(not (string-match (org-image-file-name-regexp) link))
|
||||||
(not (equal link (org-link-escape link))))
|
(not (equal link (org-link-escape link))))
|
||||||
(setq description (org-extract-attributes link)))
|
(setq description (org-extract-attributes link)))
|
||||||
(setq link (if (string-match org-link-types-re link)
|
(setq link
|
||||||
(concat (match-string 1 link)
|
(cond ((string-match (org-image-file-name-regexp) link) link)
|
||||||
(org-link-escape (substring link (match-end 1))))
|
((string-match org-link-types-re link)
|
||||||
(org-link-escape link)))
|
(concat (match-string 1 link)
|
||||||
|
(org-link-escape (substring link (match-end 1)))))
|
||||||
|
(t (org-link-escape link))))
|
||||||
(concat "[[" link "]"
|
(concat "[[" link "]"
|
||||||
(if description (concat "[" description "]") "")
|
(if description (concat "[" description "]") "")
|
||||||
"]"))
|
"]"))
|
||||||
|
|
Loading…
Reference in a new issue