org-export: Fix information returned from table analysis

* contrib/lisp/org-export.el (org-export-table-format-info): Now
  `:width' is properly retrieved with cookies where alignement is
  missing (i.e. "<6>").  Also `:row-groups' contains groups of
  standard lines only (colgroups and width lines are skipped).
This commit is contained in:
Nicolas Goaziou 2012-01-07 18:12:07 +01:00
parent fc895b9574
commit a9f9db68c1
1 changed files with 10 additions and 6 deletions

View File

@ -2678,7 +2678,6 @@ Return a plist whose properties and values are:
(mapc (lambda (row) (mapc (lambda (row)
(if (string-match "^[ \t]*|[-+]+|[ \t]*$" row) (if (string-match "^[ \t]*|[-+]+|[ \t]*$" row)
(incf row-group) (incf row-group)
(push row-group rowgroups)
;; Determine if a special column is present by looking ;; Determine if a special column is present by looking
;; for special markers in the first column. More ;; for special markers in the first column. More
;; accurately, the first column is considered special ;; accurately, the first column is considered special
@ -2696,10 +2695,13 @@ Return a plist whose properties and values are:
((org-table-cookie-line-p row) ((org-table-cookie-line-p row)
(let ((col 0)) (let ((col 0))
(mapc (lambda (field) (mapc (lambda (field)
(when (string-match "<\\([lrc]\\)\\([0-9]+\\)?>" field) (when (string-match
(aset align col (match-string 1 field)) "<\\([lrc]\\)?\\([0-9]+\\)?>" field)
(aset width col (let ((w (match-string 2 field))) (let ((align-data (match-string 1 field)))
(and w (string-to-number w))))) (when align-data (aset align col align-data)))
(let ((w-data (match-string 2 field)))
(when w-data
(aset width col (string-to-number w-data)))))
(incf col)) (incf col))
(org-split-string row "[ \t]*|[ \t]*")))) (org-split-string row "[ \t]*|[ \t]*"))))
;; Read column groups information. ;; Read column groups information.
@ -2711,7 +2713,9 @@ Return a plist whose properties and values are:
((string= ">" field) 'end) ((string= ">" field) 'end)
((string= "<>" field) 'start-end))) ((string= "<>" field) 'start-end)))
(incf col)) (incf col))
(org-split-string row "[ \t]*|[ \t]*")))))) (org-split-string row "[ \t]*|[ \t]*"))))
;; Contents line.
(t (push row-group rowgroups))))
(org-split-string table "\n")) (org-split-string table "\n"))
;; Return plist. ;; Return plist.
(list :alignment align (list :alignment align