Browse Source

org-export: Allow to toggle inlinetasks inclusion in export output

* contrib/lisp/org-export.el (org-export-options-alist,
  org-export--skip-p): Allow to toggle inlinetask inclusion in export.
(org-export-headline-levels, org-export-with-priority): Fix docstring.
(org-export-with-inlinetasks): New variable.
* testing/lisp/test-org-export.el: Add tests.
Nicolas Goaziou 12 years ago
parent
commit
952d722dcd
2 changed files with 33 additions and 11 deletions
  1. 11 6
      contrib/lisp/org-export.el
  2. 22 5
      testing/lisp/test-org-export.el

+ 11 - 6
contrib/lisp/org-export.el

@@ -138,6 +138,7 @@
     (:with-entities nil "e" org-export-with-entities)
     (:with-entities nil "e" org-export-with-entities)
     (:with-fixed-width nil ":" org-export-with-fixed-width)
     (:with-fixed-width nil ":" org-export-with-fixed-width)
     (:with-footnotes nil "f" org-export-with-footnotes)
     (:with-footnotes nil "f" org-export-with-footnotes)
+    (:with-inlinetasks nil "inline" org-export-with-inlinetasks)
     (:with-plannings nil "p" org-export-with-planning)
     (:with-plannings nil "p" org-export-with-planning)
     (:with-priority nil "pri" org-export-with-priority)
     (:with-priority nil "pri" org-export-with-priority)
     (:with-special-strings nil "-" org-export-with-special-strings)
     (:with-special-strings nil "-" org-export-with-special-strings)
@@ -405,9 +406,7 @@ e.g. \"f:nil\"."
 (defcustom org-export-headline-levels 3
 (defcustom org-export-headline-levels 3
   "The last level which is still exported as a headline.
   "The last level which is still exported as a headline.
 
 
-Inferior levels will produce itemize lists when exported.  Note
-that a numeric prefix argument to an exporter function overrides
-this setting.
+Inferior levels will produce itemize lists when exported.
 
 
 This option can also be set with the #+OPTIONS line, e.g. \"H:2\"."
 This option can also be set with the #+OPTIONS line, e.g. \"H:2\"."
   :group 'org-export-general
   :group 'org-export-general
@@ -444,6 +443,13 @@ e.g. \"e:nil\"."
   :group 'org-export-general
   :group 'org-export-general
   :type 'boolean)
   :type 'boolean)
 
 
+(defcustom org-export-with-inlinetasks t
+  "Non-nil means inlinetasks should be exported.
+This option can also be set with the #+OPTIONS line,
+e.g. \"inline:nil\"."
+  :group 'org-export-general
+  :type 'boolean)
+
 (defcustom org-export-with-planning nil
 (defcustom org-export-with-planning nil
   "Non-nil means include planning info in export.
   "Non-nil means include planning info in export.
 This option can also be set with the #+OPTIONS: line,
 This option can also be set with the #+OPTIONS: line,
@@ -453,9 +459,6 @@ e.g. \"p:t\"."
 
 
 (defcustom org-export-with-priority nil
 (defcustom org-export-with-priority nil
   "Non-nil means include priority cookies in export.
   "Non-nil means include priority cookies in export.
-
-When nil, remove priority cookies for export.
-
 This option can also be set with the #+OPTIONS line,
 This option can also be set with the #+OPTIONS line,
 e.g. \"pri:t\"."
 e.g. \"pri:t\"."
   :group 'org-export-general
   :group 'org-export-general
@@ -1814,6 +1817,8 @@ tag."
 		 (and (memq with-tasks '(todo done))
 		 (and (memq with-tasks '(todo done))
 		      (not (eq todo-type with-tasks)))
 		      (not (eq todo-type with-tasks)))
 		 (and (consp with-tasks) (not (member todo with-tasks))))))))
 		 (and (consp with-tasks) (not (member todo with-tasks))))))))
+    ;; Check inlinetask.
+    (inlinetask (not (plist-get options :with-inlinetasks)))
     ;; Check timestamp.
     ;; Check timestamp.
     (timestamp
     (timestamp
      (case (plist-get options :with-timestamps)
      (case (plist-get options :with-timestamps)

+ 22 - 5
testing/lisp/test-org-export.el

@@ -65,14 +65,14 @@ already filled in `info'."
    (equal
    (equal
     (org-export--parse-option-keyword
     (org-export--parse-option-keyword
      "H:1 num:t \\n:t timestamp:t arch:t author:t creator:t d:t email:t
      "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")
+ *:t e:t ::t f:t pri:t -:t ^:t toc:t |:t tags:t tasks:t <:t todo:t inline:nil")
     '(:headline-levels
     '(:headline-levels
       1 :preserve-breaks t :section-numbers t :time-stamp-file t
       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-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-email t :with-emphasize t :with-entities t :with-fixed-width t
-      :with-footnotes t :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-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)))
   ;; Test some special values.
   ;; Test some special values.
   (should
   (should
    (equal
    (equal
@@ -265,7 +265,24 @@ Paragraph"
 		"CLOSED: [2012-04-29 sun. 10:45]\n"))
 		"CLOSED: [2012-04-29 sun. 10:45]\n"))
 	(should
 	(should
 	 (equal (org-export-as 'test nil nil nil '(:with-plannings nil))
 	 (equal (org-export-as 'test nil nil nil '(:with-plannings nil))
-		""))))))
+		"")))))
+  ;; Inlinetasks.
+  (when (featurep 'org-inlinetask)
+    (should
+     (equal
+      (let ((org-inlinetask-min-level 15))
+	(org-test-with-temp-text "*************** Task"
+	  (org-test-with-backend test
+	    (org-export-as 'test nil nil nil '(:with-inlinetasks nil)))))
+      ""))
+    (should
+     (equal
+      (let ((org-inlinetask-min-level 15))
+	(org-test-with-temp-text
+	    "*************** Task\nContents\n*************** END"
+	  (org-test-with-backend test
+	    (org-export-as 'test nil nil nil '(:with-inlinetasks nil)))))
+      ""))))
 
 
 (ert-deftest test-org-export/comment-tree ()
 (ert-deftest test-org-export/comment-tree ()
   "Test if export process ignores commented trees."
   "Test if export process ignores commented trees."