From c979c9f6de0adb43561307a9896f010d04169dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= Date: Fri, 8 Oct 2021 18:44:40 +0300 Subject: [PATCH 30/76] Deprecate org-export-numbered-headline-p. --- lisp/org-compat.el | 2 ++ lisp/ox-ascii.el | 8 ++++---- lisp/ox-html.el | 8 ++++---- lisp/ox-latex.el | 4 ++-- lisp/ox-md.el | 6 +++--- lisp/ox-odt.el | 14 +++++++------- lisp/ox-texinfo.el | 2 +- lisp/ox.el | 6 +++--- testing/lisp/test-ox.el | 14 +++++++------- 9 files changed, 33 insertions(+), 31 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 07e8ed046..4de2f4de6 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -366,6 +366,8 @@ Counting starts at 1." 'org-export-get-parent-heading "9.5") (define-obsolete-variable-alias 'org-export-headline-levels 'org-export-heading-levels "9.5") +(define-obsolete-function-alias 'org-export-numbered-headline-p + 'org-export-numbered-heading-p "9.5") (defun org-in-fixed-width-region-p () "Non-nil if point in a fixed-width region." diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 416074e59..b56e924cf 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -658,7 +658,7 @@ possible. It doesn't apply to `inlinetask' elements." (numbers ;; Numbering is specific to headings. (and headingp - (org-export-numbered-headline-p element info) + (org-export-numbered-heading-p element info) (let ((numbering (org-export-get-heading-number element info))) (if toc (format "%d. " (org-last numbering)) (concat (mapconcat #'number-to-string numbering ".") @@ -897,7 +897,7 @@ as a plist." (`plain-text (format "See file %s" datum)) ;External file (`headline (format (org-ascii--translate "See section %s" info) - (if (org-export-numbered-headline-p datum info) + (if (org-export-numbered-heading-p datum info) (mapconcat #'number-to-string (org-export-get-heading-number datum info) ".") @@ -913,7 +913,7 @@ as a plist." (pcase (org-element-type enumerable) (`headline (format (org-ascii--translate "See section %s" info) - (if (org-export-numbered-headline-p enumerable info) + (if (org-export-numbered-heading-p enumerable info) (mapconcat #'number-to-string number ".") (org-export-data (org-element-property :title enumerable) info)))) @@ -1598,7 +1598,7 @@ INFO is a plist holding contextual information." ;; External file. (`plain-text destination) (`headline - (if (org-export-numbered-headline-p destination info) + (if (org-export-numbered-heading-p destination info) (mapconcat #'number-to-string (org-export-get-heading-number destination info) ".") diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 9d4210e23..4adf43423 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2379,7 +2379,7 @@ INFO is a plist used as a communication channel." ;; Body. (concat (and (not (org-export-low-level-p heading info)) - (org-export-numbered-headline-p heading info) + (org-export-numbered-heading-p heading info) (concat (mapconcat #'number-to-string heading-number ".") ". ")) (apply (plist-get info :html-format-headline-function) @@ -2606,7 +2606,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS holds the contents of the heading. INFO is a plist holding contextual information." (unless (org-element-property :footnote-section-p heading) - (let* ((numberedp (org-export-numbered-headline-p heading info)) + (let* ((numberedp (org-export-numbered-heading-p heading info)) (numbers (org-export-get-heading-number heading info)) (level (+ (org-export-get-relative-level heading info) (1- (plist-get info :html-toplevel-hlevel)))) @@ -3168,7 +3168,7 @@ INFO is a plist holding contextual information. See (desc ;; Case 1: Heading is numbered and LINK has no ;; description. Display section number. - (if (and (org-export-numbered-headline-p destination info) + (if (and (org-export-numbered-heading-p destination info) (not desc)) (mapconcat #'number-to-string (org-export-get-heading-number @@ -3421,7 +3421,7 @@ holding contextual information." (let* ((class-num (+ (org-export-get-relative-level parent info) (1- (plist-get info :html-toplevel-hlevel)))) (section-number - (and (org-export-numbered-headline-p parent info) + (and (org-export-numbered-heading-p parent info) (mapconcat #'number-to-string (org-export-get-heading-number parent info) "-")))) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index dd8776796..fcec36d35 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1956,7 +1956,7 @@ holding contextual information." (unless (org-element-property :footnote-section-p heading) (let* ((class (plist-get info :latex-class)) (level (org-export-get-relative-level heading info)) - (numberedp (org-export-numbered-headline-p heading info)) + (numberedp (org-export-numbered-heading-p heading info)) (class-sectioning (assoc class (plist-get info :latex-classes))) ;; Section formatting will set two placeholders: one for ;; the title and the other for the contents. @@ -2622,7 +2622,7 @@ INFO is a plist holding contextual information. See (headline (let ((label (org-latex--label destination info t))) (if (and (not desc) - (org-export-numbered-headline-p destination info)) + (org-export-numbered-heading-p destination info)) (format org-latex-reference-command label) (format "\\hyperref[%s]{%s}" label (or desc diff --git a/lisp/ox-md.el b/lisp/ox-md.el index d453fdd0e..d774e4600 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -239,7 +239,7 @@ contents according to the specified element." (* 4 (1- (org-export-get-relative-level heading info))) ?\s)) (bullet - (if (not (org-export-numbered-headline-p heading info)) "- " + (if (not (org-export-numbered-heading-p heading info)) "- " (let ((prefix (format "%d." (org-last (org-export-get-heading-number heading info))))) @@ -374,7 +374,7 @@ a communication channel." (and (eq style 'atx) (> level 6)) (and (eq style 'setext) (> level 2))) (let ((bullet - (if (not (org-export-numbered-headline-p heading info)) "-" + (if (not (org-export-numbered-heading-p heading info)) "-" (concat (number-to-string (car (last (org-export-get-heading-number heading info)))) @@ -539,7 +539,7 @@ INFO is a plist holding contextual information. See "[%s](#%s)" ;; Description. (cond ((org-string-nw-p desc)) - ((org-export-numbered-headline-p destination info) + ((org-export-numbered-heading-p destination info) (mapconcat #'number-to-string (org-export-get-heading-number destination info) ".")) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index c7bcacb4d..a639c6802 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -1758,7 +1758,7 @@ INFO is a plist holding contextual information." (setq backend (or backend (plist-get info :back-end))) (let* ((level (+ (org-export-get-relative-level heading info))) (heading-number (org-export-get-heading-number heading info)) - (section-number (and (org-export-numbered-headline-p heading info) + (section-number (and (org-export-numbered-heading-p heading info) (mapconcat 'number-to-string heading-number "."))) (todo (and (plist-get info :with-todo-keywords) @@ -1796,7 +1796,7 @@ holding contextual information." (let* ((full-text (org-odt-format-headline--wrap heading nil info)) ;; Get level relative to current parsed data. (level (org-export-get-relative-level heading info)) - (numbered (org-export-numbered-headline-p heading info)) + (numbered (org-export-numbered-heading-p heading info)) ;; Get canonical label for the heading. (id (org-export-get-reference heading info)) ;; Extra targets. @@ -2057,7 +2057,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (cl-loop for x in (org-element-lineage element) thereis (and (eq (org-element-type x) 'headline) (<= (org-export-get-relative-level x info) n) - (org-export-numbered-headline-p x info) + (org-export-numbered-heading-p x info) x)))) (--enumerate (lambda (element scope info &optional predicate) @@ -2637,7 +2637,7 @@ Return nil, otherwise." (listified-headline-nos (cl-loop for el in listified-headlines when (eq (org-element-type el) 'headline) - collect (when (org-export-numbered-headline-p el info) + collect (when (org-export-numbered-heading-p el info) (1+ (length (org-export-get-previous-element el info t))))))) ;; Combine item numbers from both the listified headings and @@ -2657,11 +2657,11 @@ Return nil, otherwise." (let ((heading (and ;; Test if destination is a numbered heading. - (org-export-numbered-headline-p destination info) + (org-export-numbered-heading-p destination info) (cl-loop for el in (cons destination genealogy) when (and (eq (org-element-type el) 'headline) (not (org-export-low-level-p el info)) - (org-export-numbered-headline-p el info)) + (org-export-numbered-heading-p el info)) return el)))) ;; We found one. (when heading @@ -3504,7 +3504,7 @@ pertaining to indentation here." (setq parent-list el) (cons "" (format "\n" - (if (org-export-numbered-headline-p + (if (org-export-numbered-heading-p el info) "OrgNumberedList" "OrgBulletedList") diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index d2586e740..ec01523f6 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -873,7 +873,7 @@ holding contextual information." (t (let* ((index (let ((i (org-export-get-node-property :INDEX heading t))) (and (member i '("cp" "fn" "ky" "pg" "tp" "vr")) i))) - (numbered? (org-export-numbered-headline-p heading info)) + (numbered? (org-export-numbered-heading-p heading info)) (notoc? (org-export-excluded-from-toc-p heading info)) (command (and diff --git a/lisp/ox.el b/lisp/ox.el index b109f0fee..60f9527dc 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1684,7 +1684,7 @@ for a footnotes section." (let ((numbering (make-vector org-export-max-depth 0))) (org-element-map data 'headline (lambda (heading) - (when (and (org-export-numbered-headline-p heading options) + (when (and (org-export-numbered-heading-p heading options) (not (org-element-property :footnote-section-p heading))) (let ((relative-level (1- (org-export-get-relative-level heading options)))) @@ -3949,10 +3949,10 @@ and the last level being considered as high enough, or nil." (defun org-export-get-heading-number (heading info) "Return numbered HEADING numbering as a list of numbers. INFO is a plist holding contextual information." - (and (org-export-numbered-headline-p heading info) + (and (org-export-numbered-heading-p heading info) (cdr (assq heading (plist-get info :headline-numbering))))) -(defun org-export-numbered-headline-p (heading info) +(defun org-export-numbered-heading-p (heading info) "Return a non-nil value if HEADING element should be numbered. INFO is a plist used as a communication channel." (unless (org-not-nil (org-export-get-node-property :UNNUMBERED heading t)) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index e193b7d05..790ef93da 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2661,12 +2661,12 @@ Para2" info)))))) (ert-deftest test-org-export/numbered-headline-p () - "Test `org-export-numbered-headline-p' specifications." + "Test `org-export-numbered-heading-p' specifications." ;; If `:section-numbers' is nil, never number headings. (should-not (org-test-with-parsed-data "* Headline" (org-element-map tree 'headline - (lambda (h) (org-export-numbered-headline-p h info)) + (lambda (h) (org-export-numbered-heading-p h info)) (plist-put info :section-numbers nil)))) ;; If `:section-numbers' is a number, only number headings with ;; a level greater that it. @@ -2675,24 +2675,24 @@ Para2" '(yes no) (org-test-with-parsed-data "* Headline 1\n** Headline 2" (org-element-map tree 'headline - (lambda (h) (if (org-export-numbered-headline-p h info) 'yes 'no)) + (lambda (h) (if (org-export-numbered-heading-p h info) 'yes 'no)) (plist-put info :section-numbers 1))))) ;; Otherwise, headings are always numbered. (should (org-test-with-parsed-data "* Headline" (org-element-map tree 'headline - (lambda (h) (org-export-numbered-headline-p h info)) + (lambda (h) (org-export-numbered-heading-p h info)) (plist-put info :section-numbers t)))) ;; With #+OPTIONS: num:nil all headings are unnumbered. (should-not (org-test-with-parsed-data "* H\n#+OPTIONS: num:nil" - (org-export-numbered-headline-p + (org-export-numbered-heading-p (org-element-map tree 'headline 'identity info t) info))) ;; Headings with a non-nil UNNUMBERED property are not numbered. (should-not (org-test-with-parsed-data "* H\n:PROPERTIES:\n:UNNUMBERED: t\n:END:" - (org-export-numbered-headline-p + (org-export-numbered-heading-p (org-element-map tree 'headline #'identity info t) info))) ;; UNNUMBERED is inherited. @@ -2710,7 +2710,7 @@ Para2" ** H3" (org-element-map tree 'headline (lambda (h) - (if (org-export-numbered-headline-p h info) 'numbered + (if (org-export-numbered-heading-p h info) 'numbered 'unnumbered)) info))))) -- 2.33.0