Browse Source

ox-org: Fix headline level during subtree export

* lisp/org-element.el (org-element-headline-interpreter): Take into
  consideration `org-odd-levels-only' when building a headline.
* lisp/ox-org.el (org-org-headline): Correctly set transcoded headline
  level during subtree export.
Nicolas Goaziou 4 years ago
parent
commit
92f89eedba
2 changed files with 3 additions and 1 deletions
  1. 1 1
      lisp/org-element.el
  2. 2 0
      lisp/ox-org.el

+ 1 - 1
lisp/org-element.el

@@ -868,7 +868,7 @@ CONTENTS is the contents of the element."
 	 (commentedp (org-element-property :commentedp headline))
 	 (quotedp (org-element-property :quotedp headline))
 	 (pre-blank (or (org-element-property :pre-blank headline) 0))
-	 (heading (concat (make-string level ?*)
+	 (heading (concat (make-string (org-reduced-level level) ?*)
 			  (and todo (concat " " todo))
 			  (and quotedp (concat " " org-quote-string))
 			  (and commentedp (concat " " org-comment-string))

+ 2 - 0
lisp/ox-org.el

@@ -130,6 +130,8 @@ CONTENTS is its contents, as a string or nil.  INFO is ignored."
     (org-element-put-property headline :tags nil))
   (unless (plist-get info :with-priority)
     (org-element-put-property headline :priority nil))
+  (org-element-put-property headline :level
+			    (org-export-get-relative-level headline info))
   (org-element-headline-interpreter headline contents))
 
 (defun org-org-keyword (keyword contents info)