From mboxrd@z Thu Jan 1 00:00:00 1970 From: tftorrey@tftorrey.com (T.F. Torrey) Subject: Re: Macro expansion in new exporter Date: Fri, 15 Feb 2013 13:42:48 -0700 Message-ID: <87r4khia0n.fsf@lapcat.tftorrey.com> References: <87mwv57mo0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6S7a-0000oE-Uu for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 15:43:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6S7Z-00070x-Hk for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 15:43:02 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:54325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6S7Z-00070s-CH for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 15:43:01 -0500 Received: by mail-pa0-f44.google.com with SMTP id kp1so1925167pab.17 for ; Fri, 15 Feb 2013 12:43:00 -0800 (PST) In-Reply-To: <87mwv57mo0.fsf@gmail.com> (message from Nicolas Goaziou on Fri, 15 Feb 2013 14:05:03 +0100) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org Hello Nicolas, Nicolas Goaziou writes: > tftorrey@tftorrey.com (T.F. Torrey) writes: > >> Perhaps. We still know of no easy/straightforward way at all to >> replicate using babel the behavior I had (creating '

> class="foo">bar

' 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:

$data

> #+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:

{{{data}}}

Your sample code is the equivalent of this, kind of: #+MACRO: foo

$1

{{{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:

#+CALL: snippet-awesome :results raw #+HTML:

... 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