From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: templating with Org? Date: Sat, 8 Aug 2015 14:11:33 -0400 Message-ID: References: <8737zumlmm.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01537612b6128e051cd0ae10 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZO8am-0006eD-3F for emacs-orgmode@gnu.org; Sat, 08 Aug 2015 14:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZO8ak-000740-HQ for emacs-orgmode@gnu.org; Sat, 08 Aug 2015 14:11:36 -0400 Received: from mail-ob0-x22e.google.com ([2607:f8b0:4003:c01::22e]:35752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZO8ak-00073q-Ak for emacs-orgmode@gnu.org; Sat, 08 Aug 2015 14:11:34 -0400 Received: by obbop1 with SMTP id op1so99486178obb.2 for ; Sat, 08 Aug 2015 11:11:33 -0700 (PDT) In-Reply-To: <8737zumlmm.fsf@ericabrahamsen.net> 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: Eric Abrahamsen Cc: "emacs-orgmode@gnu.org" --089e01537612b6128e051cd0ae10 Content-Type: text/plain; charset=UTF-8 I don't have the impression you would need to hijack the export process. It seems like you would need to call a function that gets data from some source (e.g the org document) and then populates a template with that data, and once that is done, call a regular export function. There are a number of template solutions: http://www.emacswiki.org/emacs/CategoryTemplates. I am not sure these are too easy to adapt to what you describe. I played around with some ideas for this here: http://kitchingroup.cheme.cmu.edu/blog/2014/01/20/Alternatives-to-long-complex-format-statements-in-emacs-lisp/ http://kitchingroup.cheme.cmu.edu/blog/2014/01/26/Another-alternative-to-string-templates/ Something like these could be used to populate a template I think. John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sat, Aug 8, 2015 at 12:48 AM, Eric Abrahamsen wrote: > Exporting org files and subtrees is awfully flexible, given all the > possible customizations, but for a long while I've occasionally felt the > need to come at the "export" process from the other direction: instead > of customizing the export appearance of a series of headings, instead > starting with a common block of export text, and interpolating values > from the headings into that text -- ie, templating. > > I've felt this need off and on for a couple of years, most recently when > organizing a small literary festival. I really need to keep all the > information about the events in a single place, otherwise I know that > information will go stale right away. But I need the information in a > series of such wildly-varying formats that I can't imagine setting up > (and switching between) export filters in a way that wouldn't make me > cry. Not to mention that the different "export" use-cases all have their > own per-heading boilerplate text, and there's no way I'm going to repeat > all that different boilerplate under each heading. > > Obviously there's many ways this could be done. I could somehow hijack > the export process -- in many cases it would be nice too make use of the > skeleton document structures that export provides. > > Or maybe dynamic blocks? I've never used them before. Or maybe just a > plain old `org-map-entries', which reads the template text from an > external file and then steals some of the macro expansion functions to > fill out the values. > > Has anyone wanted to do this before? Has anyone actually done it? Any > thoughts or suggestions would be much appreciated! > > Yours, > Eric > > > --089e01537612b6128e051cd0ae10 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I don't have the impression you would need to hijack t= he export process. It seems like you would need to call a function that get= s data from some source (e.g the org document) and then populates a templat= e with that data, and once that is done, call a regular export function. Th= ere are a =C2=A0number of template solutions:=C2=A0http://www.emacswiki.org/emacs/Categor= yTemplates. I am not sure these are too easy to adapt to what you descr= ibe.


Something li= ke these could be used to populate a template I think.

John

---------------------------= --------
Professor John Kitchin=C2=A0
Doherty Hall A207F
Departmen= t of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 1= 5213
412-268-7803

On Sat, Aug 8, 2015 at 12:48 AM, Eric Abraha= msen <eric@ericabrahamsen.net> wrote:
Exporting org files and subtrees is awfully flexible, giv= en all the
possible customizations, but for a long while I've occasionally felt th= e
need to come at the "export" process from the other direction: in= stead
of customizing the export appearance of a series of headings, instead
starting with a common block of export text, and interpolating values
from the headings into that text -- ie, templating.

I've felt this need off and on for a couple of years, most recently whe= n
organizing a small literary festival. I really need to keep all the
information about the events in a single place, otherwise I know that
information will go stale right away. But I need the information in a
series of such wildly-varying formats that I can't imagine setting up (and switching between) export filters in a way that wouldn't make me cry. Not to mention that the different "export" use-cases all hav= e their
own per-heading boilerplate text, and there's no way I'm going to r= epeat
all that different boilerplate under each heading.

Obviously there's many ways this could be done. I could somehow hijack<= br> the export process -- in many cases it would be nice too make use of the skeleton document structures that export provides.

Or maybe dynamic blocks? I've never used them before. Or maybe just a plain old `org-map-entries', which reads the template text from an
external file and then steals some of the macro expansion functions to
fill out the values.

Has anyone wanted to do this before? Has anyone actually done it? Any
thoughts or suggestions would be much appreciated!

Yours,
Eric



--089e01537612b6128e051cd0ae10--