Browse Source

Fix table alignment for the docbook exporter

* lisp/org-html.el (org-format-table-html): New argument DOCBOOK.
(org-format-org-table-html): New argument DOCBOOK.  When set, use
align instead of class to align table fields.
* lisp/org-docbook.el (org-export-as-docbook): Specify the docbook argument
for the table converter.
Carsten Dominik 15 years ago
parent
commit
25d365a373
2 changed files with 6 additions and 5 deletions
  1. 2 1
      lisp/org-docbook.el
  2. 4 4
      lisp/org-html.el

+ 2 - 1
lisp/org-docbook.el

@@ -1005,7 +1005,8 @@ publishing directory."
 		    table-orig-buffer (nreverse table-orig-buffer))
 		    table-orig-buffer (nreverse table-orig-buffer))
 	      (org-export-docbook-close-para-maybe)
 	      (org-export-docbook-close-para-maybe)
 	      (insert (org-export-docbook-finalize-table
 	      (insert (org-export-docbook-finalize-table
-		       (org-format-table-html table-buffer table-orig-buffer)))))
+		       (org-format-table-html table-buffer table-orig-buffer
+					      'docbook)))))
 
 
 	   (t
 	   (t
 	    ;; Normal lines
 	    ;; Normal lines

+ 4 - 4
lisp/org-html.el

@@ -1838,13 +1838,13 @@ lang=\"%s\" xml:lang=\"%s\">
 	nil))))
 	nil))))
 
 
 (defvar org-table-number-regexp) ; defined in org-table.el
 (defvar org-table-number-regexp) ; defined in org-table.el
-(defun org-format-table-html (lines olines)
+(defun org-format-table-html (lines olines &optional docbook)
   "Find out which HTML converter to use and return the HTML code."
   "Find out which HTML converter to use and return the HTML code."
   (if (stringp lines)
   (if (stringp lines)
       (setq lines (org-split-string lines "\n")))
       (setq lines (org-split-string lines "\n")))
   (if (string-match "^[ \t]*|" (car lines))
   (if (string-match "^[ \t]*|" (car lines))
       ;; A normal org table
       ;; A normal org table
-      (org-format-org-table-html lines)
+      (org-format-org-table-html lines nil docbook)
     ;; Table made by table.el - test for spanning
     ;; Table made by table.el - test for spanning
     (let* ((hlines (delq nil (mapcar
     (let* ((hlines (delq nil (mapcar
 			      (lambda (x)
 			      (lambda (x)
@@ -1865,7 +1865,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	(org-format-table-table-html-using-table-generate-source olines)))))
 	(org-format-table-table-html-using-table-generate-source olines)))))
 
 
 (defvar org-table-number-fraction) ; defined in org-table.el
 (defvar org-table-number-fraction) ; defined in org-table.el
-(defun org-format-org-table-html (lines &optional splice)
+(defun org-format-org-table-html (lines &optional splice docbook)
   "Format a table into HTML."
   "Format a table into HTML."
   (require 'org-table)
   (require 'org-table)
   ;; Get rid of hlines at beginning and end
   ;; Get rid of hlines at beginning and end
@@ -1997,7 +1997,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		     (if (not org-export-html-table-align-individual-fields)
 		     (if (not org-export-html-table-align-individual-fields)
 			 ""
 			 ""
 		       (setq n (string-to-number (match-string 1 txt)))
 		       (setq n (string-to-number (match-string 1 txt)))
-		       (format " class=\"%s\""
+		       (format (if docbook " align=\"%s\"" " class=\"%s\"")
 			       (or (nth n aligns) "left"))))
 			       (or (nth n aligns) "left"))))
 		   x))
 		   x))
 		html))
 		html))