:noweb
header argument expansion
:noweb
header argument expansion using :exports results
:noweb-ref
header argument
:file-ext
and :output-dir
header args
:noweb
header argument expansion
(message "expanded1")
(message "expanded2")
;; noweb-1-yes-start <<noweb-example>>
;; noweb-no-start <<noweb-example1>>
;; noweb-2-yes-start <<noweb-example2>>
;; noweb-tangle-start <<noweb-example1>> <<noweb-example2>>
:noweb
header argument expansion using :exports results
(message "expanded1")
(message "expanded2")
;; noweb-1-yes-start <<noweb-example>>
;; noweb-no-start <<noweb-example1>>
;; noweb-2-yes-start <<noweb-example2>>
<<noweb-example1>> <<noweb-example2>>
(message "not to be tangled")
(message "for tangling")
42
42
42
(require 'cl) (defalias 'my-map (if (org-version-check "24.2.50" "cl" :predicate) 'cl-map 'map)) (defun pascals-triangle (n) (if (= n 0) (list (list 1)) (let* ((prev-triangle (pascals-triangle (- n 1))) (prev-row (car (reverse prev-triangle)))) (append prev-triangle (list (my-map 'list #'+ (append prev-row '(0)) (append '(0) prev-row))))))) (pascals-triangle n)
(sqrt n)
This is an inline call call_echo(input="testing") embedded in prose. This is an inline call call_echo(input="testing")[:results vector] embedded in prose.
call_echo("testing") call_concat(1,2,3)
(format "%S%S%S" a b c)
(* 2 it)
The following exports as a normal call line
Now here is an inline call call_double(it=1) stuck in the middle of some prose.
This one should not be exported call_double(it=2)
because it is
quoted.
Finally this next one should export, even though it starts a line call_double(it=3) because sometimes inline blocks fold with a paragraph.
And, a call with raw results call_double(4)[:results raw] should not have quoted results.
The following 2*5=call_double(5) should export even when prefixed by an = sign.
Here is one in the middle src_sh{echo 1} of a line. Here is one at the end of a line. src_sh{echo 2} src_sh{echo 3} Here is one at the beginning of a line.
Here is one in the middle src_sh{echo 1} of a line. Here is one at the end of a line. src_sh{echo 2} src_sh{echo 3} Here is one at the beginning of a line. Here is one that is also evaluated: src_sh[:exports both]{echo 4}
a
b
c
"code block results"
(reverse lst)
:noweb-ref
header argument
<<fullest-disk>>
df
|sed '1d'
|awk '{print $5 " " $6}'|sort -n |tail -1
|awk '{print $2}'
(length text)
<<simple-subtree>> <<d4faa7b3-072b-4dcf-813c-dd7141c633f3>>
this is simple
has length 14
exporting a code block with a name
echo bar
Weird interaction.
here is one block
echo 1
and another
# I am inside the code block <<noweb-no-export-and-exports-both-1>>
First.
(push it *evaluation-collector*)
Second
(push 2 *evaluation-collector*)
Third src_emacs-lisp{(car (push 3 evaluation-collector))}
Fourth
Fifth
(push 5 *evaluation-collector*)
Here is a call line with more than just the results exported.
i="10"
<<strip-export-1>> echo "1$i"
Use case checked and documented with this test: During their evaluation the source blocks read values from properties from the entry where the call has been made unless the value is overridden with the optional argument of the caller.
Note: Just export of a property can be done with a macro: {{{property(a)}}}.
sect inline call_src_block_location_shell()[:results raw]
sect inline call_src_block_location_elisp()[:results raw]
sub0 inline call_src_block_location_shell()[:results raw]
sub0 inline call_src_block_location_elisp()[:results raw]
sub1 inline call_src_block_location_shell(c=5, e=6)[:results raw]
sub1 inline call_src_block_location_elisp(c=5, e=6)[:results raw]
comments for ":var":
The "or" is to deal with a property not present.
The t is to get property inheritance.
printf "shell a:$a, b:$b, c:$c, d:$d, e:$e"
(setq ;; - The first `or' together with ":var <var>='nil" is to check for ;; a value bound from an optional call argument, in the examples ;; here: c=5, e=6 ;; - The second `or' is to deal with a property not present ;; - The t is to get property inheritance a (or a (string-to-number (or (org-entry-get org-babel-current-src-block-location "a" t) "0"))) b (or b (string-to-number (or (org-entry-get org-babel-current-src-block-location "b" t) "0"))) c (or c (string-to-number (or (org-entry-get org-babel-current-src-block-location "c" t) "0"))) d (or d (string-to-number (or (org-entry-get org-babel-current-src-block-location "e" t) "0"))) e (or e (string-to-number (or (org-entry-get org-babel-current-src-block-location "d" t) "0")))) (format "elisp a:%d, b:%d, c:%d, d:%d, e:%d" a b c d e)
:file-ext
and :output-dir
header args
nil
nil
nil
nil
nil
nil