From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Macro expansion in new exporter Date: Tue, 12 Feb 2013 18:56:36 +0100 Message-ID: <8738x1ct63.fsf@gmail.com> References: <8738x1x355.fsf@lapcat.tftorrey.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5K6B-0002TP-6N for emacs-orgmode@gnu.org; Tue, 12 Feb 2013 12:56:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5K69-00071N-Gg for emacs-orgmode@gnu.org; Tue, 12 Feb 2013 12:56:55 -0500 Received: from mail-wi0-f182.google.com ([209.85.212.182]:36093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5K69-00071F-5O for emacs-orgmode@gnu.org; Tue, 12 Feb 2013 12:56:53 -0500 Received: by mail-wi0-f182.google.com with SMTP id hi18so448207wib.15 for ; Tue, 12 Feb 2013 09:56:52 -0800 (PST) In-Reply-To: <8738x1x355.fsf@lapcat.tftorrey.com> (T. F. Torrey's message of "Tue, 12 Feb 2013 03:00:54 -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 Hello, tftorrey@tftorrey.com (T.F. Torrey) writes: > Nicolas Goaziou writes: > >> On that topic, the main difference with the previous exporter is that >> macros are now required to be in a context that can be parsed. Thus, for >> example, the following is not a macro: >> >> ~{{{title}}}~ > > What is meant by "a context that can be parsed"? Anywhere but in verbatim areas like: - example blocks - src blocks, inline src-blocks - fixed-width area - keywords (excepted CAPTION, DATE, TITLE, AUTHOR, EMAIL and MACRO). - verbatim and code emphasis. - block boundaries > In my work, it has been very useful to use macros for snippets of > text. Then, instead of changing the text everywhere when I want a > change, I would just change the macro. So... > > For instance, I used to be able to do this: > > #+MACRO: status Draft > #+HTML:

{{{status}}}

> > And on export to HTML, I would get what you would expect: >

Draft

> > With the new exporter, the macro is left unexpanded in the output: >

{{{status}}}

Because the macro is in a keyword that means: "do not parse this contents, it is for the html back-end only". > Of course, I could also put the {{{status}}} in any ordinary text and > have it there as well. > > In extensive experiments, I have not found any combination of input that > would produce the old output using macros. It's possible, macros are not exactly the same. Some of their old functionalities are meant to be reached through Babel now. It may sounds bad, but it allows a better control on macro expansion. > The old behavior had an elegant, one-line solution. Perhaps the > functionality could be duplicated with babel, but surely not as simply > and directly as with the old macro system. > > Is there a way to replicate the old behavior in the new export engine? I didn't check thoroughly, but I would say this kind of feature requires some Babel code. > Also, in your response to Carsten's question about macros, you suggested > this: > > #+MACRO: thumbright @@html:./Content/$2/thumb.jpg@@ > > The "@@" syntax looks new to me. Can you tell me what the function of > the "@@" is? Is this documented somewhere? It is called an export-snippet. @@html:...@@ syntax is to #+begin_html blocks what =...= is to #+begin_example blocks. It replaces old @<...> syntax, which was HTML only. Now you can have @@latex:...@@ or @@beamer:...@@ syntax. Regards, -- Nicolas Goaziou