Hello,

François Pinard <pin...@iro.umontreal.ca> writes:

> The examples in the manual do not hint either about whether newlines
> are allowed or not in macro arguments.

They are not.

> In fact, the manual section "Macro replacement" says very little, so
> when I initially read it, I guessed that macros are only usable in very
> simple cases.  However, the last statement says that macros can be used
> to construct "complex HTML code".  Yet, the definition method at the
> beginning suggests that macro definitions have to fit on one line, and
> this seriously limits the complexity of what we can do with them.  So,
> on initial reading, I just decided I understood nothing about
> them :-).

They can build complex code since you can eval a sexp in a macro:

--8<---------------cut here---------------start------------->8---
#+TITLE: Macro test
#+MACRO: test2 recursive $1
#+MACRO: test A {{{test2(inner)}}} macro, $1.
#+MACRO: html-builder (eval (+ $1 $2))


{{{test(and an outer one)}}}

Some complex macro {{{html-builder(1,2)}}}.
--8<---------------cut here---------------end--------------->8---

> If macros are there to stay in Org, it might be worth documenting a more
> complete specification about how to define and use them.

They are useful. Though, for "complex code", I think Babel should be the
way to go.


Regards,

-- 
Nicolas Goaziou

Reply via email to