From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Macro expansion in new exporter Date: Fri, 15 Feb 2013 14:05:03 +0100 Message-ID: <87mwv57mo0.fsf@gmail.com> References: <87txpdj2rj.fsf@lapcat.tftorrey.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6Kyh-0001rw-Oo for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 08:05:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6Kyd-00075K-Ks for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 08:05:23 -0500 Received: from mail-wi0-f177.google.com ([209.85.212.177]:52645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6Kyd-00073p-EM for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 08:05:19 -0500 Received: by mail-wi0-f177.google.com with SMTP id hm14so1128388wib.4 for ; Fri, 15 Feb 2013 05:05:18 -0800 (PST) In-Reply-To: <87txpdj2rj.fsf@lapcat.tftorrey.com> (T. F. Torrey's message of "Fri, 15 Feb 2013 03:21:52 -0700") 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: "T.F. Torrey" Cc: emacs-orgmode@gnu.org 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. > Macros are so straightforward compared to babel, I wonder how much > trouble they /could/ generate. Not as much as Babel, obviously. But since blank lines are significant in Org, allowing blank lines in macros could change structure. > I wonder if an entry in the (underused) Library of Babel could replicate > the macro functionality and eliminate the need for macros as separate > things. I will have to look into that when I have more time. You can install the example given above in you Library of Babel. > I'm pretty sure I could replicate (and even expand) the old macro > functionality by hooking an expansion function into > org-export-before-parsing-hook. Maybe I will write an extension to > try. I'd rather have users use macros for short replacements, which is where they really shine, and Babel for programmable ones. Your extension wouldn't help at that. But that's your call, obviously. For the record, I have had to rewrite the macro code two times. This is to say it is difficult to get them right, if possible at all. Regards, -- Nicolas Goaziou