From a2b4ef1ad24cbd816491122d0e969fecc6739377 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 10 Apr 2013 14:38:13 +0200 Subject: [PATCH] ox: Don't skip timestamps within tables * lisp/ox.el (org-export--skip-p): Never skip a timestamp within a table. (org-export-with-timestamps): Update docstring accordingly. * testing/lisp/test-ox.el: Add test. --- lisp/ox.el | 32 +++++++++++++++++++------------- testing/lisp/test-ox.el | 7 ++++++- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 7f33755..a9667d9 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -721,6 +721,9 @@ It can be set to `active', `inactive', t or nil, in order to export, respectively, only active timestamps, only inactive ones, all of them or none. +This variable has no effect on timestamps within tables, which +will always be exported. + This option can also be set with the OPTIONS keyword, e.g. \"<:nil\"." :group 'org-export-general @@ -2013,19 +2016,22 @@ a tree with a select tag." (not (org-export-get-previous-element blob options)))) (table-row (org-export-table-row-is-special-p blob options)) (timestamp - (case (plist-get options :with-timestamps) - ;; No timestamp allowed. - ('nil t) - ;; Only active timestamps allowed and the current one isn't - ;; active. - (active - (not (memq (org-element-property :type blob) - '(active active-range)))) - ;; Only inactive timestamps allowed and the current one isn't - ;; inactive. - (inactive - (not (memq (org-element-property :type blob) - '(inactive inactive-range)))))))) + ;; Timestamps in tables are not affected by `:with-timestamps'. + (unless (eq (org-element-type (org-export-get-parent-element blob)) + 'table-row) + (case (plist-get options :with-timestamps) + ;; No timestamp allowed. + ('nil t) + ;; Only active timestamps allowed and the current one isn't + ;; active. + (active + (not (memq (org-element-property :type blob) + '(active active-range)))) + ;; Only inactive timestamps allowed and the current one isn't + ;; inactive. + (inactive + (not (memq (org-element-property :type blob) + '(inactive inactive-range))))))))) ;;; The Transcoder diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 6203f8b..0900037 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -408,7 +408,12 @@ Paragraph" "<2012-04-29 sun. 10:45>\n")) (should (equal (org-export-as 'test nil nil nil '(:with-timestamps inactive)) - "[2012-04-29 sun. 10:45]\n"))))) + "[2012-04-29 sun. 10:45]\n")))) + (should + (equal "| [2012-03-29 Thu] |\n" + (org-test-with-temp-text "| [2012-03-29 Thu] |" + (org-test-with-backend test + (org-export-as 'test nil nil nil '(:with-timestamps nil))))))) (ert-deftest test-org-export/comment-tree () "Test if export process ignores commented trees." -- 1.8.2.1