Browse Source

Export: Fix XHTML validity problem with figure divs

Carsten Dominik 16 years ago
parent
commit
a9618e4e45
2 changed files with 18 additions and 6 deletions
  1. 7 0
      lisp/ChangeLog
  2. 11 6
      lisp/org-exp.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2009-02-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-exp.el (org-export-html-format-image): New argument
+	PAR-OPEN.
+	(org-export-as-html): Pass par-open to
+	`org-export-html-format-image'.
+
 2009-02-01  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-yank-adjusted-subtrees, org-return-follows-link)

+ 11 - 6
lisp/org-exp.el

@@ -3625,7 +3625,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		       (org-file-image-p
 			path org-export-html-inline-image-extensions))
 		  (setq rpl (org-export-html-format-image
-			     (concat type ":" path)))
+			     (concat type ":" path) org-par-open))
 		(setq link (concat type ":" path))
 		(setq rpl (concat "<a href=\""
 				  (org-export-html-format-href link)
@@ -3692,7 +3692,9 @@ lang=\"%s\" xml:lang=\"%s\">
 				   (or (eq t org-export-html-inline-images)
 				       (and org-export-html-inline-images
 					    (not descp))))
-			      (org-export-html-format-image thefile)
+			      (progn
+				(message "image %s %s" thefile org-par-open)
+				(org-export-html-format-image thefile org-par-open))
 			    (concat "<a href=\"" thefile "\"" attr ">"
 				    (org-export-html-format-desc desc)
 				    "</a>")))
@@ -4019,7 +4021,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	(org-html-do-expand s))
     s))
 
-(defun org-export-html-format-image (src)
+(defun org-export-html-format-image (src par-open)
   "Create image tag with source and attributes."
   (save-match-data
     (if (string-match "^ltxpng/" src)
@@ -4027,15 +4029,18 @@ lang=\"%s\" xml:lang=\"%s\">
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
 	     (attr (org-find-text-property-in-string 'org-attributes src))
 	     (label (org-find-text-property-in-string 'org-label src)))
-	(format "<div %sclass=\"figure\">
+	(format "%s<div %sclass=\"figure\">
 <p><img src=\"%s\"%s /></p>%s
-</div>"
+</div>%s"
+		(if org-par-open "</p>\n" "")
 		(if label (format "id=\"%s\" " label) "")
 		src
 		(if (string-match "\\<alt=" (or attr ""))
 		    (concat " " attr )
 		  (concat " " attr " alt=\"" src "\""))
-		(if caption (concat "\n<p>" caption "</p>") ""))))))
+		(if caption (concat "\n<p>" caption "</p>") "")
+		(if org-par-open "\n<p>" ""))))))
+
 
 (defvar org-table-colgroup-info nil)
 (defun org-format-table-ascii (lines)