2009/1/21 Wolfgang Schuster
And in the main file I have:
\letterclosing{Hoogachtend}{Cecil Westerhof}
But I would like to have this as the default, so I could use:
\letterclosing
Beside that I would like to have the possibility to use:
\letterclosing{business} or \letterclosing{family}
This would then use defined values.
When the first parameter is filled, but not with a recognized value, then the second parameter should be filled. If not, the compilation of the file should generate an error. Is this something that can be done?
\long\def\letterbody#1% {{\blank[line]\setupindenting[yes,medium]#1\par}}
\def\letterclosing {\dodoublegroupempty\doletterclosing}
\def\doletterclosing#1#2% {\ifsecondargument \dodoletterclosing{#1}{#2}% \else \doifelsenothing{#1} {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% {\processaction [#1] [ family=>{\dodoletterclosing{Informal closing,}{Cecil Westerhof}}, business=>{\dodoletterclosing{Formal closing}{Cecil Westerhof}}, unknown=>{\errorisfataltrue\waitonfatalerror}]}% \fi}
\def\dodoletterclosing#1#2% {\blank[line]#1\blank[3*line]#2}
\setupindenting[yes,none]
\starttext
\letterbody{\dorecurse{2}{\input knuth\par}} \letterclosing{Hoogachtend,}{Cecil Westerhof}
\page
\letterbody{\dorecurse{2}{\input knuth\par}} \letterclosing{family}
\page
\letterbody{\dorecurse{2}{\input knuth\par}} \letterclosing{business}
\page
\letterbody{\dorecurse{2}{\input knuth\par}} \letterclosing{unknown}
\stoptext
Goes a long way. With two parameters it works. When using 'unknown' or 'dummy', I get \wait= messages. When giving enter, the document is still generated. But that is not a real problem. But when using: \letterclosing or \letterclosing{} I get the same wait= message and there is no letterclosing generated (or an empty one). Found the problem. \doifelsenothing{#1} {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% should be: \doifelsenothing{#1} {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% Now it seems to do what I want. -- Cecil Westerhof