diff options
| author | Stig Brautaset <stig@brautaset.org> | 2016-02-27 22:24:46 +0000 |
|---|---|---|
| committer | Stig Brautaset <stig@brautaset.org> | 2016-02-27 22:24:46 +0000 |
| commit | 0bacbde02232eb2dc281930a52efd44b909e336e (patch) | |
| tree | 0623009812a4d1848fcf28dd7681f78b39b7e17e | |
| parent | ab6dea9a5eb729f09ae8464b0a276571f2389108 (diff) | |
Support table header row
| -rw-r--r-- | ox-jira.el | 10 | ||||
| -rw-r--r-- | ox-jira.org | 15 | ||||
| -rw-r--r-- | test/ox-jira-test.el | 2 | ||||
| -rw-r--r-- | test/ox-jira-test.org | 2 |
4 files changed, 22 insertions, 7 deletions
@@ -249,8 +249,14 @@ contextual information." "Transcode a TABLE-CELL element from Org to JIRA. CONTENTS holds the contents of the table-cell. INFO is a plist holding contextual information." - (concat (format "| %s " contents) - (if (org-export-last-sibling-p table-cell info) "|" ""))) + (let* ((row (org-element-property :parent table-cell)) + (table (org-element-property :parent row)) + (has-header (org-export-table-has-header-p table info)) + (group (org-export-table-row-group row info)) + (is-header (and has-header (eq 1 group))) + (sep (if is-header "||" "|"))) + (format "%s %s %s" sep contents + (if (org-export-last-sibling-p table-cell info) sep "")))) (defun org-jira-statistics-cookie (statistics-cookie _contents _info) "Transcode a STATISTICS-COOKIE object from Org to JIRA. diff --git a/ox-jira.org b/ox-jira.org index 821eff6..ab3c156 100644 --- a/ox-jira.org +++ b/ox-jira.org @@ -481,15 +481,24 @@ (format "%s\n" contents))) #+END_SRC - And table cells: + The cell itself does not know if it is a header cell or not, so we have to + ask its containing row if it is the first row, and the table if it has a + header row at all. If those things are true, make the cell a header cell. #+BEGIN_SRC emacs-lisp (defun org-jira-table-cell (table-cell contents info) "Transcode a TABLE-CELL element from Org to JIRA. CONTENTS holds the contents of the table-cell. INFO is a plist holding contextual information." - (concat (format "| %s " contents) - (if (org-export-last-sibling-p table-cell info) "|" ""))) + ;; (pp table-cell) + (let* ((row (org-element-property :parent table-cell)) + (table (org-element-property :parent row)) + (has-header (org-export-table-has-header-p table info)) + (group (org-export-table-row-group row info)) + (is-header (and has-header (eq 1 group))) + (sep (if is-header "||" "|"))) + (format "%s %s %s" sep contents + (if (org-export-last-sibling-p table-cell info) sep "")))) #+END_SRC diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el index a96c103..5aab8da 100644 --- a/test/ox-jira-test.el +++ b/test/ox-jira-test.el @@ -171,7 +171,7 @@ END; ;; ;; but I haven't figured out how to identify the header row yet. This test ;; checks that we at least ignore the horizontal lines. - (should (equal "| a | b | + (should (equal "|| a || b || | c | d | " (org-export-string-as " | a | b | diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org index 7e4f4bf..75272d7 100644 --- a/test/ox-jira-test.org +++ b/test/ox-jira-test.org @@ -289,7 +289,7 @@ ;; ;; but I haven't figured out how to identify the header row yet. This test ;; checks that we at least ignore the horizontal lines. - (should (equal "| a | b | + (should (equal "|| a || b || | c | d | " (org-export-string-as " | a | b | |
