Просмотр исходного кода

Make href's in XHTML output valid.

field (or in any other attribute value) must be written as "&" in
order to be valid XHMTL.  This patch implements a new filter function
through which every href value is passed, and which enforces this
standard.

This is was triggered by a report by Sebastian Rose.
Carsten Dominik 16 лет назад
Родитель
Сommit
413d9b73b0
2 измененных файлов с 12 добавлено и 13 удалено
  1. 4 0
      lisp/ChangeLog
  2. 8 13
      lisp/org-exp.el

+ 4 - 0
lisp/ChangeLog

@@ -1,5 +1,9 @@
 2008-11-03  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-exp.el (org-export-as-html): Process href links through
+	`org-export-html-format-href'.
+	(org-export-html-format-href): New function.
+
 	* org-agenda.el (org-agenda-todo): Update only the current
 	headline if this is a repeated TODO, marked done for today.
 	(org-agenda-change-all-lines): New argument JUST-THIS, to change

+ 8 - 13
lisp/org-exp.el

@@ -3549,6 +3549,14 @@ lang=\"%s\" xml:lang=\"%s\">
 	    (kill-buffer (current-buffer)))
 	(current-buffer)))))
 
+(defun org-export-html-format-href (s)
+  "Make sure the S is valid as a href reference in an XHTML document."
+  (save-match-data
+    (let ((start 0))
+      (while (string-match "&" s start)
+	(setq start (+ (match-beginning 0) 3)
+	      s (replace-match "&amp;" t t s)))))
+  s)
 
 (defvar org-table-colgroup-info nil)
 (defun org-format-table-ascii (lines)
@@ -4611,16 +4619,3 @@ The XOXO buffer is named *xoxo-<source buffer name>*"
 ;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95
 
 ;;; org-exp.el ends here
-
-
-(defun org-export-html-format-href (s)
-  (save-match-data
-    (setq s (org-link-escape s org-link-escape-chars-browser))
-    (let ((start 0))
-      (while (string-match "&" s start)
-	(setq start (+ (match-beginning 0) 3)
-	      s (replace-match "&amp;" t t s)))))
-  s)
-
-(defun org-export-html-format-description (s)
-  s)