From mboxrd@z Thu Jan 1 00:00:00 1970 From: feng shu Subject: Re: #+call split into multiple lines? Date: Fri, 29 Mar 2013 17:34:07 +0800 Message-ID: <84li9635yo.fsf@gmail.com> References: <86ip4bw6yd.fsf@somewhere.org> <3741EDEB-8A94-4402-85D3-D74236811F97@nf.mpg.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULVjd-0002zG-Tw for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 05:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULVjc-00078h-Cw for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 05:36:33 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULVjc-00078W-2l for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 05:36:32 -0400 Received: by mail-pa0-f45.google.com with SMTP id kl13so288857pab.4 for ; Fri, 29 Mar 2013 02:36:30 -0700 (PDT) In-Reply-To: <3741EDEB-8A94-4402-85D3-D74236811F97@nf.mpg.de> (Stefan Vollmar's message of "Fri, 29 Mar 2013 09:24:19 +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: emacs-orgmode@gnu.org Stefan Vollmar writes: > Dear Thomas, > dear Sebation, > dear Achim, > dear Nicolas, > > maybe a misunderstanding: the original idea is to produce a "personal > homepage" for members of our institute, with one file per person - > here is a better example http://www.nf.mpg.de/cv-howto/ex3-en.org and > here some background information > http://www.nf.mpg.de/cv-howto/cv-en.html. > > As you can see, we used MACROs for our hcard-HTML templates - this > currently does not work unless all arguments are written in one line. > We need 10+ arguments and using named arguments is a much better > strategy anyway. > > The problem is quite general, I think, and a common solution I quite > like is a key-value structure (preferably with optional comments), one > key-value pair per line. > > Using a table for a key-value assignment is, of course, possible. Here > again your example: > #+name: card-table > | cname | gname | photo | etc.| > | Dr. Stefan Vollmar | Stefan | stefan-vollmar.jpg | ... | > > Editing a table with many columns is awkward (not everybody uses Emacs > for our templates). Much easier (to edit) is the transposed version: Is it possible to use the below format? #+name: lists-table #+BEGIN_SRC org - 1 - cname: Dr. Stefan Vollmar - gname: Stefan - photo: stefan - 2 - cname: ... - gname: ... - photo: ... #+END_SRC > #+name: card-table > | cname | Dr. Stefan Vollmar | > | gname | Stefan | > | photo | stefan-vollmar.jpg | > ... > > This might work reasonably well - if (1) I could prevent the table > from being exported to HTML, (2) (probably more difficult) if this > kind of thing would work: > #+call: hcard(v=card-table) :results html > > with > > ... >

$v["cname"]

>

Given Name: $v["gname"]

> ... > > inside the hcard-babel-block (org) to reference the named values. > > My feeling is (please correct me if I am wrong) that maybe we would > want two Babel blocks: one for setting a set of variables/an array > (elisp?) and one for filling the template? > > Could I fill a suitable structure/array/set of variables within an > elisp block and then reference it/them in the org template that only > requires replacing placeholders? > > Many thanks in advance! > > Warm regards, > Stefan > > > On 28.03.2013, at 22:51, Thomas S. Dye wrote: > >> >> >> Aloha Seb, >> >> "Sebastien Vauban" >> writes: >> >>> Hi Thomas, >>> >>> Thomas S. Dye wrote: >>>> In this situation I often put the arguments in a named Org table and >>>> then write the Babel source code block to take a single argument--the >>>> table name--and parse the information passed in that way. >>>> >>>> #+name: card-table >>>> | cname | gname | photo | etc.| >>>> | Dr. Stefan Vollmar | Stefan | stefan-vollmar.jpg | ... | >>>> | Dr. Stefan Vollmar, Jr. | Stefan Jr. | stefan-vollmar-jr.jpg | ... | >>>> >>>> >>>> #+call: mhead-hcard(card=card-table[0,]) for Stefan >>>> >>>> #+call: mhead-hcard(card=card-table[1,]) for Stefan Jr. >>>> >>>> If you don't mind writing some extra code for the Babel function, then >>>> >>>> #+call: mhead-hcard(card=card-table,gname="Stefan") >>>> >>>> etc. >>> >>> And do you eventually have a way to write a "for-loop" for all the lines of >>> the tables, not being forced to write as many calls as the number of lines you >>> do have? >>> >>> I don't see (immediately) how to do such, but that would really allow to >>> promote such a use case! >> >> Not sure I understand your question. Perhaps I misunderstood Stefan's >> use case? >> >> There are several languages supported by Babel that have loop >> constructs. I was assuming that Stefan would use one of these when I >> suggested the possibility of writing some extra code. >> >> All the best, >> Tom >> >> -- >> Thomas S. Dye >> http://www.tsdye.com >> >> --