7.9 KB

:noweb header argument expansion

:PROPERTIES: :ID: eb1f6498-5bd9-45e0-9c56-50717053e7 :END:

(message "expanded1")

(message "expanded2")

;; noweb-1-yes-start <>

;; noweb-no-start <>

;; noweb-2-yes-start <>

;; noweb-tangle-start <> <>

:noweb header argument expansion using

:PROPERTIES: :ID: 8701beb4-13d9-468c-997a-8e63e8b66f :END:

(message "expanded1")

(message "expanded2")

;; noweb-1-yes-start <>

;; noweb-no-start <>

;; noweb-2-yes-start <>

<> <>

excessive id links on tangling

:PROPERTIES: :ID: ef06fd7f-012b-4fde-87a2-2ae91504ea :END:

no, don't give me an ID

(message "not to be tangled")

yes, I'd love an ID

:PROPERTIES: :ID: ae7b55ca-9ef2-4d30-bd48-da30e35fd0 :END:

(message "for tangling")

simple named code block

:PROPERTIES: :ID: 0d82b52d-1bb9-4916-816b-2c67c8108d :END:



Pascal's Triangle -- exports both test

:PROPERTIES: :ID: 92518f2a-a46a-4205-a3ab-bcce1008a4 :END:

(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)

calling code blocks from inside table

:PROPERTIES: :ID: 6d2ff4ce-4489-4e2a-9c65-e3f71f77d9 :END:

(sqrt n)

executing an lob call line

:PROPERTIES: :results: silent :ID: fab7e291-fde6-45fc-bf6e-a485b8bca2 :END:

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)

exporting an lob call line

:PROPERTIES: :ID: 72ddeed3-2d17-4c7f-8192-a575d535d3 :END:

(* 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.

inline source block

:PROPERTIES: :results: silent :ID: 54cb8dc3-298c-4883-a933-029b3c9d4b :END: 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.

mixed blocks with exports both

:PROPERTIES: :ID: 5daa4d03-e3ea-46b7-b093-62c1b7632d :END:

  • a
  • b
  • c

"code block results"

(reverse lst)

using the :noweb-ref header argument

:PROPERTIES: :ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8 :noweb-sep: "" :END:


query all mounted disks


strip the header row

|sed '1d'

sort by the percent full

|awk '{print $5 " " $6}'|sort -n |tail -1

extract the mount point

|awk '{print $2}'

resolving sub-trees as references

:PROPERTIES: :ID: 2409e8ba-7b5f-4678-8888-e48aa02d8c :results: silent :END:

(length text)

<> <>

simple subtree with custom ID

:PROPERTIES: :CUSTOM_ID: simple-subtree :END: this is simple

simple subtree with global ID

:PROPERTIES: :ID: d4faa7b3-072b-4dcf-813c-dd7141c633 :END: has length 14


exporting a code block with a name

:PROPERTIES: :results: silent :ID: 0D0983D4-DE33-400A-8A05-A225A567BC74 :END: src_sh{echo "One"} block at start of line One spaced block in src_sh{ echo "middle" } of line src_sh{echo 2} blocks on the src_emacs-lisp{"same"} line Inline block with src_sh[:results silent]{ echo "parameters" }. :PROPERTIES: :ID: b02ddd8a-eeb8-42ab-8664-8a759e6f43 :END:

exporting a code block with a name

echo bar

noweb no-export and exports both

:PROPERTIES: :ID: 8a820f6c-7980-43db-8a24-0710d33729 :END: Weird interaction.

here is one block

  echo 1

and another

  # I am inside the code block

in order evaluation on export

:PROPERTIES: :exports: results :ID: 96cc7073-97ec-4556-87cf-1f9bffafd3 :END:


(push it evaluation-collector)


(push 2 evaluation-collector)

Third src_emacs-lisp{(push 3 evaluation-collector)}



(push 5 evaluation-collector)

exporting more than just results from a call line

:PROPERTIES: :ID: bec63a04-491e-4caa-97f5-108f302036 :END: Here is a call line with more than just the results exported.

strip noweb references on export

:PROPERTIES: :ID: 8e7bd234-99b2-4b14-8cd6-53945e4097 :END:


  echo "1$i"