%D \module
%D   [       file=publ-imp-list,
%D        version=2014.06.16,
%D          title=\CONTEXT\ Publication Support,
%D       subtitle=Lists,
%D         author=Alan Braslau and 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.

\unprotect

\starttexdefinition unexpanded btx:list:inject #content
    \ifconditional\btxinteractive
        \ifx\currentbtxinternal\empty
            #content
        \else
            \goto {
                #content
            } [
                \s!internal(\currentbtxinternal)
            ]
        \fi
    \else
        #content
    \fi
\stoptexdefinition

\starttexdefinition unexpanded btx:list:helpers:concat
    \space
\stoptexdefinition

\startsetups[\s!btx:\s!list:\s!page]
    \texdefinition{\s!btx:\s!list:concat}
    \texdefinition{\s!btx:\s!list:inject} {
        % real pagenumber: todo, userpage
        \currentbtxfirst
        % order
        \high{\currentbtxsecond}
    }
\stopsetups

\startsetups[\s!btx:\s!list:\s!numbering]
    \texdefinition {\s!btx:\s!list:inject} {
        \currentbtxfirst
        \btxparameter\c!stopper
    }
\stopsetups

% Hans: can the following setups be condensed to one using some variable?

\startsetups[\s!btx:\s!list:\s!numbering:default]
    \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:default]
        \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:default] {
            \fastsetup{\s!btx:\s!list:\s!numbering}
        }
    \btxstopstyleandcolor
\stopsetups

\startsetups[\s!btx:\s!list:\s!numbering:num]
    \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:num]
        \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:num] {
            \fastsetup{\s!btx:\s!list:\s!numbering}
        }
    \btxstopstyleandcolor
\stopsetups

\startsetups[\s!btx:\s!list:\s!numbering:short]
    \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:short]
        \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:short] {
            \fastsetup{\s!btx:\s!list:\s!numbering}
            \btxflushsuffix
        }
    \btxstopstyleandcolor
\stopsetups

\startsetups[\s!btx:\s!list:\s!numbering:tag]
    \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:tag]
        \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:tag] {
            \fastsetup{\s!btx:\s!list:\s!numbering}
        }
    \btxstopstyleandcolor
\stopsetups

\startsetups[\s!btx:\s!list:\s!numbering:index]
    \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:index]
        \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:index] {
            \fastsetup{\s!btx:\s!list:\s!numbering}
        }
    \btxstopstyleandcolor
\stopsetups

\protect
