Просмотр исходного кода

Fix bugs related to includes files in new export system

Nicolas Goaziou 13 лет назад
Родитель
Сommit
c8d9f1438f
2 измененных файлов с 14 добавлено и 12 удалено
  1. 6 4
      contrib/lisp/org-element.el
  2. 8 8
      contrib/lisp/org-export.el

+ 6 - 4
contrib/lisp/org-element.el

@@ -3038,10 +3038,12 @@ Nil values returned from FUN are ignored in the result."
 			  ;; included file becomes a direct child of
 			  ;; the current headline in the buffer.
 			  :headline-offset
-			  ,(- (+ (plist-get
-				  (plist-get --local :inherited-properties)
-				  :level)
-				 (or (plist-get --local :headline-offset) 0))
+			  ,(- (let ((parent
+				     (org-export-get-parent-headline
+				      --blob --local)))
+				(if (not parent) 0
+				  (org-export-get-relative-level
+				   parent --local)))
 			      (1- (org-export-get-min-level
 				   --data --local))))))))
 		   ;; Limiting recursion to greater elements, and --BLOB

+ 8 - 8
contrib/lisp/org-export.el

@@ -2267,17 +2267,17 @@ Return the transcoded string."
       data backend
       (org-combine-plists
        info
-       ;; Store full path of already included files to avoid
-       ;; recursive file inclusion.
+       ;; Store full path of already included files to avoid recursive
+       ;; file inclusion.
        `(:included-files
 	 ,(cons (expand-file-name file) (plist-get info :included-files))
-	 ;; Ensure that a top-level headline in the included
-	 ;; file becomes a direct child of the current headline
-	 ;; in the buffer.
+	 ;; Ensure that a top-level headline in the included file
+	 ;; becomes a direct child of the current headline in the
+	 ;; buffer.
 	 :headline-offset
-	 ,(- (+ (org-element-get-property
-		 :level (org-export-get-parent-headline keyword info))
-		(plist-get info :headline-offset))
+	 ,(- (let ((parent (org-export-get-parent-headline keyword info)))
+	       (if (not parent) 0
+		 (org-export-get-relative-level parent info)))
 	     (1- (org-export-get-min-level data info)))))))))
 
 (defun org-export-get-file-contents (file &optional lines)