From ddc02dddeff02b9e339a1a78e66ab706697032c2 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 5 Jan 2014 01:13:54 +0100 Subject: [PATCH] ox: Change meaning of `org-export-with-\(table\|fixed-width\) * lisp/ox.el (org-export-with-fixed-width, org-export-with-tables): Change docstring to reflect new meaning. (org-export--skip-p): Completely ignore tables and fixed-width areas if appropriate option is nil. * testing/lisp/test-ox.el (test-org-export/handle-options): Add tests. --- lisp/ox.el | 30 ++++++++++-------------------- testing/lisp/test-ox.el | 24 +++++++++++++++++++++++- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index d26d0c1..c2ff063 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -457,19 +457,12 @@ This option can also be set with the EXCLUDE_TAGS keyword." :type '(repeat (string :tag "Tag"))) (defcustom org-export-with-fixed-width t - "Non-nil means lines starting with \":\" will be in fixed width font. - -This can be used to have pre-formatted text, fragments of code -etc. For example: - : ;; Some Lisp examples - : (while (defc cnt) - : (ding)) -will be looking just like this in also HTML. See also the QUOTE -keyword. Not all export backends support this. - + "Non-nil means export lines starting with \":\". This option can also be set with the OPTIONS keyword, e.g. \"::nil\"." :group 'org-export-general + :version "24.4" + :package-version '(Org . "8.0") :type 'boolean) (defcustom org-export-with-footnotes t @@ -703,16 +696,12 @@ e.g. \"toc:nil\" or \"toc:3\"." (integer :tag "TOC to level"))) (defcustom org-export-with-tables t - "If non-nil, lines starting with \"|\" define a table. -For example: - - | Name | Address | Birthday | - |-------------+----------+-----------| - | Arthur Dent | England | 29.2.2100 | - + "Non-nil means export tables. This option can also be set with the OPTIONS keyword, e.g. \"|:nil\"." :group 'org-export-general + :version "24.4" + :package-version '(Org . "8.0") :type 'boolean) (defcustom org-export-with-tags t @@ -1440,7 +1429,7 @@ The back-end could then be called with, for example: ;; - category :: option ;; - type :: symbol (nil, t) ;; -;; + `:with-fixed-width' :: Non-nil if transcoder should interpret +;; + `:with-fixed-width' :: Non-nil if transcoder should export ;; strings starting with a colon as a fixed-with (verbatim) area. ;; - category :: option ;; - type :: symbol (nil, t) @@ -1482,8 +1471,7 @@ The back-end could then be called with, for example: ;; - category :: option ;; - type :: symbol (nil, {}, t) ;; -;; + `:with-tables' :: Non-nil means transcoding should interpret -;; tables. +;; + `:with-tables' :: Non-nil means transcoding should export tables. ;; - category :: option ;; - type :: symbol (nil, t) ;; @@ -2091,6 +2079,7 @@ a tree with a select tag." (if (eq (car with-drawers-p) 'not) (member-ignore-case name (cdr with-drawers-p)) (not (member-ignore-case name with-drawers-p)))))))) + (fixed-width (not (plist-get options :with-fixed-width))) ((footnote-definition footnote-reference) (not (plist-get options :with-footnotes))) ((headline inlinetask) @@ -2128,6 +2117,7 @@ a tree with a select tag." (planning (not (plist-get options :with-planning))) (property-drawer (not (plist-get options :with-properties))) (statistics-cookie (not (plist-get options :with-statistics-cookies))) + (table (not (plist-get options :with-tables))) (table-cell (and (org-export-table-has-special-column-p (org-export-get-parent-table blob)) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 0b148e0..78347af 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -430,6 +430,17 @@ Paragraph" (org-test-with-temp-text ":FOO:\nkeep\n:END:\n:BAR:\nremove\n:END:" (org-export-as (org-test-default-backend) nil nil nil '(:with-drawers (not "BAR")))))) + ;; Fixed-width. + (should + (equal ": A\n" + (org-test-with-temp-text ": A" + (org-export-as (org-test-default-backend) nil nil nil + '(:with-fixed-width t))))) + (should + (equal "" + (org-test-with-temp-text ": A" + (org-export-as (org-test-default-backend) nil nil nil + '(:with-fixed-width nil))))) ;; Footnotes. (should (equal "Footnote?" @@ -498,7 +509,18 @@ Paragraph" (equal "" (org-test-with-temp-text "[0/0]" (org-export-as (org-test-default-backend) - nil nil nil '(:with-statistics-cookies nil)))))) + nil nil nil '(:with-statistics-cookies nil))))) + ;; Tables. + (should + (equal "| A |\n" + (org-test-with-temp-text "| A |" + (org-export-as (org-test-default-backend) nil nil nil + '(:with-tables t))))) + (should + (equal "" + (org-test-with-temp-text "| A |" + (org-export-as (org-test-default-backend) nil nil nil + '(:with-tables nil)))))) (ert-deftest test-org-export/with-timestamps () "Test `org-export-with-timestamps' specifications." -- 1.8.5.2