summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/publ-ini.mkiv')
-rw-r--r--tex/context/base/publ-ini.mkiv205
1 files changed, 86 insertions, 119 deletions
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index fa7a5bca0..e32e99114 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -50,6 +50,7 @@
\def\s!btx {btx}
\def\s!cite {cite}
+\def\s!nocite {nocite}
\def\s!list {list}
\def\v!btxcite {btxcite}
\def\v!btxlist {btxlist}
@@ -85,20 +86,6 @@
\csname\??constructionstophandler \v!construction\endcsname
\endgroup}
-\unexpanded\setvalue{\??constructionstarthandler\v!btxlist}%
- {\csname\??constructionstarthandler\v!construction\endcsname
- %\ifx\currentbtxnumbering\empty\else
- % \startgoto[\s!internal(\currentbtxinternal)]%
- %\fi
- }
-
-\unexpanded\setvalue{\??constructionstophandler\v!btxlist}%
- {%\ifx\currentbtxnumbering\empty\else
- % \stopgoto
- %\fi
- \csname\??constructionstophandler\v!construction\endcsname
- \endgroup}
-
\unexpanded\def\startbtxlistentry#1%
{\begingroup
\strc_constructions_initialize{#1}%
@@ -107,15 +94,43 @@
\unexpanded\def\stopbtxlistentry
{\csname\??constructionstophandler\currentconstructionhandler\endcsname}
+% interactivity is handled in setup
+%
+% \unexpanded\setvalue{\??constructiontexthandler\v!btxlist}%
+% {\begingroup
+% \ifx\currentbtxnumbering\empty\else
+% \startgoto[\s!internal(\currentbtxinternal)]% handled in setup
+% \fi
+% \directsetup{\v!btxrendering:\v!number:\constructionparameter\c!number}%
+% \ifx\currentbtxnumbering\empty\else
+% \stopgoto
+% \fi
+% \endgroup}
+%
+% so:
+
\unexpanded\setvalue{\??constructiontexthandler\v!btxlist}%
{\begingroup
- \ifx\currentbtxnumbering\empty\else
- \startgoto[\s!internal(\currentbtxinternal)]%
- \fi
\directsetup{\v!btxrendering:\v!number:\constructionparameter\c!number}%
- \ifx\currentbtxnumbering\empty\else
- \stopgoto
+ \endgroup}
+
+% the whole entry can be interactive
+
+\unexpanded\setvalue{\??constructionstarthandler\v!btxlist}%
+ {\csname\??constructionstarthandler\v!construction\endcsname
+ \ifx\currentbtxnumbering\v!no\else
+ \ifx\currentbtxinternal\empty \else
+ \startgoto[\s!internal(\currentbtxinternal)]%
+ \fi
+ \fi}
+
+\unexpanded\setvalue{\??constructionstophandler\v!btxlist}%
+ {\ifx\currentbtxnumbering\v!no\else
+ \ifx\currentbtxinternal\empty \else
+ \stopgoto
+ \fi
\fi
+ \csname\??constructionstophandler\v!construction\endcsname
\endgroup}
\startsetups[\v!btxrendering:\v!number:\v!no]
@@ -307,7 +322,7 @@
\let\currentbtxdataset\v!standard
\unexpanded\def\setbtxdataset[#1]%
- {\edef\m_temp{\ctxcommand{setbtxdataset("#1","\currentbtxdataset")}}}
+ {\edef\currentbtxdataset{\ctxcommand{setbtxdataset("#1","\currentbtxdataset")}}}
\unexpanded\def\setbtxentry[#1]%
{\edef\currentbtxtag{\ctxcommand{setbtxentry("\currentbtxdataset","#1")}}}
@@ -480,18 +495,6 @@
\publ_place_list_indeed
\endgroup}
-\newconditional\c_publ_place_all
-\newconditional\c_publ_place_register % to be interfaced
-\newconditional\c_publ_place_check % to be interfaced
-
-\appendtoks
- \ifx\currentbtxcriterium\v!all % move this check to lua ... easier to test there anyway
- \settrue\c_publ_place_all
- \else
- \setfalse\c_publ_place_all
- \fi
-\to \everysetupbtxlistplacement
-
\def\publ_place_list_indeed
{\startbtxrendering[\currentbtxrendering]%
% \directsetup{\btxrenderingparameter\c!setups}% specific initializations
@@ -503,51 +506,40 @@
\the\everysetupbtxlistplacement
\forgetall
% why not pass this with collect .. todo
- \ctxcommand{btxsetlistmethod("\currentbtxdataset","\btxrenderingparameter\c!method")}%
\startpacked[\v!blank]%
% here we just collect items
\ctxcommand{btxcollectlistentries {
names = "btx",
criterium = "\currentbtxcriterium",
+ method = "\btxrenderingparameter\c!method",
number = "\btxrenderingparameter\c!number",
btxdataset = "\currentbtxdataset",
keyword = "\btxrenderingparameter\c!keyword",
+ sorttype = "\btxrenderingparameter\c!sorttype",
+ repeated = "\btxrenderingparameter\c!repeat",
}}%
% next we analyze the width
\ifx\currentbtxnumbering\empty \else
\edef\p_width{\btxrenderingparameter\c!width}%
\ifx\p_width\v!auto
\scratchcounter\btxlistcounter
- \setbox\scratchbox\vbox{\settrialtypesetting\ctxcommand{btxfetchlistentries("\currentbtxdataset")}}%
+ \setbox\scratchbox\vbox \bgroup
+ \settrialtypesetting
+ \ctxcommand{btxfetchlistentries("\currentbtxdataset")}%
+ \egroup
\d_publ_number_width\wd\scratchbox
\global\btxlistcounter\scratchcounter
\letbtxlistparameter\c!width\d_publ_number_width
\fi
\fi
% this actually typesets them
- \ctxcommand{btxflushlistentries("\currentbtxdataset","\btxrenderingparameter\c!sorttype")}%
+ \ctxcommand{btxflushlistentries("\currentbtxdataset")}%
\stoppacked
\stopbtxrendering
\global\advance\btxblock\plusone}
\def\currentbtxblock{\number\btxblock}
-\def\publ_place_list_entry_checked
- {\ctxcommand{btxdoifelselistentryplaced("\currentbtxdataset","\currentbtxtag")}\donothing\publ_place_list_entry}
-
-\def\publ_place_list_entry_register
- {\ctxcommand{btxregisterlistentry("\currentbtxdataset","\currentbtxtag")}}
-
-\unexpanded\def\btxchecklistentry#1% called at the lua end
- {\begingroup
- \edef\currentbtxtag{#1}%
- \ifx\currentbtxcriterium\v!all % move this check to lua ... easier to test there anyway
- \publ_check_list_entry
- \else
- \ctxcommand{btxdoifelselistentryplaced("\currentbtxdataset","\currentbtxtag")}\donothing\publ_check_list_entry
- \fi
- \endgroup}
-
\unexpanded\def\btxlistreset
{\let \currentbtxindex \!!zerocount % can be a constant
\let \currentbtxcombis \empty
@@ -557,6 +549,7 @@
\let \currentbtxbacktrace\empty
\let \currentbtxlanguage \empty
\let \currentbtxtag \empty
+ \let \currentbtxdataset \empty
%setconstant\currentbtxrealpage \zerocount
}
@@ -577,33 +570,26 @@
\btxlistreset
-\unexpanded\def\btxhandlelistentry% called at the lua end / todo: pass check state
+% called at the lua end, for determining the width
+
+\unexpanded\def\btxchecklistentry
{\begingroup
- %edef\currentbtxtag{#1}% set at the Lua end
- \ifconditional\c_publ_place_all
- \publ_place_list_entry
- \else\ifconditional\c_publ_place_check
- \publ_place_list_entry_checked
- \else
- \publ_place_list_entry
- \fi\fi
+ % todo, switch to font
+ \global\advance\btxlistcounter\plusone
+ \hbox{\btx_reference_checked}%
+ \par
\endgroup}
-\unexpanded\def\publ_place_list_entry
- {\global\advance\btxlistcounter\plusone
- \ifconditional\c_publ_place_register
- \publ_place_list_entry_register
- \fi
- \let\currentlist\s!btx
+% called at the lua end, the real rendering
+
+\unexpanded\def\btxhandlelistentry
+ {\begingroup
+ \global\advance\btxlistcounter\plusone
+ \let\currentlist\s!btx % probably obsolete here
\startbtxlistentry\currentbtxrendering
\btx_entry_inject
- \stopbtxlistentry}
-
-\unexpanded\def\publ_check_list_entry
- {\global\advance\btxlistcounter\plusone
- % todo, switch to font
- \hbox{\btx_reference_checked}%
- \par}
+ \stopbtxlistentry
+ \endgroup}
\unexpanded\def\btxlistsetup#1%
{\directsetup{\s!btx:\s!list:#1}}
@@ -635,7 +621,7 @@
{\btx_trace_list_cross\empty\currentbtxbacktrace
\global\advance\c_btx_list_reference\plusone
\strc_references_direct_full_user
- {\s!btxset="\currentbtxdataset",\s!btxref="\currentbtxtag",\ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint=\currentbtxbacklink\else\s!btxbck="\currentbtxbacktrace"\fi}%
+ {\s!btxset="\currentbtxdataset",\s!btxref="\currentbtxtag",\ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint="\currentbtxbacklink"\else\s!btxbck="\currentbtxbacktrace"\fi}%
{\s!btx::\v!list::\number\c_btx_list_reference}%
{\number\btxlistcounter}}
@@ -647,16 +633,11 @@
\else
\btx_trace_list_cross\currentbtxbacklink\empty
\normalexpanded{\writedatatolist[\s!btx][\s!btxset=\currentbtxdataset,\s!btxref=\currentbtxtag,\s!btxint=\number\currentbtxbacklink]}% % \c!location=\v!here
- \fi
- \fi}
+ \fi
+ \fi}
\let\btxcitereference\btx_cite_reference_inject
-% \setuvalue{\??btxnumbering\v!page }{\btxlistvariant{page}} % these will be setups
-% \setuvalue{\??btxnumbering\v!short }{\btxlistvariant{short}} % these will be setups
-% \setuvalue{\??btxnumbering\v!bib }{\btxlistvariant{num}} % these will be setups
-% \setuvalue{\??btxnumbering\v!yes }{\btxlistvariant{num}} % these will be setups
-
\let\currentbtxnumbering\empty
\appendtoks
@@ -784,18 +765,23 @@
%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.
-\newconditional\c_publ_cite_write
-
-\unexpanded\def\btxdomarkcitation % called from lua end
- {\iftrialtypesetting
- \expandafter\gobblethreearguments
- \else
- \expandafter\publ_cite_mark_citation
- \fi}
-
-\def\publ_cite_mark_citation#1#2#3% called from lua end
- {\dontleavehmode
- \normalexpanded{\writedatatolist[\s!btx][\s!btxset=#1,\s!btxref=#2,\s!btxint=\number#3]}}% \c!location=\v!here for nocite?
+% all done at the lua end and using the nocite setup .. also tracing
+%
+% \unexpanded\def\btxdomarkcitation % called from lua end
+% {\dontleavehmode
+% \iftrialtypesetting
+% \expandafter\gobblethreearguments
+% \else
+% \expandafter\publ_cite_mark_citation
+% \fi}
+%
+% \def\publ_cite_mark_citation#1#2#3% called from lua end
+% {\begingroup
+% \edef\currentbtxdataset{#1}%
+% \edef\currentbtxtag{#2}%
+% \edef\currentbtxbacklink{#3}%
+% \btxcitesetup\s!nocite
+% \endgroup}
%D \macros{cite,nocite,citation,nocitation,usecitation}
%D
@@ -884,7 +870,6 @@
\def\publ_cite_variant
{\begingroup
- \settrue\c_publ_cite_write
\publ_cite_handle_variant_indeed[\currentbtxcitetag]}
\unexpanded\def\publ_cite_handle_variant#1%
@@ -930,8 +915,9 @@
\ctxcommand{btxhandlenocite{%
dataset = "\currentbtxdataset",%
reference = "#1",%
- markentry = \iftrialtypesetting false\else true\fi,%
+ markentry = true,%
}}%
+ % \ctxcommand{flushmarked()}%
\fi}
\unexpanded\def\btxmissing#1%
@@ -958,6 +944,7 @@
\let \currentbtxbacklink \empty
\let \currentbtxbacktrace\empty % not used here
\let \currentbtxlanguage \empty
+ \let \currentbtxdataset \empty
\let \currentbtxtag \empty
%setconstant\currentbtxrealpage \zerocount
\setconstant\currentbtxconcat \zerocount
@@ -973,6 +960,7 @@
\unexpanded\def\btxsetfirst {\def\currentbtxfirst}
\unexpanded\def\btxsetsecond {\def\currentbtxsecond}
\unexpanded\def\btxsettag {\def\currentbtxtag}
+\unexpanded\def\btxsetdataset {\def\currentbtxdataset}
%unexpanded\def\btxsetlanguage {\def\currentbtxlanguage}
\unexpanded\def\btxsetinternal {\def\currentbtxinternal}
\unexpanded\def\btxsetcount #1{\setconstant\currentbtxcount #1\relax}
@@ -996,14 +984,9 @@
%D Whatever helpers:
-\unexpanded\def\btxsingularplural#1%
- {\ctxcommand{btxsingularorplural("\currentbtxdataset","\currentbtxtag","#1")}}
-
-\unexpanded\def\btxoneorrange#1%
- {\ctxcommand{btxoneorrange("\currentbtxdataset","\currentbtxtag","#1")}}
-
-\unexpanded\def\btxfirstofrange#1%
- {\ctxcommand{btxfirstofrange("\currentbtxdataset","\currentbtxtag","#1")}}
+\unexpanded\def\btxsingularplural#1{\ctxcommand{btxsingularorplural("\currentbtxdataset","\currentbtxtag","#1")}}
+\unexpanded\def\btxoneorrange #1{\ctxcommand{btxoneorrange("\currentbtxdataset","\currentbtxtag","#1")}}
+\unexpanded\def\btxfirstofrange #1{\ctxcommand{btxfirstofrange("\currentbtxdataset","\currentbtxtag","#1")}}
\let\btxsingularorplural\btxsingularplural
@@ -1034,21 +1017,6 @@
\stopcontextdefinitioncode
-%D Special:
-
-\def\publ_check_repeat
- {\doifelse{\btxrenderingparameter\c!repeat}\v!yes
- {\setfalse\c_publ_place_check\setfalse\c_publ_place_register}
- {\settrue \c_publ_place_check\settrue \c_publ_place_register}}
-
-\appendtoks
- \publ_check_repeat
-\to \everysetupbtxrendering
-
-\appendtoks
- \globallet\publ_check_repeat\relax
-\to \everystarttext
-
%D Defaults:
\setupbtxrendering
@@ -1059,7 +1027,6 @@
% \c!setups=btx:\btxrenderingparameter\c!alternative:initialize, % not the same usage as cite !
\c!alternative=apa,
\c!sorttype=,
-% \c!criterium=,
\c!criterium=\v!text,
\c!refcommand=authoryears, % todo
\c!numbering=\v!yes,