Browse Source

Merge branch 'maint'

Nicolas Goaziou 7 years ago
parent
commit
f482cfa785
3 changed files with 16 additions and 15 deletions
  1. 5 4
      doc/org.texi
  2. 1 3
      lisp/ox.el
  3. 10 8
      testing/lisp/test-ox.el

+ 5 - 4
doc/org.texi

@@ -10819,10 +10819,11 @@ 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.  Moreover, when the value is @samp{notoc}
-the headline, and all its children, do not appear in the table of contents
-either (@pxref{Table of contents}).
+Setting @code{UNNUMBERED} property to non-@code{nil} disables numbering of
+the heading.  Since subheadings inherit from this property, it affects their
+numbering, too.  Moreover, when the value is @samp{notoc}, the unnumbered
+headline does not appear in the table of contents either (@pxref{Table of
+contents}).
 
 @item p:
 @vindex org-export-with-planning

+ 1 - 3
lisp/ox.el

@@ -3955,9 +3955,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))))

+ 10 - 8
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."