mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 21:07:54 +00:00
org-element: Interpret headlines according to `org-odd-levels-only'
* lisp/org-element.el (org-element-headline-interpreter): Take into consideration `org-odd-levels-only' value. Small refactoring. * testing/lisp/test-org-element.el (test-org-element/headline-interpreter): Add test.
This commit is contained in:
parent
42271d8c43
commit
2e5b3dede1
|
@ -870,22 +870,24 @@ CONTENTS is the contents of the element."
|
||||||
(org-element-property :tags headline))
|
(org-element-property :tags headline))
|
||||||
(org-element-property :tags headline))))
|
(org-element-property :tags headline))))
|
||||||
(and tag-list
|
(and tag-list
|
||||||
(format ":%s:" (mapconcat 'identity tag-list ":")))))
|
(format ":%s:" (mapconcat #'identity tag-list ":")))))
|
||||||
(commentedp (org-element-property :commentedp headline))
|
(commentedp (org-element-property :commentedp headline))
|
||||||
(quotedp (org-element-property :quotedp headline))
|
(quotedp (org-element-property :quotedp headline))
|
||||||
(pre-blank (or (org-element-property :pre-blank headline) 0))
|
(pre-blank (or (org-element-property :pre-blank headline) 0))
|
||||||
(heading (concat (make-string (org-reduced-level level) ?*)
|
(heading
|
||||||
|
(concat (make-string (if org-odd-levels-only (1- (* level 2)) level)
|
||||||
|
?*)
|
||||||
(and todo (concat " " todo))
|
(and todo (concat " " todo))
|
||||||
(and quotedp (concat " " org-quote-string))
|
(and quotedp (concat " " org-quote-string))
|
||||||
(and commentedp (concat " " org-comment-string))
|
(and commentedp (concat " " org-comment-string))
|
||||||
(and priority
|
(and priority (format " [#%s]" (char-to-string priority)))
|
||||||
(format " [#%s]" (char-to-string priority)))
|
" "
|
||||||
(cond ((and org-footnote-section
|
(if (and org-footnote-section
|
||||||
(org-element-property
|
(org-element-property :footnote-section-p headline))
|
||||||
:footnote-section-p headline))
|
org-footnote-section
|
||||||
(concat " " org-footnote-section))
|
title))))
|
||||||
(title (concat " " title))))))
|
(concat
|
||||||
(concat heading
|
heading
|
||||||
;; Align tags.
|
;; Align tags.
|
||||||
(when tags
|
(when tags
|
||||||
(cond
|
(cond
|
||||||
|
@ -894,13 +896,13 @@ CONTENTS is the contents of the element."
|
||||||
(concat
|
(concat
|
||||||
(make-string
|
(make-string
|
||||||
(max (- (+ org-tags-column (length heading) (length tags))) 1)
|
(max (- (+ org-tags-column (length heading) (length tags))) 1)
|
||||||
? )
|
?\s)
|
||||||
tags))
|
tags))
|
||||||
(t
|
(t
|
||||||
(concat
|
(concat
|
||||||
(make-string (max (- org-tags-column (length heading)) 1) ? )
|
(make-string (max (- org-tags-column (length heading)) 1) ?\s)
|
||||||
tags))))
|
tags))))
|
||||||
(make-string (1+ pre-blank) 10)
|
(make-string (1+ pre-blank) ?\n)
|
||||||
contents)))
|
contents)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2209,7 +2209,12 @@ Outside list"
|
||||||
(should
|
(should
|
||||||
(equal (org-test-parse-and-interpret
|
(equal (org-test-parse-and-interpret
|
||||||
"* Headline\n\n\nText after two blank lines.")
|
"* Headline\n\n\nText after two blank lines.")
|
||||||
"* Headline\n\n\nText after two blank lines.\n")))
|
"* Headline\n\n\nText after two blank lines.\n"))
|
||||||
|
;; 8. Preserve `org-odd-levels-only' state.
|
||||||
|
(should
|
||||||
|
(equal "* H\n*** H2\n"
|
||||||
|
(let ((org-odd-levels-only t))
|
||||||
|
(org-test-parse-and-interpret "* H\n*** H2")))))
|
||||||
|
|
||||||
(ert-deftest test-org-element/inlinetask-interpreter ()
|
(ert-deftest test-org-element/inlinetask-interpreter ()
|
||||||
"Test inlinetask interpretation."
|
"Test inlinetask interpretation."
|
||||||
|
|
Loading…
Reference in a new issue