0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-24 16:02:51 +00:00
org-mode/testing/examples/babel.org
Eric Schulte 9931dae20a babel: exporting now working with the new ob-get-src-block-info schema
includes a simple export test

* lisp/ob-exp.el (org-babel-exp-in-export-file): wrapper for
  collecting information from within the original export file

  (org-babel-exp-src-blocks): simplified through use of the above
  macro

  (org-babel-exp-code): simplified through the use of new functions
  for parsing header arguments

  (org-babel-exp-results): simpler high-level organization, also this
  is now where the expansion of variable references takes place during
  export

* lisp/ob.el (org-babel-expand-variables): broke variable replacement
  in a parameter list into it's own function

  (org-babel-get-src-block-info): now using the above function
2010-10-21 13:05:59 +01:00

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