* doc/org.texi: Cleaned up :var table
This commit is contained in:
parent
630b9c80ca
commit
90aa84ffc1
53
doc/org.texi
53
doc/org.texi
|
@ -12249,18 +12249,17 @@ The following syntax is used to pass arguments to code blocks using the
|
||||||
:var name=assign
|
:var name=assign
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
where @code{assign} can take one of the following forms
|
The argument, @code{assign}, can either be a literal value, such as a string
|
||||||
|
@samp{"string"} or a number @samp{9}, or a reference to a table, a list, a
|
||||||
|
literal example, another code block (with or without arguments), or the
|
||||||
|
results of evaluating another code block.
|
||||||
|
|
||||||
|
Here are examples of passing values by reference:
|
||||||
|
|
||||||
|
@table @dfn
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item literal value
|
|
||||||
either a string @samp{"string"} or a number @samp{9}.
|
|
||||||
@item reference
|
|
||||||
tables, lists, literal examples, other code blocks, and results blocks can
|
|
||||||
all be passed by reference
|
|
||||||
@table @asis
|
|
||||||
@item table
|
@item table
|
||||||
@end table
|
an Org mode table named with either a @code{#+NAME:} or @code{#+TBLNAME:} line
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+TBLNAME: example-table
|
#+TBLNAME: example-table
|
||||||
| 1 |
|
| 1 |
|
||||||
|
@ -12278,27 +12277,26 @@ all be passed by reference
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item list
|
@item list
|
||||||
a named, simple list. Nesting is not carried through to the source code
|
a named, simple list (note that nesting is not carried through to the source
|
||||||
block.
|
code block)
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+NAME: example-list
|
#+NAME: example-list
|
||||||
- simple
|
- simple
|
||||||
- not
|
- not
|
||||||
- nested
|
- nested
|
||||||
- lists
|
- list
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :var x=example-list
|
#+BEGIN_SRC emacs-lisp :var x=example-list
|
||||||
(print x)
|
(print x)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
| simple | lists |
|
| simple | list |
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item code block
|
@item code block without arguments
|
||||||
a code block name, as assigned by @code{#+NAME:}, followed by
|
a code block name, as assigned by @code{#+NAME:}, followed by parentheses
|
||||||
parentheses:
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+BEGIN_SRC emacs-lisp :var length=table-length()
|
#+BEGIN_SRC emacs-lisp :var length=table-length()
|
||||||
|
@ -12309,9 +12307,10 @@ parentheses:
|
||||||
: 8
|
: 8
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
In addition, an argument can be passed to the code block referenced by
|
@item code block with arguments
|
||||||
@code{:var}. The argument is passed within the parentheses following the
|
a code block name, as assigned by @code{#+NAME:}, followed by parentheses and
|
||||||
code block name using standard function call syntax:
|
optional arguments passed within the parentheses following the
|
||||||
|
code block name using standard function call syntax
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+NAME: double
|
#+NAME: double
|
||||||
|
@ -12332,7 +12331,7 @@ code block name using standard function call syntax:
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item literal example
|
@item literal example
|
||||||
named literal examples are passed intact
|
a named literal example block
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+NAME: literal-example
|
#+NAME: literal-example
|
||||||
|
@ -12353,26 +12352,24 @@ on two lines
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item results block
|
@item results block
|
||||||
|
named results blocks, such as the results of the previous example, are passed
|
||||||
named results blocks are passed intact. Referring to the results of the last
|
intact
|
||||||
example
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+BEGIN_SRC emacs-lisp :var x=read-literal-example
|
#+BEGIN_SRC emacs-lisp :var x=read-literal-example
|
||||||
(concatenate 'string x "\nAgain.")
|
(concatenate 'string x " Again.")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+results:
|
#+results:
|
||||||
: A literal example
|
: A literal example
|
||||||
: on two lines for you.
|
: on two lines for you. Again.
|
||||||
: Again.
|
|
||||||
@end example
|
@end example
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsubheading Alternate argument syntax
|
@subsubheading Alternate argument syntax
|
||||||
It is also possible to specify arguments in a potentially more natural way
|
It is also possible to specify arguments in a potentially more natural way
|
||||||
using the @code{#+NAME:} line of a code block. As in the following
|
using the @code{#+NAME:} line of a code block. As in the following
|
||||||
example, arguments can be packed inside of parenthesis, separated by commas,
|
example, arguments can be packed inside of parentheses, separated by commas,
|
||||||
following the source name.
|
following the source name.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
|
Loading…
Reference in New Issue