Merge branch 'maint'
Conflicts: testing/lisp/test-org-element.el
This commit is contained in:
commit
c57372d5fa
|
@ -514,9 +514,9 @@ Assume point is at the beginning of the block."
|
|||
(pos-before-blank (progn (goto-char block-end-line)
|
||||
(forward-line)
|
||||
(point)))
|
||||
(end (save-excursion (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(end (save-excursion
|
||||
(skip-chars-forward " \r\t\n" limit)
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'center-block
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -567,8 +567,7 @@ Assume point is at beginning of drawer."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'drawer
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -625,8 +624,7 @@ Assume point is at beginning of dynamic block."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'dynamic-block
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -687,8 +685,7 @@ Assume point is at the beginning of the footnote definition."
|
|||
(contents-end (and contents-begin ending))
|
||||
(end (progn (goto-char ending)
|
||||
(skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'footnote-definition
|
||||
(nconc
|
||||
(list :label label
|
||||
|
@ -963,8 +960,7 @@ Assume point is at beginning of the inline task."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position))))
|
||||
(if (eobp) (point) (line-beginning-position))))
|
||||
(inlinetask
|
||||
(list 'inlinetask
|
||||
(nconc
|
||||
|
@ -1311,8 +1307,7 @@ Assume point is at the beginning of the property drawer."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'property-drawer
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1362,8 +1357,7 @@ Assume point is at the beginning of the block."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'quote-block
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1449,8 +1443,7 @@ Assume point is at the beginning of the block."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'special-block
|
||||
(nconc
|
||||
(list :type type
|
||||
|
@ -1506,8 +1499,7 @@ containing `:begin', `:end', `:value', `:post-blank' and
|
|||
(line-end-position))))
|
||||
(pos-before-blank (progn (forward-line) (point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'babel-call
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1654,8 +1646,7 @@ Assume point is at comment block beginning."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position))))
|
||||
(if (eobp) (point) (line-beginning-position))))
|
||||
(value (buffer-substring-no-properties
|
||||
contents-begin contents-end)))
|
||||
(list 'comment-block
|
||||
|
@ -1694,8 +1685,7 @@ containing `:begin', `:end', `:value', `:post-blank' and
|
|||
(org-match-string-no-properties 1)))
|
||||
(pos-before-blank (progn (forward-line) (point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'diary-sexp
|
||||
(nconc
|
||||
(list :value value
|
||||
|
@ -1773,8 +1763,7 @@ containing `:begin', `:end', `:number-lines', `:preserve-indent',
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'example-block
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1836,8 +1825,7 @@ Assume point is at export-block beginning."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position))))
|
||||
(if (eobp) (point) (line-beginning-position))))
|
||||
(value (buffer-substring-no-properties contents-begin
|
||||
contents-end)))
|
||||
(list 'export-block
|
||||
|
@ -1891,8 +1879,7 @@ Assume point is at the beginning of the fixed-width area."
|
|||
(forward-line))
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'fixed-width
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1930,8 +1917,7 @@ keywords."
|
|||
(post-affiliated (point))
|
||||
(post-hr (progn (forward-line) (point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'horizontal-rule
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -1968,8 +1954,7 @@ containing `:key', `:value', `:begin', `:end', `:post-blank' and
|
|||
(match-end 0) (point-at-eol))))
|
||||
(pos-before-blank (progn (forward-line) (point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'keyword
|
||||
(nconc
|
||||
(list :key key
|
||||
|
@ -2016,8 +2001,7 @@ Assume point is at the beginning of the latex environment."
|
|||
(begin (car affiliated))
|
||||
(value (buffer-substring-no-properties code-begin code-end))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'latex-environment
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -2149,8 +2133,7 @@ Assume point is at the beginning of the paragraph."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'paragraph
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -2331,8 +2314,7 @@ Assume point is at the beginning of the block."
|
|||
(point)))
|
||||
;; Get position after ending blank lines.
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'src-block
|
||||
(nconc
|
||||
(list :language language
|
||||
|
@ -2409,8 +2391,7 @@ Assume point is at the beginning of the table."
|
|||
acc))
|
||||
(pos-before-blank (point))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'table
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
@ -2510,8 +2491,7 @@ Assume point is at beginning of the block."
|
|||
(forward-line)
|
||||
(point)))
|
||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||
(skip-chars-backward " \t")
|
||||
(if (bolp) (point) (line-end-position)))))
|
||||
(if (eobp) (point) (line-beginning-position)))))
|
||||
(list 'verse-block
|
||||
(nconc
|
||||
(list :begin begin
|
||||
|
|
|
@ -239,7 +239,11 @@ Some other text
|
|||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+call: test()"
|
||||
(org-element-map (org-element-parse-buffer) 'babel-call 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'babel-call 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+CALL: test()\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Bold
|
||||
|
@ -276,8 +280,12 @@ Some other text
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'center-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'center-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nC\n#+END_CENTER\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Clock
|
||||
|
@ -371,9 +379,8 @@ Some other text
|
|||
'identity nil t)))))
|
||||
;; Correctly handle non-empty blank lines at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "# A\n "
|
||||
(goto-char (org-element-property :end (org-element-at-point)))
|
||||
(eobp))))
|
||||
(org-test-with-temp-text "# A\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Comment Block
|
||||
|
@ -383,18 +390,20 @@ Some other text
|
|||
;; Standard test.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT\nText\n#+END_COMMENT"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity)))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block 'identity)))
|
||||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+begin_comment\nText\n#+end_comment"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity)))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block 'identity)))
|
||||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'comment-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'comment-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_COMMENT\nC\n#+END_COMMENT\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Diary Sexp
|
||||
|
@ -411,7 +420,11 @@ Some other text
|
|||
(should-not
|
||||
(eq 'diary-sexp
|
||||
(org-test-with-temp-text " %%(org-bbdb-anniversaries)"
|
||||
(org-element-type (org-element-at-point))))))
|
||||
(org-element-type (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "%%(org-bbdb-anniversaries)\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Drawer
|
||||
|
@ -425,13 +438,15 @@ Some other text
|
|||
;; Do not mix regular drawers and property drawers.
|
||||
(should-not
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value\n:END:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'drawer 'identity nil t)))
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
|
||||
;; Ignore incomplete drawer.
|
||||
(should-not
|
||||
(org-test-with-temp-text ":TEST:"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'drawer 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ":TEST:\nC\n:END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Dynamic Block
|
||||
|
@ -451,8 +466,12 @@ Some other text
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN: myblock :param1 val1 :param2 val2"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'dynamic-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'dynamic-block
|
||||
'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN: myblock :param val1\nC\n#+END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Entity
|
||||
|
@ -518,7 +537,11 @@ Some other text
|
|||
" L1\n L2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_EXAMPLE\n L1\n L2\n #+END_EXAMPLE"
|
||||
(let ((org-src-preserve-indentation t))
|
||||
(org-element-property :value (org-element-at-point)))))))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_EXAMPLE\nC\n#+END_EXAMPLE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
(ert-deftest test-org-element/block-switches ()
|
||||
"Test `example-block' and `src-block' switches parsing."
|
||||
|
@ -648,20 +671,23 @@ Some other text
|
|||
'export-block 'identity)))
|
||||
;; Ignore case.
|
||||
(should
|
||||
(org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
|
||||
(org-element-map
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-element-parse-buffer))
|
||||
'export-block 'identity)))
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+begin_latex\nText\n#+end_latex"
|
||||
(org-element-map (org-element-parse-buffer) 'export-block 'identity))))
|
||||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX"
|
||||
(org-element-map
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-element-parse-buffer))
|
||||
'export-block 'identity nil t))))
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX"
|
||||
(org-element-map (org-element-parse-buffer) 'export-block
|
||||
'identity nil t))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(let ((org-element-block-name-alist
|
||||
'(("LATEX" . org-element-export-block-parser))))
|
||||
(org-test-with-temp-text "#+BEGIN_LATEX\nC\n#+END_LATEX\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max))))))
|
||||
|
||||
|
||||
;;;; Export Snippet
|
||||
|
@ -681,7 +707,7 @@ Some other text
|
|||
|
||||
;;;; Fixed Width
|
||||
|
||||
(ert-deftest test-org-element/fixed-width ()
|
||||
(ert-deftest test-org-element/fixed-width-parser ()
|
||||
"Test fixed-width area parsing."
|
||||
;; Preserve indentation.
|
||||
(should
|
||||
|
@ -703,8 +729,11 @@ Some other text
|
|||
- Item
|
||||
: fixed-width inside
|
||||
: fixed-width outside"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'fixed-width 'identity))))))
|
||||
(org-element-map (org-element-parse-buffer) 'fixed-width 'identity)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ": A\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Footnote Definition
|
||||
|
@ -731,8 +760,11 @@ Some other text
|
|||
(should
|
||||
(= 9
|
||||
(org-test-with-temp-text "[fn:1]\n\n Body"
|
||||
(org-element-property :contents-begin
|
||||
(org-element-at-point))))))
|
||||
(org-element-property :contents-begin (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "[fn:1] Definition\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Footnotes Reference.
|
||||
|
@ -907,7 +939,11 @@ Some other text
|
|||
;; 4 hyphens is too small.
|
||||
(should-not
|
||||
(org-test-with-temp-text "----"
|
||||
(org-element-map (org-element-parse-buffer) 'horizontal-rule 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'horizontal-rule 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "-----\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Inline Babel Call
|
||||
|
@ -1006,7 +1042,11 @@ DEADLINE: <2012-03-29 thu.>"
|
|||
:END:
|
||||
*************** END"
|
||||
(forward-line)
|
||||
(org-element-property :foo (org-element-at-point)))))))
|
||||
(org-element-property :foo (org-element-at-point))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "*************** Task\n*************** END\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))))
|
||||
|
||||
|
||||
;;;; Italic
|
||||
|
@ -1072,14 +1112,13 @@ DEADLINE: <2012-03-29 thu.>"
|
|||
(should
|
||||
(equal '(("- item"))
|
||||
(org-test-with-temp-text "- - item"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'paragraph 'org-element-contents))))
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph
|
||||
'org-element-contents))))
|
||||
;; Block in an item: ignore indentation within the block.
|
||||
(should
|
||||
(org-test-with-temp-text "- item\n #+begin_src emacs-lisp\n(+ 1 1)\n #+end_src"
|
||||
(forward-char)
|
||||
(goto-char (org-element-property :end (org-element-at-point)))
|
||||
(eobp))))
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Keyword
|
||||
|
@ -1105,7 +1144,11 @@ Paragraph"
|
|||
(org-element-map (org-element-parse-buffer) 'keyword 'identity)))
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN: my-fun\nBody\n#+END:"
|
||||
(org-element-map (org-element-parse-buffer) 'keyword 'identity))))
|
||||
(org-element-map (org-element-parse-buffer) 'keyword 'identity)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+KEYWORD: value\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Latex Environment
|
||||
|
@ -1146,7 +1189,11 @@ e^{i\\pi}+1=0
|
|||
(should-not
|
||||
(eq 'latex-environment
|
||||
(org-test-with-temp-text "\\begin{env}{arg} something\nvalue\n\\end{env}"
|
||||
(org-element-type (org-element-at-point))))))
|
||||
(org-element-type (org-element-at-point)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "\\begin{env}\n\\end{env}\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Latex Fragment
|
||||
|
@ -1399,10 +1446,9 @@ e^{i\\pi}+1=0
|
|||
(should
|
||||
(eq ?#
|
||||
(org-test-with-temp-text "Paragraph\n# Comment"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'paragraph
|
||||
(lambda (p) (char-after (org-element-property :end p)))
|
||||
nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph
|
||||
(lambda (p) (char-after (org-element-property :end p)))
|
||||
nil t))))
|
||||
;; Include ill-formed Keywords.
|
||||
(should
|
||||
(org-test-with-temp-text "#+wrong_keyword something"
|
||||
|
@ -1437,7 +1483,11 @@ e^{i\\pi}+1=0
|
|||
(let ((elem (progn (search-forward "item") (org-element-at-point))))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(not (org-element-property :attr_latex elem))
|
||||
(/= (org-element-property :begin elem) 1))))))
|
||||
(/= (org-element-property :begin elem) 1)))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nC\n#+END_CENTER\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Plain List
|
||||
|
@ -1501,7 +1551,7 @@ Outside list"
|
|||
|
||||
;;;; Property Drawer
|
||||
|
||||
(ert-deftest test-org-element/property-drawer ()
|
||||
(ert-deftest test-org-element/property-drawer-parser ()
|
||||
"Test `property-drawer' parser."
|
||||
;; Standard test.
|
||||
(should
|
||||
|
@ -1517,7 +1567,11 @@ Outside list"
|
|||
(should-not
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:prop: value"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t))))
|
||||
(org-element-parse-buffer) 'property-drawer 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text ":PROPERTIES:\n:END:\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Quote Block
|
||||
|
@ -1531,8 +1585,11 @@ Outside list"
|
|||
;; Ignore incomplete block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_QUOTE"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'quote-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'quote-block 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_QUOTE\nC\n#+END_QUOTE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Quote Section
|
||||
|
@ -1613,7 +1670,11 @@ Outside list"
|
|||
(org-test-with-temp-text "#+BEGIN_SPECIAL*\nContents\n#+END_SPECIAL*"
|
||||
(let ((element (org-element-at-point)))
|
||||
(list (org-element-type element)
|
||||
(org-element-property :type element)))))))
|
||||
(org-element-property :type element))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_SPECIAL\nC\n#+END_SPECIAL\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Src Block
|
||||
|
@ -1646,7 +1707,11 @@ Outside list"
|
|||
" L1\n L2\n"
|
||||
(org-test-with-temp-text " #+BEGIN_SRC org\n L1\n L2\n #+END_SRC"
|
||||
(let ((org-src-preserve-indentation t))
|
||||
(org-element-property :value (org-element-at-point)))))))
|
||||
(org-element-property :value (org-element-at-point))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\nC\n#+END_SRC\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Statistics Cookie
|
||||
|
@ -1745,9 +1810,11 @@ Outside list"
|
|||
(length (org-element-property
|
||||
:tblfm
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'table 'identity nil t))))))
|
||||
;; Do not error when parsing a table with trailing white spaces.
|
||||
(should (org-test-with-temp-text "| a |\n " (org-element-parse-buffer))))
|
||||
(org-element-parse-buffer) 'table 'identity nil t))))))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "| a |\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
;;;; Table Cell
|
||||
|
@ -1912,8 +1979,11 @@ Outside list"
|
|||
;; Ignore incomplete verse block.
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_VERSE"
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'verse-block 'identity nil t))))
|
||||
(org-element-map (org-element-parse-buffer) 'verse-block 'identity nil t)))
|
||||
;; Handle non-empty blank line at the end of buffer.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_VERSE\nC\n#+END_VERSE\n "
|
||||
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue