From c65ede78b139aee2274e8b38fcc2aaaff83c4b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= Date: Fri, 8 Oct 2021 18:39:02 +0300 Subject: [PATCH 27/76] Deprecate org-export-get-headline-number. --- lisp/org-compat.el | 2 ++ lisp/ox-ascii.el | 6 +++--- lisp/ox-html.el | 8 ++++---- lisp/ox-md.el | 6 +++--- lisp/ox-odt.el | 6 +++--- lisp/ox.el | 8 ++++---- testing/lisp/test-ox.el | 8 ++++---- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index f8725cf39..870cc046e 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -360,6 +360,8 @@ Counting starts at 1." 'org-export-collect-headings "9.5") (define-obsolete-variable-alias 'org-export-filter-headline-functions 'org-export-filter-heading-functions "9.5") +(define-obsolete-function-alias 'org-export-get-headline-number + 'org-export-get-heading-number "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 f848947fc..0e3d27791 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -659,7 +659,7 @@ possible. It doesn't apply to `inlinetask' elements." ;; Numbering is specific to headings. (and headingp (org-export-numbered-headline-p element info) - (let ((numbering (org-export-get-headline-number element info))) + (let ((numbering (org-export-get-heading-number element info))) (if toc (format "%d. " (org-last numbering)) (concat (mapconcat #'number-to-string numbering ".") " "))))) @@ -899,7 +899,7 @@ as a plist." (format (org-ascii--translate "See section %s" info) (if (org-export-numbered-headline-p datum info) (mapconcat #'number-to-string - (org-export-get-headline-number datum info) + (org-export-get-heading-number datum info) ".") (org-export-data (org-element-property :title datum) info)))) (_ @@ -1600,7 +1600,7 @@ INFO is a plist holding contextual information." (`headline (if (org-export-numbered-headline-p destination info) (mapconcat #'number-to-string - (org-export-get-headline-number destination info) + (org-export-get-heading-number destination info) ".") (org-export-data (org-element-property :title destination) info))) ;; Handle enumerable elements and targets within them. diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 39b3aec49..1fbbb1e9a 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2360,7 +2360,7 @@ and value is its relative level, as an integer." (defun org-html--format-toc-headline (heading info) "Return an appropriate table of contents entry for HEADING. INFO is a plist used as a communication channel." - (let* ((heading-number (org-export-get-headline-number heading info)) + (let* ((heading-number (org-export-get-heading-number heading info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property :todo-keyword heading))) (and todo (org-export-data todo info))))) @@ -2607,7 +2607,7 @@ 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)) - (numbers (org-export-get-headline-number 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)))) (todo (and (plist-get info :with-todo-keywords) @@ -3171,7 +3171,7 @@ INFO is a plist holding contextual information. See (if (and (org-export-numbered-headline-p destination info) (not desc)) (mapconcat #'number-to-string - (org-export-get-headline-number + (org-export-get-heading-number destination info) ".") ;; Case 2: Either the heading is un-numbered or ;; LINK has a custom description. Display LINK's @@ -3424,7 +3424,7 @@ holding contextual information." (and (org-export-numbered-headline-p parent info) (mapconcat #'number-to-string - (org-export-get-headline-number parent info) "-")))) + (org-export-get-heading-number parent info) "-")))) ;; Build return value. (format "
\n%s
\n" class-num diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 78f5cafa6..d453fdd0e 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -241,7 +241,7 @@ contents according to the specified element." (bullet (if (not (org-export-numbered-headline-p heading info)) "- " (let ((prefix - (format "%d." (org-last (org-export-get-headline-number + (format "%d." (org-last (org-export-get-heading-number heading info))))) (concat prefix (make-string (max 1 (- 4 (length prefix))) ?\s))))) @@ -376,7 +376,7 @@ a communication channel." (let ((bullet (if (not (org-export-numbered-headline-p heading info)) "-" (concat (number-to-string - (car (last (org-export-get-headline-number + (car (last (org-export-get-heading-number heading info)))) ".")))) (concat bullet (make-string (- 4 (length bullet)) ?\s) heading tags "\n\n" @@ -541,7 +541,7 @@ INFO is a plist holding contextual information. See (cond ((org-string-nw-p desc)) ((org-export-numbered-headline-p destination info) (mapconcat #'number-to-string - (org-export-get-headline-number destination info) + (org-export-get-heading-number destination info) ".")) (t (org-export-data (org-element-property :title destination) info))) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index c5ef01c75..aab08973b 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -1757,7 +1757,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." 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-headline-number heading info)) + (heading-number (org-export-get-heading-number heading info)) (section-number (and (org-export-numbered-headline-p heading info) (mapconcat 'number-to-string heading-number "."))) @@ -2080,7 +2080,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;; Section number. (and scope (mapconcat 'number-to-string - (org-export-get-headline-number scope info) ".")) + (org-export-get-heading-number scope info) ".")) ;; Separator. (and scope ".") ;; Ordinal. @@ -2667,7 +2667,7 @@ Return nil, otherwise." (when heading (format "%s" label - (mapconcat 'number-to-string (org-export-get-headline-number + (mapconcat 'number-to-string (org-export-get-heading-number heading info) ".")))) ;; Case 4: Locate a regular heading in the hierarchy. Display ;; its title. diff --git a/lisp/ox.el b/lisp/ox.el index 1c9bfdc2c..32c679225 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3907,10 +3907,10 @@ process, leading to a different order when footnotes are nested." ;; `org-export-get-relative-level' is a shortcut to get heading ;; level, relatively to the lower heading level in the parsed tree. ;; -;; `org-export-get-headline-number' returns the section number of an +;; `org-export-get-heading-number' returns the section number of an ;; heading, while `org-export-number-to-roman' allows it to be ;; converted to roman numbers. With an optional argument, -;; `org-export-get-headline-number' returns a number to unnumbered +;; `org-export-get-heading-number' returns a number to unnumbered ;; headings (used for internal id). ;; ;; `org-export-low-level-p', `org-export-first-sibling-p' and @@ -3946,7 +3946,7 @@ and the last level being considered as high enough, or nil." (let ((level (org-export-get-relative-level heading info))) (and (> level limit) (- level limit)))))) -(defun org-export-get-headline-number (heading info) +(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) @@ -4559,7 +4559,7 @@ objects of the same type." '(footnote-definition footnote-reference headline item table)))) (cl-case (org-element-type element) ;; Special case 1: A heading returns its number as a list. - (headline (org-export-get-headline-number element info)) + (headline (org-export-get-heading-number element info)) ;; Special case 2: An item returns its number as a list. (item (let ((struct (org-element-property :structure element))) (org-list-get-item-number diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index de6d5957e..e193b7d05 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2602,7 +2602,7 @@ Para2" (org-element-map tree 'headline (lambda (hl) (when (equal (org-element-property :raw-value hl) "H2") - (org-export-get-headline-number hl info))) + (org-export-get-heading-number hl info))) info t))))))) @@ -2640,7 +2640,7 @@ Para2" (plist-put info :headline-levels 1))))))) (ert-deftest test-org-export/get-headline-number () - "Test `org-export-get-headline-number' specifications." + "Test `org-export-get-heading-number' specifications." ;; Standard test. (should (equal @@ -2648,7 +2648,7 @@ Para2" (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n** Headline 2" (org-element-map tree 'headline - (lambda (h) (org-export-get-headline-number h info)) + (lambda (h) (org-export-get-heading-number h info)) info))))) ;; Missing levels are replaced with 0. (should @@ -2657,7 +2657,7 @@ Para2" (let ((org-odd-levels-only nil)) (org-test-with-parsed-data "* Headline 1\n*** Headline 2" (org-element-map tree 'headline - (lambda (h) (org-export-get-headline-number h info)) + (lambda (h) (org-export-get-heading-number h info)) info)))))) (ert-deftest test-org-export/numbered-headline-p () -- 2.33.0