0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 14:16:26 +00:00
org-mode/testing/examples/babel.org
Bastien Guerry 6e534f9c61 Manually revert back to commit e85080.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.

This commit reverts back the maint branch to its state before
merging the master branch.  From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
2012-03-17 14:34:01 +01:00

7 KiB
Raw Blame History

a collection of examples for Babel tests

:noweb header argument expansion

  (message "expanded")
  ;; noweb-yes-start
  <<noweb-example>>
  ;; noweb-yes-end
  ;; noweb-no-start
  <<noweb-example>>
  ;; noweb-no-end
  ;; noweb-tangle-start
  <<noweb-example>>
  ;; noweb-tangle-end

elisp forms in header arguments

  prop
4

excessive id links on tangling

no, don't give me an ID

  (message "not to be tangled")

yes, I'd love an ID

  (message "for tangling")

simple variable resolution

  (list 1 2 3 4)
  (length four)
4

multi-line header arguments

  (map 'list #'list numbers letters)
1 a
2 b
3 c
4 d
5 e
6 f
7 g

simple named code block

  42
42
42

Pascal's Triangle export test

  (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 (map 'list #'+
                           (append prev-row '(0))
                           (append '(0) prev-row)))))))

  (pascals-triangle n)

calling code blocks from inside table

  (sqrt n)

executing an lob call line

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

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

Here is one in the middle

echo 1
of a line. Here is one at the end of a line.
echo 2
echo 3
Here is one at the beginning of a line.

parsing header arguments

  the body

conflicting blocks on export

  • a
  • b
  • c
    "code block results"
  (reverse lst)

using the :noweb-ref header argument

  <<fullest-disk>>

query all mounted disks

  df

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

  (length text)
  <<simple-subtree>>
  <<d4faa7b3-072b-4dcf-813c-dd7141c633f3>>

simple subtree with custom ID

this is simple

simple subtree with global ID

has length 14

org-babel-get-inline-src-block-matches

echo "One"
block at start of line One spaced block in
 echo "middle"
of line
echo 2} blocks on the src_emacs-lisp{"same"
line Inline block with
 echo "parameters"
.

returning file names interpreted as lists

  echo "[[file:./cv.cls]]"
[[file:./cv.cls]]
   echo "[[file:./cv.cls]]"

/mirrors/org-mode/src/commit/b058173c6cbc44186cf41ab2e7545a94b35cff79/testing/examples/cv.cls

in order evaluation on export

First.

  (push it *evaluation-collector*)

Second

  (push 2 *evaluation-collector*)

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

Fourth

Fifth

  (push 5 *evaluation-collector*)