%D \module
%D   [     file=letter-imp-default,
%D      version=2012.06.10,
%D        title=\CONTEXT\ User Module,
%D     subtitle=Default letter style,
%D       author=Wolfgang Schuster,
%D         date=\currentdate,
%D    copyright=Wolfgang Schuster,
%D      license=GNU General Public License]

%C Copyright (C) 2011 Wolfgang Schuster
%C
%C This program is free software: you can redistribute it and/or modify
%C it under the terms of the GNU General Public License as published by
%C the Free Software Foundation, either version 3 of the License, or
%C (at your option) any later version.
%C
%C This program is distributed in the hope that it will be useful,
%C but WITHOUT ANY WARRANTY; without even the implied warranty of
%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%C GNU General Public License for more details.
%C
%C You should have received a copy of the GNU General Public License
%C along with this program.  If not, see <https://www.gnu.org/licenses/>.

\setupletter
  [\c!date=\currentdate]

\setupletterlayer
  [\v!head,\v!nexthead,\v!lefthead,\v!righthead]
  [\c!x=\backspace,
   \c!y=\topspace]

\setupletterframe
  [\v!head,\v!nexthead,\v!lefthead,\v!righthead]
  [\c!width=\textwidth]

\setupletterlayer
  [\v!foot,\v!nextfoot,\v!leftfoot,\v!rightfoot]
  [\c!preset=\v!left\v!bottom,
   \c!x=\backspace,
   \c!y=\bottomspace]

\setupletterframe
  [\v!foot,\v!nextfoot,\v!leftfoot,\v!rightfoot]
  [\c!width=\textwidth,
   \c!height=\footerheight]

%\setupletterlayer
%  [\v!head]
%  [\c!rulewidth=\hsize,
%   \c!fromrule=\v!no,
%   \c!rulecolor=\v!black,
%   \c!alternative=\v!left]

\setupletterlayer
  [\v!nexthead,\v!nextfoot]
  [\c!state=\v!next]

\setupletterlayer
  [\v!lefthead,\v!leftfoot]
  [\c!state=\v!left]

\setupletterlayer
  [\v!righthead,\v!rightfoot]
  [\c!state=\v!right]

\setupletterlayer
  [\v!backaddress]
  [\c!alternative=\v!auto,
   \c!separator={, }]

\setupletterlayer
  [\v!reference]
  [\c!alternative=\v!a,
   \c!list=\c!date]

\setuplettersection
  [\v!closing]
  [\c!spaceafter=\v!line,
   \c!spaceinbetween={\v!samepage,2*\v!line}]

\defineletterelements
  [\v!layer]
  [\v!lettermain,
   \v!letternext,
   \v!head,
   \v!nexthead,
   \v!lefthead,
   \v!righthead,
   \v!foot,
   \v!nextfoot,
   \v!topmark,
   \v!botmark,
   \v!cutmark,
   \v!endmark,
   \v!usermark,
   \v!backaddress,
   \v!address,
   \v!reference,
   \v!location]

\defineletterelements
  [\v!section]
  [\v!title,
   \v!subject,
   \v!opening,
   \v!content,
   \v!closing,
   \v!appendices]

\defineletterelements
  [\v!description]
  [\v!copy,
   \v!enclosure,
   \v!postscript]

\setupletterdescription
  [\c!copy]
  [\c!headcommand=\lettertext\v!copy,
   \c!textcommand=\correspondenceparameter\c!copy]

\setupletterdescription
  [\c!enclosure]
  [\c!headcommand=\lettertext\v!enclosure,
   \c!textcommand=\correspondenceparameter\c!enclosure]

\setupletterdescription
  [\c!postscript]
  [\c!headcommand=\lettertext\v!postscript,
   \c!textcommand=\correspondenceparameter\c!postscript]

\endinput
