diff options
Diffstat (limited to 'tex/context/base/publ-ini.mkiv')
-rw-r--r-- | tex/context/base/publ-ini.mkiv | 284 |
1 files changed, 148 insertions, 136 deletions
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index a4452e451..f913ff3bd 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -11,7 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. - % TODO: s! vs v! for default and neutral key/values % todo: too many refs in list @@ -307,11 +306,9 @@ \def\publ_command_nop#1% {\ifcsname#1\endcsname \showmessage\m!publications{10}{#1,#1}% - %\setuxvalue{\??btxcommand#1}{\expandafter\noexpand\csname#1\endcsname}% \global\expandafter\let\csname\??btxcommand#1\expandafter\endcsname\csname#1\endcsname \else\ifcsname\utfupper{#1}\endcsname \showmessage\m!publications{10}{#1}{\utfupper{#1}}% - %\setuxvalue{\??btxcommand#1}{\expandafter\noexpand\csname\utfupper{#1}\endcsname}% \global\expandafter\let\csname\??btxcommand#1\expandafter\endcsname\csname\utfupper{#1}\endcsname \else \showmessage\m!publications{11}{#1}% @@ -373,6 +370,7 @@ \unexpanded\def\btxnbsp {\removeunwantedspaces\nbsp} % the same anyway \unexpanded\def\btxperiod {\removeunwantedspaces.\space} \unexpanded\def\btxcomma {\removeunwantedspaces,\space} +\unexpanded\def\btxcommabreak {\removeunwantedspaces,\hskip\zeropoint plus .5\emwidth\relax} \unexpanded\def\btxcolon {\removeunwantedspaces:\space} \unexpanded\def\btxsemicolon {\removeunwantedspaces;\space} \unexpanded\def\btxlparent {\removeunwantedspaces\space(} % obsolete @@ -395,7 +393,8 @@ \let\currentbtxdataset \empty \unexpanded\def\btxsetdataset {\def\currentbtxdataset} \let\currentbtxfirst \empty \unexpanded\def\btxsetfirst {\def\currentbtxfirst} \let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond} -\let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird} +%let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird} +\let\currentbtxsuffix \empty \unexpanded\def\btxsetsuffix {\def\currentbtxsuffix} \let\currentbtxinternal \empty \unexpanded\def\btxsetinternal {\def\currentbtxinternal} \let\currentbtxlefttext \empty \unexpanded\def\btxsetlefttext {\def\currentbtxlefttext} \let\currentbtxrighttext \empty \unexpanded\def\btxsetrighttext {\def\currentbtxrighttext} @@ -425,9 +424,14 @@ \unexpanded\def\currentbtxsurnames_indeed {\clf_btxcurrentsurnames \numexpr\currentbtxauthorindex\relax} \unexpanded\def\currentbtxvons_indeed {\clf_btxcurrentvons \numexpr\currentbtxauthorindex\relax} +\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage #1{\def\currentbtxfirstpage{\btx_page_number{#1}}} +\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}} +\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal {\def\currentbtxfirstinternal} +\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal} + \def\currentbtxauthorvariant{normal} -\unexpanded\def\btxlistreset +\unexpanded\def\btx_reset_list % not needed as we're grouped {\let\currentbtxcombis \empty \let\currentbtxcategory \empty \let\currentbtxinternal \empty @@ -439,12 +443,14 @@ \let\currentbtxbacktrace\empty \let\currentbtxlanguage \empty \let\currentbtxtag \empty + \let\currentbtxsuffix \empty \let\currentbtxnumber \empty \let\currentbtxdataset \empty} -\unexpanded\def\btxcitereset % check for less .. not all resets needed +\unexpanded\def\btx_reset_cite % check for less .. not all resets needed when we're grouped (only subcites) {\let \currentbtxfirst \empty \let \currentbtxsecond \empty + \let \currentbtxsuffix \empty \let \currentbtxinternal \empty \let \currentbtxlefttext \empty \let \currentbtxrighttext \empty @@ -460,6 +466,27 @@ \setconstant\currentbtxconcat \zerocount \setconstant\currentbtxcount \zerocount} +\unexpanded\def\btx_reset_page % probably not needed + {\let \currentbtxfirstpage \empty + \let \currentbtxlastpage \empty + \let \currentbtxfirstinternal\empty + \let \currentbtxlastinternal \empty + \setconstant\currentbtxoverflow \zerocount + \setconstant\currentbtxconcat \zerocount + \setconstant\currentbtxcount \zerocount} + +\unexpanded\def\btx_reset_numbering % probably not needed + {\let \currentbtxfirst \empty + \let \currentbtxsecond\empty + \let \currentbtxsuffix\empty + \setconstant\currentbtxconcat\zerocount} + +%D Pages: + +\unexpanded\def\btx_page_number#1% + {\def\currentlistindex{#1}% + \structurelistpagenumber} + %D Language: \def\mainbtxlanguage{\currentmainlanguage} @@ -497,7 +524,6 @@ %D Lists: \newdimen\d_publ_number_width -%newdimen\d_publ_number_distance \ifdefined\btxblock \else \newcount\btxblock \fi \btxblock\plusone \ifdefined\btxcitecounter \else \newcount\btxcitecounter \fi % maybe pass this to lua @@ -512,11 +538,12 @@ [\s!btx] [\c!prefixstopper=:, \c!state=\v!start, - \c!alternative=\v!paragraph, + \c!alternative=a, + %\c!alternative=\v!paragraph, + %\c!width=\v!auto, + %\c!distance=\emwidth, \c!before=\blank, - \c!after=\blank, - \c!width=\v!auto, - \c!distance=\emwidth] + \c!after=\blank] \unexpanded\def\setupbtxlist {\dodoubleempty\publ_setup_list} @@ -551,26 +578,6 @@ \settrue\setfalse\c_btx_list_texts \to \everysetupbtxlistplacement -% page stuff (for thomas) - -\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage #1{\def\currentbtxfirstpage{\btx_page_number{#1}}} -\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}} -\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal {\def\currentbtxfirstinternal} -\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal} - -\unexpanded\def\btx_page_number#1% - {\def\currentlistindex{#1}% - \structurelistpagenumber} - -\unexpanded\def\btxpagereset - {\let \currentbtxfirstpage \empty - \let \currentbtxlastpage \empty - \let \currentbtxfirstinternal\empty - \let \currentbtxlastinternal \empty - \setconstant\currentbtxoverflow \zerocount - \setconstant\currentbtxconcat \zerocount - \setconstant\currentbtxcount \zerocount} - \newconditional\c_btx_list_pages \appendtoks @@ -582,19 +589,34 @@ {\dontleavehmode \begingroup \setbtxlist % probably already set - \btxpagereset + \btx_reset_page \setbtxparameterset\s!page\s!list - \btxparameter\c!command + \btxparameter\c!pagecommand {\usebtxstyleandcolor\c!style\c!color \btxparameter\c!pageleft \clf_btxflushpages{\currentbtxdataset}{\currentbtxtag}% \btxparameter\c!pageright}% \endgroup} -\unexpanded\def\btxpagesetup - {\btxsetuptype\plusfour - \fastbtxsetup\s!page\s!list - \btxpagereset} +\unexpanded\def\btxpagesetup#1% nothing yet + {\begingroup + %\setbtxparameterset{\c!page:\s!default}\currentbtxnumbering + \btxparameter\c!left + % \btxparameter\c!command{\publ_fast_setup\plusfive\s!list\s!page}% + \publ_fast_setup\plusfive\s!list\s!page + \btxparameter\c!right + \endgroup + \btx_reset_page} % probably not needed + +\unexpanded\def\btxnumberingsetup#1% + {\begingroup + \setbtxparameterset{\c!list:\s!numbering}\currentbtxnumbering % brrrr \setbtxlist + \btxparameter\c!left + % \btxparameter\c!command{\publ_fast_setup\plusthree{\s!list:\s!numbering}{#1}}% + \publ_fast_setup\plusthree{\s!list:\s!numbering}{#1}% + \btxparameter\c!right + \endgroup + \btx_reset_numbering} % probably not needed % end of page stuff @@ -608,8 +630,7 @@ \begingroup \usebtxstyleandcolor\c!style\c!color \ignorespaces - \btxsetuptype\plusthree - \fastbtxsetup\s!list\currentbtxcategory + \publ_fast_setup\plusfour\s!list\currentbtxcategory \removeunwantedspaces \endgroup \ifconditional\c_btx_list_pages @@ -640,8 +661,7 @@ {\begingroup \def\currentbtxtag{#1}% \ignorespaces - \btxsetuptype\plusthree - \fastbtxsetup\s!list\currentbtxcategory + \publ_fast_setup\plusfour\s!list\currentbtxcategory \removeunwantedspaces \endgroup} @@ -834,8 +854,7 @@ \unexpanded\def\btxlistsetup#1% used for the reference in the list {\the\everybtxlistentry \everybtxlistentry\emptytoks % so only once per entry to be sure - \btxsetuptype\plusthree - \fastbtxsetup\s!list{#1}} + \publ_fast_setup\plusfour\s!list{#1}} \appendtoks \btx_check_language @@ -843,15 +862,15 @@ \unexpanded\def\btx_reference_indeed {\begingroup - %let\currentbtxlistvariant\currentbtxnumbering - \setbtxparameterset\c!list\currentbtxnumbering + % redundantm will go away: + \setbtxparameterset{\c!list:\s!numbering}\currentbtxnumbering + % \ifx\currentbtxnumbering\empty % nothing \else\ifx\currentbtxnumbering\v!no % nothing \else \usebtxstyleandcolor\c!style\c!color % new, needed? - % \btxparameter\c!left \ifconditional\c_publ_prefixed\btxlistprefixednumber\fi \clf_btxlistvariant % some can go {\currentbtxdataset}% @@ -860,7 +879,6 @@ {\currentbtxnumbering}% {\currentbtxnumber}% \relax - % \btxparameter\c!right \fi\fi \endgroup} @@ -926,18 +944,6 @@ \newtoks\t_btx_reference_inject -% \def\btx_cite_reference_inject_indeed -% {\btx_trace_list_cross\currentbtxbacklink\empty -% \the\t_btx_reference_inject -% \normalexpanded{\writedatatolist % can be done faster .. just merge code here (not much) / also type btx -% [\s!btx]% -% [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% -% \s!btxref=\currentbtxtag,% -% \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi% -% \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi% -% \s!btxint=\number\currentbtxbacklink -% \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]}} - \def\btx_cite_reference_inject_indeed {\btx_trace_list_cross\currentbtxbacklink\empty \the\t_btx_reference_inject @@ -976,13 +982,22 @@ \let\currentlistmethod\s!btx \to \everysetupbtxlistplacement -% \appendtoks -% \edef\currentbtxcriterium{\btxrenderingparameter\c!criterium}% -% \to \everysetupbtxlistplacement +\unexpanded\def\btxremapauthor + {\dodoubleargument\btx_remap_author} + +\def\btx_remap_author[#1][#2]% + {\clf_btxremapauthor{#1}{#2}} \unexpanded\def\btxflushauthor {\doifelsenextoptionalcs\btx_flush_author_yes\btx_flush_author_nop} +\unexpanded\def\btxflushsuffix + {\ifx\currentbtxsuffix\empty + % nothing + \else + \characters{\currentbtxsuffix}% todo : rendering specific converter + \fi} + \def\btx_flush_author_yes[#1]{\btx_flush_author{#1}} \def\btx_flush_author_nop {\btx_flush_author{\btxparameter\c!authorconversion}} @@ -1099,17 +1114,6 @@ \fi \to \everysetupbtxciteplacement -% till here - -% \unexpanded\def\btxnumberedreference[#1]% \bibtexnumref (replaced by \cite[num]) -% {\dontleavehmode -% \begingroup -% \btxparameter\v!left -% \penalty\plustenthousand % todo -% \clf_btxresolvelistreference{\currentbtxdataset}{#1}% todo: split dataset from #1, so another call -% \btxparameter\v!right -% \endgroup} - %D When a publication is cited, we need to signal that somehow. This is done with the %D following (not user) command. We could tag without injecting a node but this way %D we also store the location, which makes it possible to ask local lists. @@ -1223,29 +1227,30 @@ \dosingleargument\publ_cite_handle_variant_indeed} \unexpanded\def\publ_cite_handle_variant_blob - {%\btxparameter\v!left\relax - \clf_btxhandlecite - dataset {\currentbtxdataset}% - reference {\currentbtxreference}% - markentry \iftrialtypesetting\s!false\else\s!true\fi\space - variant {\currentbtxcitealternative}% - sorttype {\btxparameter\c!sorttype}% - compress {\btxparameter\c!compress}% - author {\btxparameter\c!author}% - lefttext {\p_publ_cite_lefttext}% - righttext {\p_publ_cite_righttext}% - before {\p_publ_cite_before}% - after {\p_publ_cite_after}% + {\clf_btxhandlecite + dataset {\currentbtxdataset}% + reference {\currentbtxreference}% + markentry \iftrialtypesetting\s!false\else\s!true\fi\space + variant {\currentbtxcitealternative}% + sorttype {\btxparameter\c!sorttype}% + compress {\btxparameter\c!compress}% + author {\btxparameter\c!author}% + authorconversion {\c!authorconversion}% + lefttext {\p_publ_cite_lefttext}% + righttext {\p_publ_cite_righttext}% + before {\p_publ_cite_before}% + after {\p_publ_cite_after}% \relax - \clf_btxflushmarked % maybe: \iftrialtypesetting\else ... \fi - }%\btxparameter\v!right\relax} + \clf_btxflushmarked} % maybe: \iftrialtypesetting\else ... \fi \def\publ_cite_handle_variant_indeed[#1]% {\letbtxparameter\c!alternative\currentbtxcitealternative \edef\currentbtxreference{#1}% \usebtxstyleandcolor\c!style\c!color \uselanguageparameter\btxdatasetparameter % new + \btxparameter\c!left \btxparameter\c!command{\publ_cite_handle_variant_blob}% + \btxparameter\c!right \endgroup} \unexpanded\def\btxcitation @@ -1292,7 +1297,7 @@ \setvalue{\??setup:\s!btx:\s!unknown}#1{\inframed{\tttf#1}} -\def\fastbtxsetup_yes#1#2% +\def\publ_fast_setup_yes#1#2% {\csname\??setup:\s!btx:% \ifcsname\??setup:\s!btx:\currentbtxspecification:#1:#2\endcsname \currentbtxspecification:#1:#2% @@ -1309,7 +1314,7 @@ \fi\fi\fi\fi\fi \endcsname{#2}} -\def\fastbtxsetup_nop#1#2% +\def\publ_fast_setup_nop#1#2% {\csname\??setup:\s!btx:% \ifcsname\??setup:\s!btx:\currentbtxspecification:#1:#2\endcsname \currentbtxspecification:#1:#2% @@ -1322,76 +1327,84 @@ \fi\fi\fi \endcsname{#2}} -\def\fastbtxsetup - {\ifx\currentbtxspecificationfallback\empty - \expandafter\fastbtxsetup_nop - \else - \expandafter\fastbtxsetup_yes - \fi} - -\let\publ_fastbtxsetup_normal\fastbtxsetup - \newconstant\btxsetuptype % 0 = unknown darkred % 1 = cite darkblue % 2 = subcite darkgreen -% 3 = list darkcyan -% 4 = page darkmagenta -% 5 = unknown darkred +% 3 = numbering darkorange +% 4 = list darkcyan +% 5 = page darkmagenta +% 6 = unknown darkred -\unexpanded\def\publ_fastbtxsetup_chain_inbetween +\unexpanded\def\publ_fast_btx_setup_chain_inbetween {\allowbreak->\allowbreak} -\unexpanded\def\publ_fastbtxsetup_chain_yes#1#2% +\unexpanded\def\publ_fast_btx_setup_chain_yes#1#2% {\dontleavehmode\begingroup \infofont \ifcase\btxsetuptype\darkred\or\darkblue\or\darkgreen\or\darkcyan\or\darkmagenta\else\darkred\fi [% \currentbtxspecification :#1:#2\ifcsname\??setup:\s!btx:\currentbtxspecification :#1:#2\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween \currentbtxspecificationfallback:#1:#2\ifcsname\??setup:\s!btx:\currentbtxspecificationfallback :#1:#2\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween #1:#2\ifcsname\??setup:\s!btx :#1:#2\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween \currentbtxspecification :#1:\s!unknown\ifcsname\??setup:\s!btx:\currentbtxspecification :#1:\s!unknown\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween \currentbtxspecificationfallback:#1:\s!unknown\ifcsname\??setup:\s!btx:\currentbtxspecificationfallback:#1:\s!unknown\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween unset\fi\fi\fi\fi\fi + \space @\space + \currentbtx ]% \endgroup} -\unexpanded\def\publ_fastbtxsetup_chain_nop#1#2% +\unexpanded\def\publ_fast_btx_setup_chain_nop#1#2% {\dontleavehmode\begingroup \infofont \darkred [% \currentbtxspecification :#1:#2\ifcsname\??setup:\s!btx:\currentbtxspecification :#1:#2\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween #1:#2\ifcsname\??setup:\s!btx :#1:#2\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween \currentbtxspecification :#1:\s!unknown\ifcsname\??setup:\s!btx:\currentbtxspecification :#1:\s!unknown\endcsname\else - \publ_fastbtxsetup_chain_inbetween + \publ_fast_btx_setup_chain_inbetween unset\fi\fi\fi + \space @\space + \currentbtx ]% \endgroup} -\unexpanded\def\publ_fastbtxsetup_chain - {\ifx\currentbtxspecificationfallback\empty - \expandafter\publ_fastbtxsetup_chain_nop +\unexpanded\def\publ_fast_btx_setup_normal#1% + {\btxsetuptype#1\relax + \ifx\currentbtxspecificationfallback\empty + \expandafter\publ_fast_setup_nop \else - \expandafter\publ_fastbtxsetup_chain_yes + \expandafter\publ_fast_setup_yes \fi} -\unexpanded\def\publ_fastbtxsetup_visual#1#2% - {\publ_fastbtxsetup_chain{#1}{#2}% - \publ_fastbtxsetup_normal{#1}{#2}} +\unexpanded\def\publ_fast_btx_setup_visual#1#2#3% + {\btxsetuptype#1\relax + \ifx\currentbtxspecificationfallback\empty + \expandafter\publ_fast_btx_setup_chain_nop + \else + \expandafter\publ_fast_btx_setup_chain_yes + \fi{#2}{#3}% + \ifx\currentbtxspecificationfallback\empty + \expandafter\publ_fast_setup_nop + \else + \expandafter\publ_fast_setup_yes + \fi{#2}{#3}} \installtextracker {publications.setups} - {\let\fastbtxsetup\publ_fastbtxsetup_visual} - {\let\fastbtxsetup\publ_fastbtxsetup_normal} + {\let\publ_fast_setup\publ_fast_btx_setup_visual} + {\let\publ_fast_setup\publ_fast_btx_setup_normal} + +\let\publ_fast_setup\publ_fast_btx_setup_normal %D Cite helpers: @@ -1403,15 +1416,13 @@ \unexpanded\def\btxcitesetup#1% {\the\everybtxciteentry - \btxsetuptype\plusone \everybtxciteentry\emptytoks % tricky maybe not when subcites - \fastbtxsetup\s!cite{#1}} % no \btxcitereset as we loose dataset and such + \publ_fast_setup\plusone\s!cite{#1}} % no \btxcitereset as we loose dataset and such \unexpanded\def\btxsubcitesetup#1% {\the\everybtxciteentry - \btxsetuptype\plustwo \everybtxciteentry\emptytoks % tricky maybe not when subcites - \fastbtxsetup\s!cite{#1}} % no \btxcitereset as we loose dataset and such + \publ_fast_setup\plustwo\s!cite{#1}} % no \btxcitereset as we loose dataset and such \appendtoks \btx_check_language @@ -1419,16 +1430,16 @@ \unexpanded\def\btxstartsubcite#1% {\begingroup - \btxcitereset % todo: limited set + \btx_reset_cite % todo: limited set \def\currentbtxcitealternative{#1}% \setbtxparameterset\s!cite\currentbtxcitealternative \usebtxstyleandcolor\c!style\c!color - % \btxparameter\c!left + \btxparameter\c!left \relax} \unexpanded\def\btxstopsubcite - {%\relax - % \btxparameter\c!right + {\relax + \btxparameter\c!right \endgroup} \unexpanded\def\btxstartciterendering[#1]% @@ -1436,12 +1447,12 @@ \edef\currentbtxcitealternative{#1}% \setbtxparameterset\s!cite\currentbtxcitealternative \usebtxstyleandcolor\c!style\c!color - % \btxparameter\c!left - }%\relax} + \btxparameter\c!left + \relax} \unexpanded\def\btxstopciterendering {\relax - % \btxparameter\c!right + \btxparameter\c!right \endgroup} \let\btxstartcite \begingroup @@ -1638,8 +1649,8 @@ \let\btxstopcolor \endgroup \let\btxstopstyleandcolor\endgroup -\unexpanded\def\btxusecommand[#1]% - {\namedbtxparameter{#1}\c!command} +\unexpanded\def\btxusecommand[#1]#2% using #2 permits space after [] + {\namedbtxparameter{#1}\c!command{#2}} %D Defaults: @@ -1672,7 +1683,8 @@ \c!alternative=num, % default cite form \c!inbetween=\space, \c!range=\endash, % separator:range? - \c!compress=\v!no, + \c!compress=\v!yes, % was no? + \c!sorttype=normal, % normal, reverse or none \c!etallimit=3, \c!etaldisplay=\btxparameter\c!etallimit, \c!otherstext={\space et al.}, |