org-html.el: Fix problems with special chars in links.

* org-html.el (org-export-as-html): Handle links with
`org-html-handle-links' after we handle special characters
conversions.
(org-html-make-link, org-export-html-format-image): Don't
protect html with @ anymore, as links are now handled after
special characters conversions.
This commit is contained in:
Bastien Guerry 2011-03-17 09:07:14 +01:00
parent 7abc267f56
commit 7b74ef1c13
1 changed files with 14 additions and 14 deletions

View File

@ -848,9 +848,9 @@ MAY-INLINE-P allows inlining it as an image."
(message "image %s %s" thefile org-par-open) (message "image %s %s" thefile org-par-open)
(org-export-html-format-image thefile org-par-open)) (org-export-html-format-image thefile org-par-open))
(concat (concat
"@<a href=\"" thefile "\"" (if attr (concat " " attr)) ">" "<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
(org-export-html-format-desc desc) (org-export-html-format-desc desc)
"@</a>"))))) "</a>")))))
(defun org-html-handle-links (line opt-plist) (defun org-html-handle-links (line opt-plist)
"Return LINE with markup of Org mode links. "Return LINE with markup of Org mode links.
@ -1530,9 +1530,6 @@ lang=\"%s\" xml:lang=\"%s\">
"@</a> ") "@</a> ")
t t line))))) t t line)))))
;; Format the links
(setq line (org-html-handle-links line opt-plist))
(setq line (org-html-handle-time-stamps line)) (setq line (org-html-handle-time-stamps line))
;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;" ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
@ -1541,6 +1538,9 @@ lang=\"%s\" xml:lang=\"%s\">
(or (string-match org-table-hline-regexp line) (or (string-match org-table-hline-regexp line)
(setq line (org-html-expand line))) (setq line (org-html-expand line)))
;; Format the links
(setq line (org-html-handle-links line opt-plist))
;; TODO items ;; TODO items
(if (and (string-match org-todo-line-regexp line) (if (and (string-match org-todo-line-regexp line)
(match-beginning 2)) (match-beginning 2))
@ -1829,7 +1829,7 @@ lang=\"%s\" xml:lang=\"%s\">
"Create image tag with source and attributes." "Create image tag with source and attributes."
(save-match-data (save-match-data
(if (string-match "^ltxpng/" src) (if (string-match "^ltxpng/" src)
(format "@<img src=\"%s\" alt=\"%s\"/>" (format "<img src=\"%s\" alt=\"%s\"/>"
src (org-find-text-property-in-string 'org-latex-src src)) src (org-find-text-property-in-string 'org-latex-src src))
(let* ((caption (org-find-text-property-in-string 'org-caption src)) (let* ((caption (org-find-text-property-in-string 'org-caption src))
(attr (org-find-text-property-in-string 'org-attributes src)) (attr (org-find-text-property-in-string 'org-attributes src))
@ -1837,20 +1837,20 @@ lang=\"%s\" xml:lang=\"%s\">
(setq caption (and caption (org-html-do-expand caption))) (setq caption (and caption (org-html-do-expand caption)))
(concat (concat
(if caption (if caption
(format "%s@<div %sclass=\"figure\"> (format "%s<div %sclass=\"figure\">
@<p>" <p>"
(if org-par-open "@</p>\n" "") (if org-par-open "</p>\n" "")
(if label (format "id=\"%s\" " (org-solidify-link-text label)) ""))) (if label (format "id=\"%s\" " (org-solidify-link-text label)) "")))
(format "@<img src=\"%s\"%s />" (format "<img src=\"%s\"%s />"
src src
(if (string-match "\\<alt=" (or attr "")) (if (string-match "\\<alt=" (or attr ""))
(concat " " attr ) (concat " " attr )
(concat " " attr " alt=\"" src "\""))) (concat " " attr " alt=\"" src "\"")))
(if caption (if caption
(format "@</p>%s (format "</p>%s
@</div>%s" </div>%s"
(concat "\n@<p>" caption "@</p>") (concat "\n<p>" caption "</p>")
(if org-par-open "\n@<p>" "")))))))) (if org-par-open "\n<p>" ""))))))))
(defun org-export-html-get-bibliography () (defun org-export-html-get-bibliography ()
"Find bibliography, cut it out and return it." "Find bibliography, cut it out and return it."