diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-12-16 00:37:49 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-12-16 00:45:17 +0100 |
commit | 20839ced710269d4c40eadaf480a71723ca41807 (patch) | |
tree | 553fe306a53f8ce4d0d103366e7bf776bf5a3627 | |
parent | c0675b478ed4bcdac16cf5349d035a141048cadc (diff) | |
download | org-mode-20839ced710269d4c40eadaf480a71723ca41807.tar.gz |
org-element: Fix parsing of a list in a block in a list
* lisp/org-element.el (org-element--parse-elements,
org-element-at-point): Fix parsing of a list in a block in a list.
* testing/lisp/test-org-element.el: Add test.
-rw-r--r-- | lisp/org-element.el | 10 | ||||
-rw-r--r-- | testing/lisp/test-org-element.el | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el index 51b8958..ce4fff8 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -3808,7 +3808,8 @@ Elements are accumulated into ACC." 'section)) (plain-list 'item) (table 'table-row)) - (org-element-property :structure element) + (and (memq type '(item plain-list)) + (org-element-property :structure element)) granularity visible-only element)) ;; ELEMENT has contents. Parse objects inside, if ;; GRANULARITY allows it. @@ -4249,8 +4250,11 @@ first element of current section." (plain-list (setq special-flag 'item struct (org-element-property :structure element))) - (table (setq special-flag 'table-row)) - (otherwise (setq special-flag nil))) + (item (setq special-flag nil)) + (property-drawer + (setq special-flag 'node-property struct nil)) + (table (setq special-flag 'table-row struct nil)) + (otherwise (setq special-flag nil struct nil))) (setq end cend) (goto-char cbeg))))))))))) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 236db35..c6a3a7f 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2459,7 +2459,15 @@ Paragraph \\alpha." (equal '(paragraph center-block) (org-test-with-temp-text "#+BEGIN_CENTER\nA\n#+END_CENTER\nZ" (progn (search-forward "Z") - (mapcar 'org-element-type (org-element-at-point t))))))) + (mapcar 'org-element-type (org-element-at-point t)))))) + ;; Parse a list within a block itself contained in a list. + (should + (eq 'plain-list + (org-test-with-temp-text + "- outer\n #+begin_center\n - inner\n #+end_center" + (search-forward "inner") + (beginning-of-line) + (org-element-type (org-element-at-point)))))) (ert-deftest test-org-element/context () "Test `org-element-context' specifications." |