MAJOR=4
MINOR=12
DEVNAME=tty12
  M   ˆl–Ü4ý(Ð;�½p-©‹Fÿ�þDÜ­¬Üd+mQ¹üÿÃƒ}Ð»Êa–äY>” ”¾R( 	Å �zà¦-ÿÈ %õ    %D \module
%D   [       file=strc-des,
%D        version=2008.10.20,
%D          title=\CONTEXT\ Structure Macros,
%D       subtitle=Descriptions,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Structure Macros / Descriptions}

\unprotect

\installcorenamespace{description}

\installcommandhandler \??description {description} \??description

\let\setupdescriptions\setupdescription

% \setupdescription % check with old
%   [\c!alternative=\descriptionparameter\c!location,
%    \c!location=\v!left]

\setupdescription % check with old
  [\c!alternative=\v!left,
   \c!headstyle=\v!bold,
   \c!titlestyle=\v!bold,
  %\c!style=,
  %\c!color=,
  %\c!headcolor=,
  %\c!titlecolor=,
   \c!width=7\emwidth,
   \c!distance=\emwidth,
   \c!titledistance=.5\emwidth,
  %\c!hang=,
  %\c!sample=,
  %\c!align=,
  %\c!headalign=,
   \c!margin=\v!no,
   \c!before=\blank,
   \c!inbetween=\blank,
   \c!after=\blank,
   \c!indentnext=\v!yes,
   \c!indenting=\v!never,
   \c!titleleft=(,
   \c!titleright=),
  %\c!closesymbol=,
   \c!closecommand=\wordright,
   \c!display=\v!yes,
  %\c!command=,
   \c!titlecommand=,
   \c!expansion=\v!no,
  %\c!xmlsetup=,
  %\s!catcodes=,
   \c!title=\v!yes,
  %\c!text=,
  ]

\appendtoks
    \ifx\currentdescriptionparent\empty
        \defineconstruction[\currentdescription][\currentdescriptionparent][\s!handler=\v!description,\c!level=1]%
    \else
        \defineconstruction[\currentdescription][\s!handler=\v!description,\c!level=1]%
    \fi
    \setuevalue        {\currentdescription}{\strc_descriptions_command{\currentdescription}}%
    \setuevalue{\e!start\currentdescription}{\strc_descriptions_start  {\currentdescription}}%
    \setuevalue{\e!stop \currentdescription}{\strc_descriptions_stop}%
\to \everydefinedescription

\let\p_strc_constructions_title \empty

\unexpanded\setvalue{\??constructioninitializer\v!description}%
  {\let\currentdescription              \currentconstruction
   \let\constructionparameter           \descriptionparameter
   \let\constructionnamespace           \??description
   \let\detokenizedconstructionparameter\detokenizeddescriptionparameter
   \let\letconstructionparameter        \letdescriptionparameter
   \let\useconstructionstyleandcolor    \usedescriptionstyleandcolor
   \let\setupcurrentconstruction        \setupcurrentdescription
   \edef\p_strc_constructions_title{\constructionparameter\c!title}%
   \ifx\p_strc_constructions_title\v!yes
     \settrue\c_strc_constructions_title_state
   \else
     \setfalse\c_strc_constructions_title_state
   \fi}

% We keep the command variant around but rather would move to the
% start-stop one. Also, passing the title as argument has some
% history so we need to keep that as well.

% \startdescription [reference]                text \stopdescription
% \startdescription [reference]{title}         text \stopdescription
% \startdescription [title=,title=,reference=] text \stopdescription

% A bit over the top, the optional title but mkii has it too.

\unexpanded\def\strc_descriptions_start#1%
  {\begingroup
   \strc_constructions_initialize{#1}%
   \doifelsenextoptionalcs\strc_descriptions_start_yes\strc_descriptions_start_nop}

\unexpanded\def\strc_descriptions_start_yes[#1]%
  {\doifelseassignment{#1}\strc_descriptions_start_yes_assignment\strc_descriptions_start_yes_reference[#1]}

\unexpanded\def\strc_descriptions_start_yes_assignment[#1]% todo userdata
  {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#1]%
   \csname\??constructionstarthandler\currentconstructionhandler\endcsname}

\unexpanded\def\strc_descriptions_start_yes_reference
  {\ifconditional\c_strc_constructions_title_state
     \expandafter\str