Merge branch 'maint'
This commit is contained in:
commit
9aaa035e88
|
@ -89,8 +89,6 @@ NOTE: By default, string variable names are interpreted as
|
|||
references to source-code blocks, to force interpretation of a
|
||||
cell's value as a string, prefix the identifier a \"$\" (e.g.,
|
||||
\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\").
|
||||
This will not work with a range; instead, pass it as a list,
|
||||
e.g. (org-sbe fun (r (list $1..$2))).
|
||||
|
||||
NOTE: It is also possible to pass header arguments to the code
|
||||
block. In this case a table cell should hold the string value of
|
||||
|
@ -114,7 +112,7 @@ as shown in the example below.
|
|||
(prog1 nil (setq quote t))
|
||||
(prog1
|
||||
(cond
|
||||
(quote (format "%S" el))
|
||||
(quote (format "\"%s\"" el))
|
||||
((stringp el) (org-no-properties el))
|
||||
(t el))
|
||||
(setq quote nil))))
|
||||
|
@ -134,17 +132,12 @@ as shown in the example below.
|
|||
"("
|
||||
(mapconcat
|
||||
(lambda (var-spec)
|
||||
(cond
|
||||
((> (length (cdr var-spec)) 1)
|
||||
(format "%S='%S"
|
||||
(car var-spec)
|
||||
(mapcar #'read (cdr var-spec))))
|
||||
((stringp (cadr var-spec))
|
||||
(format "%S=%s"
|
||||
(car var-spec) (cadr var-spec)))
|
||||
(t
|
||||
(format "%S=%S"
|
||||
(car var-spec) (cadr var-spec)))))
|
||||
(if (> (length (cdr var-spec)) 1)
|
||||
(format "%S='%S"
|
||||
(car var-spec)
|
||||
(mapcar #'read (cdr var-spec)))
|
||||
(format "%S=%s"
|
||||
(car var-spec) (cadr var-spec))))
|
||||
',variables ", ")
|
||||
")")))))
|
||||
(org-babel-execute-src-block
|
||||
|
|
|
@ -30,51 +30,6 @@
|
|||
;; (org-test-at-id "6d2ff4ce-4489-4e2a-9c65-e3f71f77d975"
|
||||
;; (should (= 2 (sbe take-sqrt (n "4"))))))
|
||||
|
||||
(ert-deftest test-ob-table/sbe-quote ()
|
||||
"Test that `org-sbe' can correctly handle cell values containing quotes."
|
||||
(org-test-table-target-expect
|
||||
"
|
||||
#+name: identity
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
x
|
||||
#+end_src
|
||||
|
||||
| a\"b\"c | replace |
|
||||
"
|
||||
"
|
||||
#+name: identity
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
x
|
||||
#+end_src
|
||||
|
||||
| a\"b\"c | a\"b\"c |
|
||||
"
|
||||
1
|
||||
"#+TBLFM: $2 = '(org-sbe identity (x $$1))"))
|
||||
|
||||
(ert-deftest test-ob-table/sbe-list ()
|
||||
"Test that `org-sbe' can correctly handle ranges as lists."
|
||||
(org-test-table-target-expect
|
||||
"
|
||||
#+name: concat
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
(mapconcat #'identity x \"\")
|
||||
#+end_src
|
||||
|
||||
| foo | bar | replace |
|
||||
"
|
||||
"
|
||||
#+name: concat
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
(mapconcat #'identity x \"\")
|
||||
#+end_src
|
||||
|
||||
| foo | bar | foobar |
|
||||
"
|
||||
1
|
||||
"#+TBLFM: $3 = '(org-sbe concat (x (list $1..$2)))"
|
||||
"#+TBLFM: $3 = '(org-sbe concat (x $ (list $1..$2)))"))
|
||||
|
||||
(provide 'test-ob-table)
|
||||
|
||||
;;; test-ob-table.el ends here
|
||||
|
|
Loading…
Reference in New Issue