From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [ox-publish] handling of white space in arguments of macros, named arguments? Date: Wed, 27 Mar 2013 17:26:34 +0100 Message-ID: <87d2ukg66d.fsf@gmail.com> References: <31F8FCDD-923C-402B-AD87-FEB6C8F84B12@nf.mpg.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKtBT-0007La-9C for emacs-orgmode@gnu.org; Wed, 27 Mar 2013 12:26:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKtBR-0006fC-Gl for emacs-orgmode@gnu.org; Wed, 27 Mar 2013 12:26:43 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:35582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKtBR-0006f6-B8 for emacs-orgmode@gnu.org; Wed, 27 Mar 2013 12:26:41 -0400 Received: by mail-wg0-f41.google.com with SMTP id y10so676068wgg.0 for ; Wed, 27 Mar 2013 09:26:40 -0700 (PDT) In-Reply-To: <31F8FCDD-923C-402B-AD87-FEB6C8F84B12@nf.mpg.de> (Stefan Vollmar's message of "Tue, 26 Mar 2013 21:08:56 +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: Stefan Vollmar Cc: Org Mode Mailing List Hello, Stefan Vollmar writes: > However, the second change is caused by our use of MACROs: we find > them very helpful for generating HTML content using raw HTML templates > with placeholders. > > This used to work (for generating http://microformats.org/wiki/hcard information) a month ago: > > {{{mhead-hcard( > Dr. Stefan Vollmar, > Stefan, > , > Vollmar, > Dr., > stefan-vollmar.jpg, > stefan-vollmar.html, > ...)}}} > > with this type of macro definition: > > #+macro: mhead-hcard #+html:

$1
$5 $2[...] > > but now the white space around the arguments is no longer stripped and/or other effects cause "<" and ">" in the macro to be exported as "<" etc. > > This version seems to work fine: > > {{{mhead-hcard(Dr. Stefan > Vollmar,Stefan,,Vollmar,Dr.,stefan-vollmar.jpg,stefan-vollmar.html,Head > of IT Group\,
Physicist\, Software > Developer,vollmar@nf.mpg.de,it,+49 221 4726-213,+49 221 4726-298)}}} I removed trimming around arguments a few days ago, since it wasn't an explicit specification for macros. Therefore, newline characters are inserted in your template, which means that the HTML keyword doesn't affect all lines of the generated code and, as a consequence, some "<" are exported as "<". I think all newline characters should be replaced with a whitespace character in macro arguments. Indeed, macro templates are only one line long but unwanted "\n" could be inserted by paragraph filling in arguments. I also don't mind trimming arguments again, provided this is added as an explicit behaviour and there is no opposition to it. > Yes, I could use it as a workaround, but I would prefer something > similar to the above version for improved readability - maybe by > adding "line continuation markers" like "\"? Obviously, more complex > macros (the one above has 12 individual arguments) are less than ideal > anyway and the best solution (by far) would be "named arguments". > Maybe there already is a better way of using (HTML) templates? I think you really shouldn't use macros for that. For example, consider adding the following in your buffer (or, better, in the Library of Babel): #+name: mhead-hcard #+header: :var cname="Complete Name" gname="Given Name" photo="photo.jpg" prefix="" #+header: :var web="web-page.html" #+BEGIN_SRC org :exports none