Browse Source

HTML export: Specify the scope parameter in table header fields

Carsten Dominik 16 years ago
parent
commit
8a1e3d0773
2 changed files with 28 additions and 10 deletions
  1. 6 0
      lisp/ChangeLog
  2. 22 10
      lisp/org-html.el

+ 6 - 0
lisp/ChangeLog

@@ -1,3 +1,9 @@
+2009-05-08  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-html.el (org-format-org-table-html): Specify the scope.
+	(org-format-table-table-html): Specify the scope.
+	(org-export-table-header-tags): Prepare the scope parameter.
+
 2009-05-07  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-html.el

+ 22 - 10
lisp/org-html.el

@@ -255,9 +255,11 @@ borders and spacing."
   :group 'org-export-html
   :type 'string)
 
-(defcustom org-export-table-header-tags '("<th>" . "</th>")
+(defcustom org-export-table-header-tags '("<th scope=\"%s\">" . "</th>")
   "The opening tag for table header fields.
-This is customizable so that alignment options can be specified."
+This is customizable so that alignment options can be specified.
+%s will be filled with the scope of the field, either row or col.
+See also the variable `org-export-html-table-use-header-tags-for-first-column'."
   :group 'org-export-tables
   :type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
 
@@ -1484,12 +1486,20 @@ lang=\"%s\" xml:lang=\"%s\">
 			 (if (and (< i nlines)
 				  (string-match org-table-number-regexp x))
 			     (incf (aref fnum i)))
-			 (if (or head
-				 (and (= i 0) org-export-html-table-use-header-tags-for-first-column))
-			     (concat (car org-export-table-header-tags) x
-				     (cdr org-export-table-header-tags))
+			 (cond
+			  (head
+			   (concat
+			    (format (car org-export-table-header-tags) "col")
+			    x
+			    (cdr org-export-table-header-tags)))
+			  ((and (= i 0) org-export-html-table-use-header-tags-for-first-column)
+			   (concat
+			    (format (car org-export-table-header-tags) "row")
+			    x
+			    (cdr org-export-table-header-tags)))
+			  (t
 			   (concat (car org-export-table-data-tags) x
-				   (cdr org-export-table-data-tags))))
+				   (cdr org-export-table-data-tags)))))
 		       fields "")
 		      "</tr>")
 	      html)))
@@ -1540,7 +1550,7 @@ This has the advantage that Org-mode's HTML conversions can be used.
 But it has the disadvantage, that no cell- or row-spanning is allowed."
   (let (line field-buffer
 	     (head org-export-highlight-first-table-line)
-	     fields html empty)
+	     fields html empty i)
     (setq html (concat html-table-tag "\n"))
     (while (setq line (pop lines))
       (setq empty "&nbsp;")
@@ -1558,8 +1568,10 @@ But it has the disadvantage, that no cell- or row-spanning is allowed."
 		       (lambda (x)
 			 (if (equal x "") (setq x empty))
 			 (if head
-			     (concat (car org-export-table-header-tags) x
-				     (cdr org-export-table-header-tags))
+			     (concat
+			      (format (car org-export-table-header-tags) "col")
+			      x
+			      (cdr org-export-table-header-tags))
 			   (concat (car org-export-table-data-tags) x
 				   (cdr org-export-table-data-tags))))
 		       field-buffer "\n")