diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index a1e336657..23389fed9 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -142,6 +142,7 @@ (:with-plannings nil "p" org-export-with-planning) (:with-priority nil "pri" org-export-with-priority) (:with-special-strings nil "-" org-export-with-special-strings) + (:with-statistics-cookies nil "stat" org-export-with-statistics-cookies) (:with-sub-superscript nil "^" org-export-with-sub-superscripts) (:with-toc nil "toc" org-export-with-toc) (:with-tables nil "|" org-export-with-tables) @@ -504,6 +505,13 @@ e.g. \"-:nil\"." :group 'org-export-general :type 'boolean) +(defcustom org-export-with-statistics-cookies t + "Non-nil means include statistics cookies in export. +This option can also be set with the #+OPTIONS: line, +e.g. \"stat:nil\"" + :group 'org-export-general + :type 'boolean) + (defcustom org-export-with-sub-superscripts t "Non-nil means interpret \"_\" and \"^\" for export. @@ -1796,7 +1804,12 @@ OPTIONS is the plist holding export options. SELECTED, when non-nil, is a list of headlines belonging to a tree with a select tag." (case (org-element-type blob) - ;; Check headline. + (clock (not (plist-get options :with-clocks))) + (drawer + (or (not (plist-get options :with-drawers)) + (and (consp (plist-get options :with-drawers)) + (not (member (org-element-property :drawer-name blob) + (plist-get options :with-drawers)))))) (headline (let ((with-tasks (plist-get options :with-tasks)) (todo (org-element-property :todo-keyword blob)) @@ -1820,9 +1833,14 @@ tag." (and (memq with-tasks '(todo done)) (not (eq todo-type with-tasks))) (and (consp with-tasks) (not (member todo with-tasks)))))))) - ;; Check inlinetask. (inlinetask (not (plist-get options :with-inlinetasks))) - ;; Check timestamp. + (planning (not (plist-get options :with-plannings))) + (statistics-cookie (not (plist-get options :with-statistics-cookies))) + (table-cell + (and (org-export-table-has-special-column-p + (org-export-get-parent-table blob)) + (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. @@ -1836,24 +1854,7 @@ tag." ;; inactive. (inactive (not (memq (org-element-property :type blob) - '(inactive inactive-range)))))) - ;; Check drawer. - (drawer - (or (not (plist-get options :with-drawers)) - (and (consp (plist-get options :with-drawers)) - (not (member (org-element-property :drawer-name blob) - (plist-get options :with-drawers)))))) - ;; Check table-row. - (table-row (org-export-table-row-is-special-p blob options)) - ;; Check table-cell. - (table-cell - (and (org-export-table-has-special-column-p - (org-export-get-parent-table blob)) - (not (org-export-get-previous-element blob options)))) - ;; Check clock. - (clock (not (plist-get options :with-clocks))) - ;; Check planning. - (planning (not (plist-get options :with-plannings))))) + '(inactive inactive-range)))))))) diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el index 7ef578964..5bc2086a0 100644 --- a/testing/lisp/test-org-export.el +++ b/testing/lisp/test-org-export.el @@ -65,14 +65,16 @@ already filled in `info'." (equal (org-export--parse-option-keyword "H:1 num:t \\n:t timestamp:t arch:t author:t creator:t d:t email:t - *:t e:t ::t f:t pri:t -:t ^:t toc:t |:t tags:t tasks:t <:t todo:t inline:nil") + *:t e:t ::t f:t pri:t -:t ^:t toc:t |:t tags:t tasks:t <:t todo:t inline:nil + stat:t") '(:headline-levels 1 :preserve-breaks t :section-numbers t :time-stamp-file t :with-archived-trees t :with-author t :with-creator t :with-drawers t :with-email t :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-inlinetasks nil :with-priority t - :with-special-strings t :with-sub-superscript t :with-toc t :with-tables t - :with-tags t :with-tasks t :with-timestamps t :with-todo-keywords t))) + :with-special-strings t :with-statistics-cookies t :with-sub-superscript t + :with-toc t :with-tables t :with-tags t :with-tasks t :with-timestamps t + :with-todo-keywords t))) ;; Test some special values. (should (equal @@ -282,7 +284,14 @@ Paragraph" "*************** Task\nContents\n*************** END" (org-test-with-backend test (org-export-as 'test nil nil nil '(:with-inlinetasks nil))))) - "")))) + ""))) + ;; Statistics cookies. + (should + (equal "" + (org-test-with-temp-text "[0/0]" + (org-test-with-backend test + (org-export-as + 'test nil nil nil '(:with-statistics-cookies nil))))))) (ert-deftest test-org-export/comment-tree () "Test if export process ignores commented trees."