瀏覽代碼

Avoid HTML processing of image specifiers in link descriptions.

A link to an image can function as the description part of a link, to
create a clickable image.  The corresponding image tag was
erroneously processed like normal text.  This patch protects such
descriptions from processing.

Reported by Richard Riley.
Carsten Dominik 16 年之前
父節點
當前提交
0d36db1d39
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. 5 0
      lisp/ChangeLog
  2. 4 2
      lisp/org-exp.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2008-11-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-export-html-format-desc): Respect the
+	org-protect property.
+	(org-export-as-html): Protect image specifiers that are in the
+	description part of a link.
+
 	* org.el (org-sort-entries-or-items, org-completing-read)
 	(org-refile-get-location, org-olpath-completing-read, org-todo)
 	(org-show-todo-tree, org-sparse-tree, org-make-tags-matcher)

+ 4 - 2
lisp/org-exp.el

@@ -3245,7 +3245,9 @@ lang=\"%s\" xml:lang=\"%s\">
 	      (save-match-data
 		(if (string-match "^file:" desc)
 		    (setq desc (substring desc (match-end 0)))))
-	      (setq desc (concat "<img src=\"" desc "\"/>")))
+	      (setq desc (org-add-props
+			     (concat "<img src=\"" desc "\"/>")
+			     '(org-protected t))))
 	    ;; FIXME: do we need to unescape here somewhere?
 	    (cond
 	     ((equal type "internal")
@@ -3623,7 +3625,7 @@ lang=\"%s\" xml:lang=\"%s\">
 
 (defun org-export-html-format-desc (s)
   "Make sure the S is valid as a description in a link."
-  (if s
+  (if (and s (not (get-text-property 1 'org-protected s)))
       (save-match-data
 	(org-html-do-expand s))
     s))