Преглед изворни кода

Merge branch 'master' of orgmode.org:org-mode

Carsten Dominik пре 14 година
родитељ
комит
0ec831d2c8
3 измењених фајлова са 89 додато и 3 уклоњено
  1. 32 2
      doc/org.texi
  2. 1 1
      lisp/ob-ref.el
  3. 56 0
      testing/lisp/test-org-table.el

+ 32 - 2
doc/org.texi

@@ -11380,12 +11380,32 @@ blocks located in the current Org-mode buffer or in the ``Library of Babel''
 @item <name>
 The name of the code block to be evaluated.
 @item <arguments>
-Arguments specified in this section will be passed to the code block.
+Arguments specified in this section will be passed to the code block.  These
+arguments should relate to @code{:var} header arguments in the called code
+block expressed using standard function call syntax.  For example if the
+original code block named @code{double} has the header argument @code{:var
+n=2}, then the call line passing the number four to that block would be
+written as @code{#+call: double(n=2)}.
 @item <header arguments>
 Header arguments can be placed after the function invocation.  See
 @ref{Header arguments} for more information on header arguments.
 @end table
 
+All header arguments placed in the @code{<header arguments>} section
+described above will be applied to the evaluation of the @code{#+call:} line,
+however it is sometimes desirable to specify header arguments to be passed to
+the code block being evaluated.
+
+This is possible through the use of the following optional extended syntax.
+
+@example
+#+call: <name>[<block header arguments>](<arguments>) <header arguments>
+@end example
+
+Any header argument placed between the square brackets in the @code{<block
+header arguments>} section will be applied to the evaluation of the named
+code block.  For more examples of passing header arguments to @code{#+call:}
+lines see @ref{Header arguments in function calls}.
 
 @node Library of Babel, Languages, Evaluating code blocks, Working With Source Code
 @section Library of Babel
@@ -11644,12 +11664,22 @@ Multi-line header arguments on a named code block:
 @subsubheading Header arguments in function calls
 
 At the most specific level, header arguments for ``Library of Babel'' or
-function call lines can be set as shown below:
+function call lines can be set as shown in the two examples below.  For more
+information on the structure of @code{#+call:} lines see @ref{Evaluating code
+blocks}.
 
+The following will apply the @code{:exports results} header argument to the
+evaluation of the @code{#+call:} line.
 @example
 #+call: factorial(n=5) :exports results
 @end example
 
+The following will apply the @code{:session special} header argument to the
+evaluation of the @code{factorial} code block.
+@example
+#+call: factorial[:session special](n=5)
+@end example
+
 @node Specific header arguments,  , Using header arguments, Header arguments
 @subsection Specific header arguments
 The following header arguments are defined:

+ 1 - 1
lisp/ob-ref.el

@@ -76,7 +76,7 @@ the variable."
       (cons (intern var)
 	    (let ((out (org-babel-read ref)))
 	      (if (equal out ref)
-		  (if (string-match "^\".+\"$" ref)
+		  (if (string-match "^\".*\"$" ref)
 		      (read ref)
 		    (org-babel-ref-resolve ref))
 		out))))))

+ 56 - 0
testing/lisp/test-org-table.el

@@ -0,0 +1,56 @@
+;;; test-org-table.el
+
+;; Copyright (c) ߛ David Maus
+;; Authors: David Maus
+
+;; Released under the GNU General Public License version 3
+;; see: http://www.gnu.org/licenses/gpl-3.0.html
+
+;;;; Comments:
+
+;; Template test file for Org-mode tests
+
+
+;;; Code:
+(let ((load-path (cons (expand-file-name
+			".." (file-name-directory
+			      (or load-file-name buffer-file-name)))
+		       load-path)))
+  (require 'org-test)
+  (require 'org-test-ob-consts))
+
+
+;;; Tests
+(ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
+  "Simple reference @1$1."
+  (should
+   (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
+  "Self reference @1$1."
+  (should
+   (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-an/3 ()
+  "Remote reference."
+  (should
+   (string= "C& = remote(FOO, @@#B&)" (org-table-convert-refs-to-an "$3 = remote(FOO, @@#$2)"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/1 ()
+  "Simple reference @1$1."
+  (should
+   (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/2 ()
+  "Self reference $0."
+  (should
+   (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
+  "Remote reference."
+  (should
+   (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
+
+(provide 'test-org-table)
+
+;;; test-org-table.el ends here