Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2013-07-05 21:14:43 +02:00
commit acb351444e
2 changed files with 18 additions and 8 deletions

View File

@ -1119,7 +1119,11 @@ Assume point is at the beginning of the item."
(defun org-element-item-interpreter (item contents) (defun org-element-item-interpreter (item contents)
"Interpret ITEM element as Org syntax. "Interpret ITEM element as Org syntax.
CONTENTS is the contents of the element." CONTENTS is the contents of the element."
(let* ((bullet (org-list-bullet-string (org-element-property :bullet item))) (let* ((bullet (let ((bullet (org-element-property :bullet item)))
(org-list-bullet-string
(cond ((not (string-match "[0-9a-zA-Z]" bullet)) "- ")
((eq org-plain-list-ordered-item-terminator ?\)) "1)")
(t "1.")))))
(checkbox (org-element-property :checkbox item)) (checkbox (org-element-property :checkbox item))
(counter (org-element-property :counter item)) (counter (org-element-property :counter item))
(tag (let ((tag (org-element-property :tag item))) (tag (let ((tag (org-element-property :tag item)))

View File

@ -2139,30 +2139,36 @@ Outside list"
(ert-deftest test-org-element/plain-list-interpreter () (ert-deftest test-org-element/plain-list-interpreter ()
"Test plain-list and item interpreters." "Test plain-list and item interpreters."
(let ((org-list-two-spaces-after-bullet-regexp nil)) (let ((org-list-two-spaces-after-bullet-regexp nil))
;; 1. Unordered list. ;; Unordered list.
(should (equal (org-test-parse-and-interpret "- item 1") "- item 1\n")) (should (equal (org-test-parse-and-interpret "- item 1") "- item 1\n"))
;; 2. Description list. ;; Description list.
(should (should
(equal (org-test-parse-and-interpret "- tag :: desc") "- tag :: desc\n")) (equal (org-test-parse-and-interpret "- tag :: desc") "- tag :: desc\n"))
;; 3. Ordered list. ;; Ordered list.
(should (should
(equal (let ((org-plain-list-ordered-item-terminator t)) (equal (let ((org-plain-list-ordered-item-terminator t))
(org-test-parse-and-interpret "1. Item")) (org-test-parse-and-interpret "1. Item"))
"1. Item\n")) "1. Item\n"))
;; 4. Ordered list with counter. (should
(equal (let ((org-plain-list-ordered-item-terminator ?\)))
(org-test-parse-and-interpret "1) Item"))
"1) Item\n"))
;; Ordered list with counter.
(should (should
(equal (let ((org-plain-list-ordered-item-terminator t)) (equal (let ((org-plain-list-ordered-item-terminator t))
(org-test-parse-and-interpret "1. [@5] Item")) (org-test-parse-and-interpret "1. [@5] Item"))
"5. [@5] Item\n")) "5. [@5] Item\n"))
;; 5. List with check-boxes. ;; List with check-boxes.
(should (should
(equal (org-test-parse-and-interpret (equal (org-test-parse-and-interpret
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3") "- [-] 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. ;; Item not starting with a paragraph.
(should (should
(equal (org-test-parse-and-interpret "-\n | a | b |") (equal (org-test-parse-and-interpret "-\n | a | b |")
"- \n | a | b |\n")))) "- \n | a | b |\n"))
;; Special case: correctly handle "*" bullets.
(should (org-test-parse-and-interpret " * item"))))
(ert-deftest test-org-element/quote-block-interpreter () (ert-deftest test-org-element/quote-block-interpreter ()
"Test quote block interpreter." "Test quote block interpreter."