forked from mirrors/org-mode
org-element: Fix item interpreter when item doesn't start with a paragraph
* contrib/lisp/org-element.el (org-element-item-interpreter): Fix item interpreter when item doesn't start with a paragraph. * testing/lisp/test-org-element.el: Add test.
This commit is contained in:
parent
eb69035d5e
commit
f2bfa3a6b2
|
@ -684,7 +684,10 @@ CONTENTS is the contents of the element."
|
|||
(tag (let ((tag (org-element-property :tag item)))
|
||||
(and tag (org-element-interpret-data tag))))
|
||||
;; Compute indentation.
|
||||
(ind (make-string (length bullet) 32)))
|
||||
(ind (make-string (length bullet) 32))
|
||||
(item-starts-with-par-p
|
||||
(eq (org-element-type (car (org-element-contents item)))
|
||||
'paragraph)))
|
||||
;; Indent contents.
|
||||
(concat
|
||||
bullet
|
||||
|
@ -694,8 +697,10 @@ CONTENTS is the contents of the element."
|
|||
((eq checkbox 'off) "[ ] ")
|
||||
((eq checkbox 'trans) "[-] "))
|
||||
(and tag (format "%s :: " tag))
|
||||
(org-trim
|
||||
(replace-regexp-in-string "\\(^\\)[ \t]*\\S-" ind contents nil nil 1)))))
|
||||
(let ((contents (replace-regexp-in-string
|
||||
"\\(^\\)[ \t]*\\S-" ind contents nil nil 1)))
|
||||
(if item-starts-with-par-p (org-trim contents)
|
||||
(concat "\n" contents))))))
|
||||
|
||||
|
||||
;;;; Plain List
|
||||
|
|
|
@ -1551,6 +1551,7 @@ Outside list"
|
|||
|
||||
(ert-deftest test-org-element/plain-list-interpreter ()
|
||||
"Test plain-list and item interpreters."
|
||||
(let ((org-list-two-spaces-after-bullet-regexp nil))
|
||||
;; 1. Unordered list.
|
||||
(should (equal (org-test-parse-and-interpret "- item 1") "- item 1\n"))
|
||||
;; 2. Description list.
|
||||
|
@ -1570,7 +1571,11 @@ Outside list"
|
|||
(should
|
||||
(equal (org-test-parse-and-interpret
|
||||
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3")
|
||||
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3\n")))
|
||||
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3\n"))
|
||||
;; 6. Item not starting with a paragraph.
|
||||
(should
|
||||
(equal (org-test-parse-and-interpret "-\n | a | b |")
|
||||
"- \n | a | b |\n"))))
|
||||
|
||||
(ert-deftest test-org-element/quote-block-interpreter ()
|
||||
"Test quote block interpreter."
|
||||
|
|
Loading…
Reference in a new issue