"Olaf.Hamann" <o.ham...@gmx.net> writes:

>> I think I will try to adapt m4 as org-language so that it can be used
>> for executing src-blocks.
>
> m4 is no solution as it does not support multibyte character
>
>

I missed the beginning of this thread, but would the following very
simple support for text block evaluation be sufficient?

#+begin_src emacs-lisp
(defun org-babel-expand-body:text (body params)
  (mapc
   (lambda (pair)
     (let ((name (symbol-name (car pair)))
           (value (cdr pair)))
       (setq body
             (replace-regexp-in-string
              (concat "\$" (regexp-quote name))
              (if (stringp value) value (format "%S" value))
              body))))
   (mapcar #'cdr (org-babel-get-header params :var)))
  body)

(defun org-babel-execute:text (body params)
  (org-babel-expand-body:text body params))
#+end_src

#+begin_src text :var name="Eric"
  Hi, my name is $name.
#+end_src

#+RESULTS:
: Hi, my name is Eric.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

Reply via email to