Merge branch 'maint'
This commit is contained in:
commit
55141cdead
|
@ -17205,7 +17205,7 @@ A note of warning: when =cache= is used in a session, caching may
|
||||||
cause unexpected results.
|
cause unexpected results.
|
||||||
|
|
||||||
When the caching mechanism tests for any source code changes, it does
|
When the caching mechanism tests for any source code changes, it does
|
||||||
not expand Noweb style references (see [[*Noweb Reference Syntax]]). For
|
not expand noweb style references (see [[*Noweb Reference Syntax]]). For
|
||||||
reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
|
reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
|
||||||
|
|
||||||
The =cache= header argument can have one of two values: =yes= or =no=.
|
The =cache= header argument can have one of two values: =yes= or =no=.
|
||||||
|
@ -17674,7 +17674,7 @@ code.
|
||||||
When Org tangles code blocks, it expands, merges, and transforms them.
|
When Org tangles code blocks, it expands, merges, and transforms them.
|
||||||
Then Org recomposes them into one or more separate files, as
|
Then Org recomposes them into one or more separate files, as
|
||||||
configured through the options. During this tangling process, Org
|
configured through the options. During this tangling process, Org
|
||||||
expands variables in the source code, and resolves any Noweb style
|
expands variables in the source code, and resolves any noweb style
|
||||||
references (see [[*Noweb Reference Syntax]]).
|
references (see [[*Noweb Reference Syntax]]).
|
||||||
|
|
||||||
*** Header arguments
|
*** Header arguments
|
||||||
|
@ -17740,7 +17740,7 @@ already exist in the code block.
|
||||||
|
|
||||||
- =noweb= ::
|
- =noweb= ::
|
||||||
|
|
||||||
Includes =link= option, expands Noweb references (see [[*Noweb
|
Includes =link= option, expands noweb references (see [[*Noweb
|
||||||
Reference Syntax]]), and wraps them in link comments inside the body
|
Reference Syntax]]), and wraps them in link comments inside the body
|
||||||
of the code block.
|
of the code block.
|
||||||
|
|
||||||
|
@ -17779,7 +17779,7 @@ By default Org expands code blocks during tangling. The =no-expand=
|
||||||
header argument turns off such expansions. Note that one side-effect
|
header argument turns off such expansions. Note that one side-effect
|
||||||
of expansion by ~org-babel-expand-src-block~ also assigns values (see
|
of expansion by ~org-babel-expand-src-block~ also assigns values (see
|
||||||
[[*Environment of a Code Block]]) to variables. Expansions also replace
|
[[*Environment of a Code Block]]) to variables. Expansions also replace
|
||||||
Noweb references with their targets (see [[*Noweb Reference Syntax]]).
|
noweb references with their targets (see [[*Noweb Reference Syntax]]).
|
||||||
Some of these expansions may cause premature assignment, hence this
|
Some of these expansions may cause premature assignment, hence this
|
||||||
option. This option makes a difference only for tangling. It has no
|
option. This option makes a difference only for tangling. It has no
|
||||||
effect when exporting since code blocks for execution have to be
|
effect when exporting since code blocks for execution have to be
|
||||||
|
@ -17976,56 +17976,58 @@ for Python and Emacs Lisp languages.
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:DESCRIPTION: Literate programming in Org mode.
|
:DESCRIPTION: Literate programming in Org mode.
|
||||||
:END:
|
:END:
|
||||||
#+cindex: code block, Noweb reference
|
#+cindex: code block, noweb reference
|
||||||
#+cindex: syntax, Noweb
|
#+cindex: syntax, noweb
|
||||||
#+cindex: source code, Noweb reference
|
#+cindex: source code, noweb reference
|
||||||
|
|
||||||
#+cindex: @samp{noweb-ref}, header argument
|
#+cindex: @samp{noweb-ref}, header argument
|
||||||
Org supports named blocks in Noweb[fn:145] style syntax:
|
Source code blocks can include references to other source code blocks,
|
||||||
|
using a noweb[fn:145] style syntax:
|
||||||
|
|
||||||
: <<CODE-BLOCK-ID>>
|
: <<CODE-BLOCK-ID>>
|
||||||
|
|
||||||
|
#+texinfo: @noindent
|
||||||
where {{{var(CODE-BLOCK-ID)}}} refers to either the =NAME= of
|
where {{{var(CODE-BLOCK-ID)}}} refers to either the =NAME= of
|
||||||
a specific source code block, or a collection of source code blocks
|
a specific source code block, or a collection of source code blocks
|
||||||
sharing the same =noweb-ref= header argument (see [[*Using Header
|
sharing the same =noweb-ref= header argument (see [[*Using Header
|
||||||
Arguments]]).
|
Arguments]]). Org can replace such references with the source code---or
|
||||||
|
concatenation thereof--- being referenced, or with the results of an
|
||||||
|
evaluation.
|
||||||
|
|
||||||
#+cindex: @samp{noweb}, header argument
|
#+cindex: @samp{noweb}, header argument
|
||||||
Org can replace the Noweb style reference with the source code---or
|
The =noweb= header argument controls expansion of noweb syntax
|
||||||
concatenation thereof---, or even the results of an evaluation, as
|
references. Expansions occur when source code blocks are evaluated,
|
||||||
detailed below. The =noweb= header argument controls expansion of
|
tangled, or exported.
|
||||||
Noweb syntax references. Expansions occur when source code blocks are
|
|
||||||
evaluated, tangled, or exported.
|
|
||||||
|
|
||||||
- =no= ::
|
- =no= ::
|
||||||
|
|
||||||
Default. No expansion of Noweb syntax references in the body of the
|
Default. No expansion of noweb syntax references in the body of the
|
||||||
code when evaluating, tangling, or exporting.
|
code when evaluating, tangling, or exporting.
|
||||||
|
|
||||||
- =yes= ::
|
- =yes= ::
|
||||||
|
|
||||||
Expansion of Noweb syntax references in the body of the code block
|
Expansion of noweb syntax references in the body of the code block
|
||||||
when evaluating, tangling, or exporting.
|
when evaluating, tangling, or exporting.
|
||||||
|
|
||||||
- =tangle= ::
|
- =tangle= ::
|
||||||
|
|
||||||
Expansion of Noweb syntax references in the body of the code block
|
Expansion of noweb syntax references in the body of the code block
|
||||||
when tangling. No expansion when evaluating or exporting.
|
when tangling. No expansion when evaluating or exporting.
|
||||||
|
|
||||||
- =no-export= ::
|
- =no-export= ::
|
||||||
|
|
||||||
Expansion of Noweb syntax references in the body of the code block
|
Expansion of noweb syntax references in the body of the code block
|
||||||
when evaluating or tangling. No expansion when exporting.
|
when evaluating or tangling. No expansion when exporting.
|
||||||
|
|
||||||
- =strip-export= ::
|
- =strip-export= ::
|
||||||
|
|
||||||
Expansion of Noweb syntax references in the body of the code block
|
Expansion of noweb syntax references in the body of the code block
|
||||||
when expanding prior to evaluating or tangling. Removes Noweb
|
when expanding prior to evaluating or tangling. Removes noweb
|
||||||
syntax references when exporting.
|
syntax references when exporting.
|
||||||
|
|
||||||
- =eval= ::
|
- =eval= ::
|
||||||
|
|
||||||
Expansion of Noweb syntax references in the body of the code block
|
Expansion of noweb syntax references in the body of the code block
|
||||||
only before evaluating.
|
only before evaluating.
|
||||||
|
|
||||||
In the most simple case, the contents of a single source block is
|
In the most simple case, the contents of a single source block is
|
||||||
|
@ -18085,7 +18087,7 @@ concatenation to a pure code file when tangled.
|
||||||
#+end_example
|
#+end_example
|
||||||
|
|
||||||
#+cindex: @samp{noweb-sep}, header argument
|
#+cindex: @samp{noweb-sep}, header argument
|
||||||
By default a newline separates each Noweb reference concatenation. To
|
By default a newline separates each noweb reference concatenation. To
|
||||||
use a different separator, edit the =noweb-sep= header argument.
|
use a different separator, edit the =noweb-sep= header argument.
|
||||||
|
|
||||||
Eventually, Org can include the results of evaluation of a single code
|
Eventually, Org can include the results of evaluation of a single code
|
||||||
|
@ -18099,7 +18101,7 @@ code block name set by =NAME= keyword is required; the reference set
|
||||||
by =noweb-ref= is not effective in that case.
|
by =noweb-ref= is not effective in that case.
|
||||||
|
|
||||||
Here is an example that demonstrates how the exported content changes
|
Here is an example that demonstrates how the exported content changes
|
||||||
when Noweb style references are used with parentheses versus without.
|
when noweb style references are used with parentheses versus without.
|
||||||
With:
|
With:
|
||||||
|
|
||||||
#+begin_example
|
#+begin_example
|
||||||
|
@ -18123,7 +18125,7 @@ expands to:
|
||||||
|
|
||||||
: print(num*10)
|
: print(num*10)
|
||||||
|
|
||||||
Below, a similar Noweb style reference is used, but with parentheses,
|
Below, a similar noweb style reference is used, but with parentheses,
|
||||||
while setting a variable =num= to 10:
|
while setting a variable =num= to 10:
|
||||||
|
|
||||||
#+begin_example
|
#+begin_example
|
||||||
|
@ -18138,10 +18140,10 @@ Note that the expansion now contains the results of the code block
|
||||||
|
|
||||||
: 100
|
: 100
|
||||||
|
|
||||||
Noweb insertions honor prefix characters that appear before the Noweb
|
Noweb insertions honor prefix characters that appear before the noweb
|
||||||
syntax reference. This behavior is illustrated in the following
|
syntax reference. This behavior is illustrated in the following
|
||||||
example. Because the =<<example>>= Noweb reference appears behind the
|
example. Because the =<<example>>= noweb reference appears behind the
|
||||||
SQL comment syntax, each line of the expanded Noweb reference is
|
SQL comment syntax, each line of the expanded noweb reference is
|
||||||
commented. With:
|
commented. With:
|
||||||
|
|
||||||
#+begin_example
|
#+begin_example
|
||||||
|
@ -18171,8 +18173,8 @@ expands to:
|
||||||
,#+END_SRC
|
,#+END_SRC
|
||||||
#+end_example
|
#+end_example
|
||||||
|
|
||||||
Since this change does not affect Noweb replacement text without
|
Since this change does not affect noweb replacement text without
|
||||||
newlines in them, inline Noweb references are acceptable.
|
newlines in them, inline noweb references are acceptable.
|
||||||
|
|
||||||
This feature can also be used for management of indentation in
|
This feature can also be used for management of indentation in
|
||||||
exported code snippets. With:
|
exported code snippets. With:
|
||||||
|
@ -21736,7 +21738,7 @@ the C language.
|
||||||
identifier for such source blocks is =D=, you activate it by loading
|
identifier for such source blocks is =D=, you activate it by loading
|
||||||
the C language.
|
the C language.
|
||||||
|
|
||||||
[fn:145] For Noweb literate programming details, see
|
[fn:145] For noweb literate programming details, see
|
||||||
http://www.cs.tufts.edu/~nr/noweb/.
|
http://www.cs.tufts.edu/~nr/noweb/.
|
||||||
|
|
||||||
[fn:146] For more information, please refer to the commentary section
|
[fn:146] For more information, please refer to the commentary section
|
||||||
|
|
Loading…
Reference in New Issue