Henning Hraban Ramm schrieb am 08.04.2019 um 15:26:
How would you approach serial letters, e.g. to all members of a club?
(Actually I need to send out donation receipts.)

I’d like to use the letter module, since my usual letter design is using it.

I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
them to a SQLite db.
Would it make more sense to read them in Lua and combine this data with a 
buffer, or to write a single tex file for every letter?
I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
Would it make sense to use the bibliographies module?

You can use the letter module when you drop the normal letter-environment which is to limited in this case because it uses the buffer mechanism to store the content.

To have more control over the content for the opening etc. you can switch to the setups alternative (even the content can be set in this way instead of the default buffer) and set all texts with a setups-block.

The letter itself can be flushed with the \placeletter command, below is a simple example where I flush the letter after each variables setting but you should be able to do the same with a lua table or csv file.

\usemodule[letter]

\setuplettersection
  [opening]
  [alternative=setups]

\startsetups [letter:section:opening]
  \doifelse{\getvariable{address}{sex}}{male}
    {Dear Sir,}
    {Dear Madam,}
\stopsetups

\setvariable{address}{set}{\placeletter}

\starttext

\startlettercontent
\unknown
\stoplettercontent

\setvariables
  [address]
  [name=John,
   sex=male]

\setvariables
  [address]
  [name=Anna,
   sex=female]

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to