forked from mirrors/org-mode
org-element: Fix table parsing with missing final bar
* lisp/org-element.el (org-element-table-cell-parser, org-element-table-cell-successor): Recognize cell even when last vertical bar is missing. * testing/lisp/test-org-element.el (test-org-element/table-cell-parser): Add test. Thanks to Thorsten Jolitz for reporting it. http://permalink.gmane.org/gmane.emacs.orgmode/84713
This commit is contained in:
parent
0820d002cb
commit
728661309e
|
@ -3467,7 +3467,7 @@ CONTENTS is the contents of the object."
|
|||
Return a list whose CAR is `table-cell' and CDR is a plist
|
||||
containing `:begin', `:end', `:contents-begin', `:contents-end'
|
||||
and `:post-blank' keywords."
|
||||
(looking-at "[ \t]*\\(.*?\\)[ \t]*|")
|
||||
(looking-at "[ \t]*\\(.*?\\)[ \t]*\\(?:|\\|$\\)")
|
||||
(let* ((begin (match-beginning 0))
|
||||
(end (match-end 0))
|
||||
(contents-begin (match-beginning 1))
|
||||
|
@ -3489,7 +3489,7 @@ CONTENTS is the contents of the cell, or nil."
|
|||
|
||||
Return value is a cons cell whose CAR is `table-cell' and CDR is
|
||||
beginning position."
|
||||
(when (looking-at "[ \t]*.*?[ \t]*|") (cons 'table-cell (point))))
|
||||
(when (looking-at "[ \t]*.*?[ \t]*\\(|\\|$\\)") (cons 'table-cell (point))))
|
||||
|
||||
|
||||
;;;; Target
|
||||
|
|
|
@ -1922,8 +1922,13 @@ Outside list"
|
|||
|
||||
(ert-deftest test-org-element/table-cell-parser ()
|
||||
"Test `table-cell' parser."
|
||||
;; Regular table cell.
|
||||
(should
|
||||
(org-test-with-temp-text "| a |"
|
||||
(org-element-map (org-element-parse-buffer) 'table-cell 'identity)))
|
||||
;; Last vertical bar may be omitted.
|
||||
(should
|
||||
(org-test-with-temp-text "| a "
|
||||
(org-element-map (org-element-parse-buffer) 'table-cell 'identity))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue