diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-19 23:59:56 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-20 00:09:59 +0100 |
commit | 82812ff086ccb54eb41cd2f1df3fedea3a709ab8 (patch) | |
tree | ac3431804ad0f89072c02ce991f457fc75bec677 | |
parent | 946f76d7070f8fbcf5c1072b7f53cea599f2e110 (diff) | |
download | org-mode-82812ff086ccb54eb41cd2f1df3fedea3a709ab8.tar.gz |
ox: Fix UNNUMBERED strict inheritance
* lisp/ox.el (org-export-numbered-headline-p): Use a less opinionated
definition of inheritance.
* testing/lisp/test-ox.el (test-org-export/numbered-headline-p):
Update test.
* doc/org.texi (Export settings): Insist on UNNUMBERED inheritance.
It is now possible to number a headline within an unnumbered tree.
-rw-r--r-- | doc/org.texi | 5 | ||||
-rw-r--r-- | lisp/ox.el | 4 | ||||
-rw-r--r-- | testing/lisp/test-ox.el | 18 |
3 files changed, 14 insertions, 13 deletions
diff --git a/doc/org.texi b/doc/org.texi index fa42d2f..21ec0e0 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10790,8 +10790,9 @@ Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}). @cindex property, UNNUMBERED Toggle section-numbers (@code{org-export-with-section-numbers}). When set to number @samp{n}, Org numbers only those headlines at level @samp{n} or above. -Set @code{UNNUMBERED} property to non-@code{nil} to disable numbering of -heading and subheadings entirely. +Setting @code{UNNUMBERED} property to non-@code{nil} disables numbering of +a heading. Since subheadings inherit from this property, it affect their +numbering, too. @item p: @vindex org-export-with-planning @@ -3954,9 +3954,7 @@ INFO is a plist holding contextual information." (defun org-export-numbered-headline-p (headline info) "Return a non-nil value if HEADLINE element should be numbered. INFO is a plist used as a communication channel." - (unless (cl-some - (lambda (head) (org-not-nil (org-element-property :UNNUMBERED head))) - (org-element-lineage headline nil t)) + (unless (org-not-nil (org-export-get-node-property :UNNUMBERED headline t)) (let ((sec-num (plist-get info :section-numbers)) (level (org-export-get-relative-level headline info))) (if (wholenump sec-num) (<= level sec-num) sec-num)))) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 6b5e3a3..7942937 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2474,11 +2474,11 @@ Para2" (org-export-numbered-headline-p (org-element-map tree 'headline #'identity info t) info))) - ;; UNNUMBERED ignores inheritance. Any non-nil value among - ;; ancestors disables numbering. + ;; UNNUMBERED is inherited. (should - (org-test-with-parsed-data - "* H + (equal '(unnumbered numbered unnumbered) + (org-test-with-parsed-data + "* H :PROPERTIES: :UNNUMBERED: t :END: @@ -2486,10 +2486,12 @@ Para2" :PROPERTIES: :UNNUMBERED: nil :END: -*** H3" - (cl-every - (lambda (h) (not (org-export-numbered-headline-p h info))) - (org-element-map tree 'headline #'identity info))))) +** H3" + (org-element-map tree 'headline + (lambda (h) + (if (org-export-numbered-headline-p h info) 'numbered + 'unnumbered)) + info))))) (ert-deftest test-org-export/number-to-roman () "Test `org-export-number-to-roman' specifications." |