%D \module
%D   [      file=t-ltlen,
%D        version=2005.07.xx,
%D          title=\CONTEXT\ User Module,
%D       subtitle=\LaTeX\ compatibility paragraph handling,
%D         author=Brooks Moses,
%D           date=\currentdate,
%D      copyright={Brooks Moses; The LaTeX3 Project}]

%D This \ConTeXt\ module is part of the \LaTeX-compatibility
%D module set.  It provides the handling of \type{\par} for
%D environments such as lists, tabbing, arrays, and tabulars.

\usemodule[ltbase]
\unprotect


%D \section{Paragraphing Commands}
%D
%D From \type{ltpar.dtx}.  We note by experimentation that \ConTeXt\ uses
%D the \TeX\ primitive for \type{\par}, and so these shouldn't interfere
%D with that.
%D
%D There are two situations in which \type{\par} may be changed:
%D
%D \startitemize
%D \item Long-term changes, in which the new value is to remain in effect
%D    until the current environment is left.  The environments that
%D    change \type{\par} in this way are the following:
%D    \startitemize
%D        \item All list environments (itemize, quote, etc.)
%D        \item Environments that turn \type{\par} into a noop:
%D             tabbing, array and tabular.
%D    \stopitemize
%D \item  Temporary changes, in which \type{\par} is restored to its previous
%D value the next time it is executed. The following are all such uses.
%D    \begin{itemize}
%D       \item \type{\end} when preceded by \type{\@endparenv}, which is called by
%D                \type{\endtrivlist}
%D       \item  The mechanism for avoiding page breaks and getting the
%D          spacing right after section heads.
%d    \stopitemize
%D \stopitemize
%D
%D To permit the proper interaction of these two situations, long-term
%D changes are made by the \type{\@setpar} command.
%D
%D Short-term changes are made by the usual \type{\def\par} commands.
%D The original values are restored after a short-term change
%D by the \type{\@restorepar} commands.
%D 
%D \type{\@@par} always is defined to be the original [\ConTeXt] \type{\par}.
%D
%D \type{\everypar} is changed only for the short term.  Whenever \type{\everypar}
%D is set non-null, it should restore itself to null when executed.
%D
%D The following commands change \type{\everypar} in this way:
%D \startitemize
%D    \item \type{\item}
%D       \item \type{\end} when preceded by \type{\@endparenv}, which is called by
%D                \type{\endtrivlist}
%D    \item \type{\minipage}
%D \end{itemize}
%D
%D [More documentation snipped rather than converted.]

%D Initiate a long-term change to \type{\par}.

\def\@setpar#1{\def\par{#1}\def\@par{#1}}

%D The default definition of \type{\@par} will ensure that if
%D \type{\@restorepar} defines \type{\par} to execute \type{\@par}
%D it will redefine itself to the primitive \type{\@@par} after one iteration.

\def\@par{\let\par\@@par\par}

%D Restore from a short-term change to \type{\par}

\def\@restorepar{\def\par{\@par}}



\protect