Merge branch 'maint'
This commit is contained in:
commit
dbed60d6bd
|
@ -1637,30 +1637,37 @@ containing `:call', `:inside-header', `:arguments',
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let* ((begin (car affiliated))
|
(let* ((begin (car affiliated))
|
||||||
(post-affiliated (point))
|
(post-affiliated (point))
|
||||||
(value (progn (search-forward ":" nil t)
|
(before-blank (line-beginning-position 2))
|
||||||
|
(value (progn (search-forward ":" before-blank t)
|
||||||
|
(skip-chars-forward " \t")
|
||||||
(org-trim
|
(org-trim
|
||||||
(buffer-substring-no-properties
|
(buffer-substring-no-properties
|
||||||
(point) (line-end-position)))))
|
(point) (line-end-position)))))
|
||||||
(pos-before-blank (progn (forward-line) (point)))
|
(call
|
||||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
(or (org-string-nw-p
|
||||||
(if (eobp) (point) (line-beginning-position))))
|
(buffer-substring-no-properties
|
||||||
(valid-value
|
(point) (progn (skip-chars-forward "^[]()" before-blank)
|
||||||
(string-match
|
(point))))))
|
||||||
"\\([^()\n]+?\\)\\(?:\\[\\(.*?\\)\\]\\)?(\\(.*\\))[ \t]*\\(.*\\)"
|
(inside-header (org-element--parse-paired-brackets ?\[))
|
||||||
value)))
|
(arguments (org-string-nw-p
|
||||||
|
(org-element--parse-paired-brackets ?\()))
|
||||||
|
(end-header
|
||||||
|
(org-string-nw-p
|
||||||
|
(org-trim
|
||||||
|
(buffer-substring-no-properties (point) (line-end-position)))))
|
||||||
|
(end (progn (forward-line)
|
||||||
|
(skip-chars-forward " \r\t\n" limit)
|
||||||
|
(if (eobp) (point) (line-beginning-position)))))
|
||||||
(list 'babel-call
|
(list 'babel-call
|
||||||
(nconc
|
(nconc
|
||||||
(list :call (and valid-value (match-string 1 value))
|
(list :call call
|
||||||
:inside-header (and valid-value
|
:inside-header inside-header
|
||||||
(org-string-nw-p (match-string 2 value)))
|
:arguments arguments
|
||||||
:arguments (and valid-value
|
:end-header end-header
|
||||||
(org-string-nw-p (match-string 3 value)))
|
|
||||||
:end-header (and valid-value
|
|
||||||
(org-string-nw-p (match-string 4 value)))
|
|
||||||
:begin begin
|
:begin begin
|
||||||
:end end
|
:end end
|
||||||
:value value
|
:value value
|
||||||
:post-blank (count-lines pos-before-blank end)
|
:post-blank (count-lines before-blank end)
|
||||||
:post-affiliated post-affiliated)
|
:post-affiliated post-affiliated)
|
||||||
(cdr affiliated))))))
|
(cdr affiliated))))))
|
||||||
|
|
||||||
|
|
|
@ -432,12 +432,18 @@ Some other text
|
||||||
(equal "test"
|
(equal "test"
|
||||||
(org-test-with-temp-text "#+CALL: test()"
|
(org-test-with-temp-text "#+CALL: test()"
|
||||||
(org-element-property :call (org-element-at-point)))))
|
(org-element-property :call (org-element-at-point)))))
|
||||||
;; Parse inside header.
|
;; Parse inside header. It may contain paired square brackets.
|
||||||
(should
|
(should
|
||||||
(equal ":results output"
|
(equal ":results output"
|
||||||
(org-test-with-temp-text "#+CALL: test[:results output]()"
|
(org-test-with-temp-text "#+CALL: test[:results output]()"
|
||||||
(org-element-property :inside-header (org-element-at-point)))))
|
(org-element-property :inside-header (org-element-at-point)))))
|
||||||
;; Parse arguments, which can be nested.
|
(should
|
||||||
|
(equal ":results output, a=table[1:2], b=2"
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"#+CALL: test[:results output, a=table[1:2], b=2]()"
|
||||||
|
(org-element-property :inside-header (org-element-at-point)))))
|
||||||
|
;; Parse arguments, which can be nested. However, stop at paired
|
||||||
|
;; parenthesis, even when, e.g.,end header contains some.
|
||||||
(should
|
(should
|
||||||
(equal "n=4"
|
(equal "n=4"
|
||||||
(org-test-with-temp-text "#+CALL: test(n=4)"
|
(org-test-with-temp-text "#+CALL: test(n=4)"
|
||||||
|
@ -446,6 +452,10 @@ Some other text
|
||||||
(equal "test()"
|
(equal "test()"
|
||||||
(org-test-with-temp-text "#+CALL: test(test())"
|
(org-test-with-temp-text "#+CALL: test(test())"
|
||||||
(org-element-property :arguments (org-element-at-point)))))
|
(org-element-property :arguments (org-element-at-point)))))
|
||||||
|
(should
|
||||||
|
(equal "a=1"
|
||||||
|
(org-test-with-temp-text "#+CALL: test(a=1) :post another-call()"
|
||||||
|
(org-element-property :arguments (org-element-at-point)))))
|
||||||
;; Parse end header.
|
;; Parse end header.
|
||||||
(should
|
(should
|
||||||
(equal ":results html"
|
(equal ":results html"
|
||||||
|
|
Loading…
Reference in New Issue