فهرست منبع

org-export: Fix regression in headline numbering

* contrib/lisp/org-export.el (org-export-collect-tree-properties):
  Ensure `:headline-offset' is filled before `:headline-numbering'
  since the latter depends on the former.
(org-export-collect-headline-numbering): Use headline elements as keys
  in the returned alist, instead of just beginning numbers.
(org-export-get-headline-number): Apply key change.
Nicolas Goaziou 13 سال پیش
والد
کامیت
e270792bd8
1فایلهای تغییر یافته به همراه11 افزوده شده و 9 حذف شده
  1. 11 9
      contrib/lisp/org-export.el

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

@@ -1124,12 +1124,16 @@ Following tree properties are set:
   (setq info
 	(org-combine-plists
 	 info `(:use-select-tags ,(org-export-use-select-tags-p data info))))
-  ;; Get the rest of the tree properties, now `:use-select-tags' is
-  ;; set...
+  ;; Then get `:headline-offset' in order to be able to use
+  ;; `org-export-get-relative-level'.
+  (setq info
+	(org-combine-plists
+	 info `(:headline-offset ,(- 1 (org-export-get-min-level data info)))))
+  ;; Now, get the rest of the tree properties, now `:use-select-tags'
+  ;; is set...
   (nconc
    `(:parse-tree
      ,data
-     :headline-offset ,(- 1 (org-export-get-min-level data info))
      :point-max ,(org-export-get-point-max data info)
      :target-list
      ,(org-element-map data 'target (lambda (target local) target) info)
@@ -1186,9 +1190,8 @@ OPTIONS is a plist holding export options."
 DATA is the parse tree.  OPTIONS is the plist holding export
 options.
 
-Return an alist whose key is headline's beginning position and
-value is its associated numbering (in the shape of a list of
-numbers)."
+Return an alist whose key is an headline and value is its
+associated numbering \(in the shape of a list of numbers\)."
   (let ((numbering (make-vector org-export-max-depth 0)))
     (org-element-map
      data
@@ -1197,7 +1200,7 @@ numbers)."
        (let ((relative-level
 	      (1- (org-export-get-relative-level headline info))))
 	 (cons
-	  (org-element-get-property :begin headline)
+	  headline
 	  (loop for n across numbering
 		for idx from 0 to org-export-max-depth
 		when (< idx relative-level) collect n
@@ -2079,8 +2082,7 @@ and the last level being considered as high enough, or nil."
 (defun org-export-get-headline-number (headline info)
   "Return HEADLINE numbering as a list of numbers.
 INFO is a plist holding contextual information."
-  (cdr (assq (org-element-get-property :begin headline)
-	     (plist-get info :headline-numbering))))
+  (cdr (assoc headline (plist-get info :headline-numbering))))
 
 (defun org-export-number-to-roman (n)
   "Convert integer N into a roman numeral."