\catcode`\@=11
\def\listbi@{\penalty50 \medskip}
\def\listbii@{\penalty100 \smallskip}
\def\listmi@{\advance\leftskip30\p@\relax}
\let\listmii@\listmi@
\let\listmiii@\listmi@
\let\listmiv@\listmi@
\let\listmv@\listmi@
\def\itemi@#1{\noindent@@\llap{#1\hskip5\p@}}
\let\itemii@\itemi@
\let\itemiii@\itemi@
\let\itemiv@\itemi@
\let\itemv@\itemi@
\def\liste@{\penalty-50 \medskip}
\def\listei@{\penalty-100 \smallskip}
\def\list@@C{\csname list@C\number\listlevel@\endcsname}
\def\list@@P{\csname list@P\number\listlevel@\endcsname}
\def\list@@Q{\csname list@Q\number\listlevel@\endcsname}
\def\list@@S{\csname list@S\number\listlevel@\endcsname}
\def\list@@N{\csname list@N\number\listlevel@\endcsname}
\def\list@@F{\csname list@F\number\listlevel@\endcsname}
\def\Firstitem@true{\csname firstitem\romannumeral\listlevel@
 @true\endcsname}
\def\Firstitem@false{\csname firstitem\romannumeral\listlevel@
 @false\endcsname}
\def\Listm@{\csname listm\romannumeral\listlevel@ @\endcsname}
\def\Item@{\csname item\romannumeral\listlevel@ @\endcsname}
\def\Liste@{\csname liste\romannumeral\listlevel@ @\endcsname}
\def\keepitem{\listcontinue@true}
\def\list{%
 \iflistcontinue@\else\global\csname list@C1\endcsname\z@\fi
 \global\csname list@C2\endcsname\z@
 \global\csname list@C3\endcsname\z@
 \global\csname list@C4\endcsname\z@
 \global\csname list@C5\endcsname\z@
 \begingroup
 \firstitemi@true
 \listlevel@\@ne
 \def\item{\FN@\item@}%
 \FN@\list@}
\Invalid@\runinitem
\def\list@{\ifx\next\par
 \DN@\par{\FN@\list@}\else
 \ifx\next\runinitem
  \DN@\runinitem{\FN@\runinitem@}\else
  \DN@{\par\dimen@\parskip\parskip\dimen@}\fi\fi\next@}
\def\item@{%
 \ifoutlevel@\Liste@\outlevel@false\fi
 \ifrunin@\runin@false\par
  \dimen@\parskip\parskip\dimen@
  \Listm@\fi
 \iffirstitemi@\listbi@\listmi@\firstitemi@false\else\par\fi
 \iffirstitemii@\listbii@\listmii@\firstitemii@false\else\par\fi
 \iffirstitemiii@\listbiii@\listmiii@\firstitemiii@false\else\par\fi
 \iffirstitemiv@\listbiv@\listmiv@\firstitemiv@false\else\par\fi
 \iffirstitemv@\listbv@\listmv@\firstitemv@false\else\par\fi
 \DN@"##1"{{\let\pre\list@@P\let\post\list@@Q
  \let\style\list@@S\let\numstyle\list@@N
  \vskip-\parskip
  \Item@{\list@@F##1}%
  \noexpands@
  \Qlabel@{##1}}%
  \locallabel@
  \FNSSP@}%
 \DNii@{\global\advance\list@@C\@ne
  {\noexpands@
   \xdef\Thelabel@@@{\number\list@@C}%
   \xdefThelabel@\list@@N
   \xdef\Thelabel@@@@{\list@@P\Thelabel@\list@@Q}%
   \xdefThelabel@@\list@@S
  }%
  \locallabel@
  \vskip-\parskip
  \Item@{\list@@F\thelabel@@}%
  \FN@\pretendspace@}%
 \ifx\next"\expandafter\next@\else\expandafter\nextii@\fi}
\def\runinitem@{%
  \runin@true
  \Firstitem@false
  \DN@"##1"{{\let\pre\list@@P\let\post\list@@Q
   \let\style\list@@S\let\numstyle\list@@N
   \unskip\space{\list@@F##1} %
   \noexpands@
   \Qlabel@{##1}}%
   \locallabel@
   \ignorespaces}%
  \DNii@{\global\advance\list@@C\@ne
   {\noexpands@
    \xdef\Thelabel@@@{\number\list@@C}%
    \xdefThelabel@\list@@N
    \xdef\Thelabel@@@@{\list@@P\Thelabel@\list@@Q}%
    \xdefThelabel@@\list@@S
   }%
   \locallabel@
   \unskip\space{\list@@F\thelabel@@} }%
  \ifx\next"\expandafter\next@\else\expandafter\nextii@\fi}
\def\inlevel{\ifnum\listlevel@=5
 \DN@{\Err@{Already 5 levels down}}\else
 \DN@{\begingroup\advance\listlevel@\@ne
 \Firstitem@true\FN@\inlevel@}\fi\next@}
\def\inlevel@{\ifx\next\par
 \DN@\par{\FN@\inlevel@}\else
 \ifx\next\runinitem
  \DN@\runinitem{\FN@\runinitem@}\else
  \let\next@\relax\fi\fi\next@}
\def\outlevel{\ifnum\listlevel@=\@ne
 \Err@{At top level}\else
 \par\global\list@@C\z@\endgroup\outlevel@true\fi}
\def\endlist{%
 \par
 \global\toks\@ne{}\count@\listlevel@
 {\loop
  \ifnum\count@>\z@\global\toks\@ne\expandafter{\the\toks\@ne\endgroup}%
  \advance\count@\m@ne
  \repeat}%
 \the\toks\@ne
 \liste@
 \listcontinue@false
 \vskip-\parskip
 \noindent@@
 \FN@\pretendspace@}
\catcode`\@=\active
