[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Macro expansion in new exporter
From: |
T.F. Torrey |
Subject: |
Re: [O] Macro expansion in new exporter |
Date: |
Fri, 15 Feb 2013 13:42:48 -0700 |
Hello Nicolas,
Nicolas Goaziou <address@hidden> writes:
> address@hidden (T.F. Torrey) writes:
>
>> Perhaps. We still know of no easy/straightforward way at all to
>> replicate using babel the behavior I had (creating '<p
>> class="foo">bar</p>' with a macro), let alone in a pair of single
>> lines.
>
> Here is an example. Babel specialists can help you further.
>
> --8<---------------cut here---------------start------------->8---
> Define your Babel macro.
>
> #+name: html-foo
> #+begin_src org :exports none :results raw :var data=""
> ,#+HTML: <p class="foo">$data</p>
> #+end_src
>
> Now, use it anywhere in the code, any number of times.
>
> #+CALL: html-foo(data="bar") :results raw
> --8<---------------cut here---------------end--------------->8---
>
> There are many, often shorter, other ways to do it.
This is interesting, but it is the reverse of the previous
functionality. What I had was:
#+MACRO: data Snippet of awesome text that changes sometimes.
#HTML: <p class="awesome">{{{data}}}</p>
Your sample code is the equivalent of this, kind of:
#+MACRO: foo <p class="awesome">$1</p>
{{{foo("Snippet of awesome text that changes sometimes.")}}}
The original intent was to avoid changing the snippet of awesome text
everywhere it appears.
Your code actually does not actually work with my Org
(7.9.3e-1032-g791a8d). It asks me: "Evaluate this org code block
(html-foo) on your system? (y or n)" and is not happy with either
answer, exporting nothing.
This almost works, I think ...
#+name: snippet-awesome
#+begin_src org :exports results :results raw
Snippet of awesome text that changes sometimes.
#+end_src
#+HTML: <p class="foo">
#+CALL: snippet-awesome :results raw
#+HTML: </p>
... except that it doesn't actually export anything, and changing
:exports to none doesn't help. And neither does removing the :results
raw from the call.
If it did work, it would be closer to what I had. Not perfect, but
closer.
Maybe a babel specialist can say what is wrong with my attempt, or maybe
it's a bug.
I hope you won't spend more time on this. You've spent way too much
time on my trivial problems already.
Thanks again!
Terry
--
T.F. Torrey
- [O] Macro expansion in new exporter, T.F. Torrey, 2013/02/08
- Re: [O] Macro expansion in new exporter, Nicolas Goaziou, 2013/02/09
- Re: [O] Macro expansion in new exporter, T.F. Torrey, 2013/02/12
- Re: [O] Macro expansion in new exporter, Nicolas Goaziou, 2013/02/12
- Re: [O] Macro expansion in new exporter, T.F. Torrey, 2013/02/12
- Re: [O] Macro expansion in new exporter, Nicolas Goaziou, 2013/02/13
- Re: [O] Macro expansion in new exporter, T.F. Torrey, 2013/02/15
- Re: [O] Macro expansion in new exporter, Nicolas Goaziou, 2013/02/15
- Re: [O] Macro expansion in new exporter,
T.F. Torrey <=
- Re: [O] Macro expansion in new exporter, Nicolas Goaziou, 2013/02/15
- Re: [O] Macro expansion in new exporter, T.F. Torrey, 2013/02/15
- Re: [O] Macro expansion in new exporter, Nick Dokos, 2013/02/15