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.mkiv963
1 files changed, 0 insertions, 963 deletions
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
deleted file mode 100644
index 42226695c..000000000
--- a/tex/context/base/publ-ini.mkiv
+++ /dev/null
@@ -1,963 +0,0 @@
-%D \module
-%D [ file=publ-ini,
-%D version=2013.05.12,
-%D title=\CONTEXT\ Publication Support,
-%D subtitle=Initialization,
-%D author=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.
-
-% todo: we cannot use 'default' as this wipes metadata names (maybe no longer do that)
-% todo: \v!cite => \s!cite
-% todo: interface with (ml)bibtex (export -> call -> import)
-% todo: check if 'all' etc are ok ... either use list or use other criterium
-
-% \definecolor[btx:field] [darkred]
-% \definecolor[btx:crossref][darkblue]
-% \definecolor[btx:key] [darkgreen]
-% \definecolor[btx:todo] [darkyellow]
-
-%D We operate on several axis:
-%D
-%D \startitemize[packed]
-%D \startitem we can have several databases (or combinations) \stopitem
-%D \startitem we can add entries to them if needed (coded in tex) \stopitem
-%D \startitem we can have several lists each using one of the databases \stopitem
-%D \startitem we can render each list or citation independently \stopitem
-%D \stopitemize
-%D
-%D We assume that the rendering of a list entry is consistent in a document,
-%D although one can redefine properties if needed. Adding more granularity would
-%D complicate the user interface beyond comprehension.
-
-\writestatus{loading}{ConTeXt Publication Support / Initialization}
-
-\registerctxluafile{publ-dat}{1.001}
-\registerctxluafile{publ-aut}{1.001}
-\registerctxluafile{publ-usr}{1.001}
-\registerctxluafile{publ-ini}{1.001}
-\registerctxluafile{publ-oth}{1.001} % this could become an option
-
-\unprotect
-
-\def\s!btx{btx}
-\def\v!btxlist{btxlist}
-
-% a dedicated construction mechanism
-
-\installcorenamespace {btxlist}
-
-\installcommandhandler \??btxlist {btxlist} \??btxlist
-
-\unexpanded\setvalue{\??constructioninitializer\v!btxlist}%
- {\let\currentbtxlist \currentconstruction
- \let\constructionparameter \btxlistparameter
- \let\detokenizedconstructionparameter\detokenizedbtxlistparameter
- \let\letconstructionparameter \letbtxlistparameter
- \let\useconstructionstyleandcolor \usebtxliststyleandcolor
- \let\setupcurrentconstruction \setupcurrentbtxlist}
-
-\expandafter\let\csname\??constructionmainhandler \v!btxlist\expandafter\endcsname\csname\??constructionmainhandler \v!construction\endcsname
-\expandafter\let\csname\??constructioncommandhandler\v!btxlist\expandafter\endcsname\csname\??constructioncommandhandler\v!construction\endcsname
-\expandafter\let\csname\??constructiontexthandler \v!btxlist\expandafter\endcsname\csname\??constructiontexthandler \v!construction\endcsname
-
-\unexpanded\setvalue{\??constructioncommandhandler\v!btxlist}%
- {\csname\??constructionstarthandler\v!construction\endcsname
- \csname\??constructionstophandler \v!construction\endcsname
- \endgroup}
-
-\unexpanded\setvalue{\??constructionstarthandler\v!btxlist}%
- {\csname\??constructionstarthandler\v!construction\endcsname}
-
-\unexpanded\setvalue{\??constructionstophandler\v!btxlist}%
- {\csname\??constructionstophandler\v!construction\endcsname
- \endgroup}
-
-\unexpanded\def\startbtxlistentry#1%
- {\begingroup
- \strc_constructions_initialize{#1}%
- \csname\??constructionstarthandler\currentconstructionhandler\endcsname}
-
-\unexpanded\def\stopbtxlistentry
- {\csname\??constructionstophandler\currentconstructionhandler\endcsname}
-
-\unexpanded\setvalue{\??constructiontexthandler\v!btxlist}%
- {\begingroup
- \useconstructionstyleandcolor\c!headstyle\c!headcolor % move to \currentconstructiontext
- \the\everyconstruction
- \constructionparameter\c!headcommand
- {\strut
- \constructionparameter\c!text
- \btx_reference_inject}%
- \endgroup}
-
-\unexpanded\def\strc_constructions_initialize#1% class instance
- {\edef\currentconstruction{#1}%
- \let\currentconstructionlistentry\!!zerocount
- \expandafter\let\expandafter\currentconstructionmain \csname\??constructionmain \currentconstruction\endcsname
- \expandafter\let\expandafter\currentconstructionlevel \csname\??constructionlevel\currentconstruction\endcsname
- \expandafter\let\expandafter\currentconstructionhandler\csname\??constructionclass\currentconstruction\endcsname
- \csname\??constructioninitializer\currentconstructionhandler\endcsname}
-
-\appendtoks
- % \ifx\currentbtxlistparent\empty
- % \defineconstruction[\currentbtxlist][\currentbtxlistparent][\s!handler=\v!btxlist,\c!level=1]%
- % \else
- % \defineconstruction[\currentbtxlist][\s!handler=\v!btxlist,\c!level=1]%
- % \fi
- \ifx\currentbtxlistparent\empty
- \letvalue{\??constructionmain\currentbtxlist}\currentbtxlist
- \else
- \letvalue{\??constructionmain\currentbtxlist}\currentbtxlistparent
- \fi
- \setevalue{\??constructionlevel\currentbtxlist}{\number\btxlistparameter\c!level}%
- \setevalue{\??constructionclass\currentbtxlist}{\btxlistparameter\s!handler}%
-\to \everydefinebtxlist
-
-\setupbtxlist
- [\s!handler=\v!btxlist,
- \c!level=1]
-
-\setupbtxlist
- [\c!alternative=\v!left,
- \c!headstyle=,
- \c!titlestyle=,
- %\c!style=,
- %\c!color=,
- %\c!headcolor=,
- %\c!titlecolor=,
- \c!width=4\emwidth,
- \c!distance=\emwidth,
- %\c!titledistance=.5\emwidth,
- %\c!hang=,
- %\c!sample=,
- %\c!align=,
- %\c!headalign=,
- \c!margin=\v!no,
- \c!before=\blank,
- \c!inbetween=\blank,
- \c!after=\blank,
- %\c!indentnext=\v!yes,
- %\c!indenting=\v!never,
- %\c!titleleft=(,
- %\c!titleright=),
- %\c!closesymbol=,
- %\c!closecommand=\wordright,
- \c!display=\v!yes,
- \c!command=,
- %\c!titlecommand=,
- %\c!expansion=\v!no,
- %\c!xmlsetup=,
- %\s!catcodes=,
- %\c!title=\v!yes,
- %\c!text=,
- ]
-
-% here starts the bib stuff
-
-\installcorenamespace {btxdataset}
-\installcorenamespace {btxlistvariant}
-\installcorenamespace {btxcitevariant}
-\installcorenamespace {btxrendering}
-\installcorenamespace {btxcommand}
-\installcorenamespace {btxnumbering}
-
-\installcommandhandler \??btxdataset {btxdataset} \??btxdataset
-\installcommandhandler \??btxlistvariant {btxlistvariant} \??btxlistvariant
-\installcommandhandler \??btxcitevariant {btxcitevariant} \??btxcitevariant
-\installcommandhandler \??btxrendering {btxrendering} \??btxrendering
-
-\unexpanded\def\usebtxdataset
- {\dodoubleargument\publ_use_dataset}
-
-\def\publ_use_dataset[#1][#2]%
- {\ifsecondargument
- \ctxcommand{usebtxdataset("#1","#2")}%
- \else
- \ctxcommand{usebtxdataset("\v!standard","#1")}%
- \fi}
-
-\definebtxdataset
- [\v!standard]
-
-% \usebtxdataset
-% [standard]
-% [mybibs.bib]
-
-\unexpanded\def\startpublication
- {\dodoubleempty\publ_set_publication}
-
-\let\stoppublication\relax
-
-\def\publ_set_publication[#1][#2]%
- {\begingroup
- \catcode\commentasciicode\othercatcode
- \ifsecondargument
- \expandafter\publ_set_publication_indeed
- \else\iffirstargument
- \doubleexpandafter\publ_set_publication_checked
- \else
- \doubleexpandafter\publ_set_publication_default
- \fi\fi{#1}{#2}}
-
-\def\publ_set_publication_default#1#2%
- {\publ_set_publication_indeed\v!standard{#1}}
-
-\def\publ_set_publication_checked#1#2%
- {\doifassignmentelse{#1}
- {\publ_set_publication_indeed\v!standard{#1}}
- {\publ_set_publication_indeed{#1}{}}}
-
-\def\publ_set_publication_indeed#1#2#3\stoppublication
- {\ctxcommand{addbtxentry("#1",\!!bs#2\!!es,\!!bs\detokenize{#3}\!!es)}%
- \endgroup
- \ignorespaces}
-
-% commands
-
-\unexpanded\def\btxcommand#1%
- {\ifcsname\??btxcommand#1\endcsname
- \expandafter\publ_command_yes
- \else
- \expandafter\publ_command_nop
- \fi{#1}}
-
-\let\btxcmd\btxcommand
-
-\def\publ_command_yes#1%
- {\csname\??btxcommand#1\endcsname}
-
-\def\publ_command_nop#1%
- {\ifcsname#1\endcsname
- \writestatus\m!publications{unknown command: #1, using built-in context variant #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
- \writestatus\m!publications{unknown command: #1, using built-in context variant \utfupper{#1}}%
- %\setuxvalue{\??btxcommand#1}{\expandafter\noexpand\csname\utfupper{#1}\endcsname}%
- \global\expandafter\let\csname\??btxcommand#1\expandafter\endcsname\csname\utfupper{#1}\endcsname
- \else
- \writestatus\m!publications{unknown command: #1}%
- \setugvalue{\??btxcommand#1}{\underbar{\tttf#1}}%
- \fi\fi
- \publ_command_yes{#1}}
-
-\unexpanded\def\definebtxcommand#1% {body} #1..#n{body}
- {\setuvalue{\??btxcommand\strippedcsname#1}}%
-
-% access
-
-\let\currentbtxtag \empty
-\let\currentbtxdataset\v!standard
-
-\unexpanded\def\setbtxdataset[#1]%
- {\edef\currentbtxdataset{\ctxcommand{setbtxdataset("#1")}}}
-
-\unexpanded\def\setbtxentry[#1]%
- {\edef\currentbtxtag{\ctxcommand{setbtxentry("\currentbtxdataset","#1")}}}
-
-% \let\btxsetdataset\setbtxdataset
-% \let\btxsetentry \setbtxentry
-
-\def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxflush #1{\ctxcommand{btxflush("\currentbtxdataset","\currentbtxtag","#1")}}
-%def\btxrendering#1{\ctxcommand{btxrendering("\currentbtxdataset","\currentbtxtag","#1","\btxrenderingparameter\c!interaction")}}
-\def\btxdoifelse #1{\ctxcommand{btxdoifelse("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}}
-\def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}}
-
-\let\btxsetup \directsetup
-
-%D How complex will we go? Can we assume that e.g. an apa style will not be mixed
-%D with another one? I think this assumption is okay. For manuals we might want to
-%D mix but we can work around it.
-
-%D Rendering.
-
-\unexpanded\def\btxspace {\removeunwantedspaces\space}
-\unexpanded\def\btxperiod {\removeunwantedspaces.\space}
-\unexpanded\def\btxcomma {\removeunwantedspaces,\space}
-\unexpanded\def\btxlparent {\removeunwantedspaces\space(}
-\unexpanded\def\btxrparent {\removeunwantedspaces)\space}
-\unexpanded\def\btxlbracket{\removeunwantedspaces\space[}
-\unexpanded\def\btxrbracket{\removeunwantedspaces]\space}
-
-%D Rendering lists and citations.
-
-\newconditional\c_btx_trace
-
-\installtextracker
- {btxrendering}
- {\settrue \c_btx_trace}
- {\setfalse\c_btx_trace}
-
-\unexpanded\def\startbtxrendering
- {\begingroup
- \dosingleempty\btx_start_rendering}
-
-\def\btx_start_rendering[#1]%
- {\edef\currentbtxrendering{#1}}
-
-\unexpanded\def\stopbtxrendering
- {\endgroup}
-
-\unexpanded\def\btxtodo#1%
- {[#1]}
-
-%D Specific rendering definitions (like apa):
-
-\unexpanded\def\loadbtxdefinitionfile[#1]%
- {\ctxcommand{loadbtxdefinitionfile("#1")}}
-
-%D Lists:
-
-\newdimen\d_publ_number_width
-%newdimen\d_publ_number_distance
-
-\ifdefined\btxblock \else \newcount\btxblock \fi \btxblock\plusone
-\ifdefined\btxcounter \else \newcount\btxcounter \fi
-
-\newtoks \everysetupbtxlistplacement % name will change
-\newtoks \everysetupbtxciteplacement % name will change
-
-% \def\publ_list_processor % bibref -> btx (old method, keep as reference)
-% {\ctxcommand{btxaddtolist("\currentbtxrendering",\currentlistindex,"btxref")}}
-
-\definelist % only used for selecting
- [btx]
-
-\setuplist
- [btx]%
- [\c!state=\v!start]%
-
-\appendtoks
- \ifx\currentbtxrenderingparent\empty
- \definebtxlist
- [\currentbtxrendering]%
- \else
- \definebtxlist
- [\currentbtxrendering]%
- [\currentbtxrenderingparent]%
- \fi
-\to \everydefinebtxrendering
-
-\unexpanded\def\btx_entry_inject
- {\begingroup
- \edef\currentbtxcategory{\btxfield{category}}%
- \ignorespaces
- \directsetup{\s!btx:\currentbtxalternative:\currentbtxcategory}%
- \removeunwantedspaces
- \endgroup}
-
-\unexpanded\def\completebtxrendering{\dodoubleempty\publ_place_list_complete}
-\unexpanded\def\placebtxrendering {\dodoubleempty\publ_place_list_standard}
-
-\let\completelistofpublications\completebtxrendering
-\let\placelistofpublications \placebtxrendering
-
-\def\publ_place_list_check_criterium
- {\edef\currentbtxcriterium{\btxrenderingparameter\c!criterium}% \v!cite will become \s!cite
- \ifx\currentbtxcriterium\empty
- \let\currentbtxcriterium\v!previous
- \else\ifx\currentbtxcriterium\v!cite
- \let\currentbtxcriterium\v!here
- \fi\fi}
-
-\def\publ_place_list_complete[#1][#2]% title might become obsolete, just headtext
- {\begingroup
- \edef\currentbtxrendering{#1}%
- \setupcurrentbtxrendering[#2]%
- \let\currentlist\s!btx
- \let\currentbtxlist\currentbtxrendering
- \publ_place_list_check_criterium
- \edef\currentbtxrenderingtitle{\btxrenderingparameter\c!title}%
- \ifx\currentbtxrenderingtitle\empty
- \normalexpanded{\startnamedsection[\v!chapter][\c!reference=\currentbtxrendering,\c!title={\headtext{\currentbtxrendering}}]}%
- \else
- \normalexpanded{\startnamedsection[\v!chapter][\c!reference=\currentbtxrendering,\c!title={\currentbtxrenderingtitle}]}%
- \fi
- \publ_place_list_indeed
- \stopnamedsection
- \endgroup}
-
-\def\publ_place_list_standard[#1][#2]%
- {\begingroup
- \edef\currentbtxrendering{#1}%
- \setupcurrentbtxrendering[#2]%
- \let\currentlist\s!btx
- \let\currentbtxlist\currentbtxrendering
- \publ_place_list_check_criterium
- \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}%
- % \determinelistcharacteristics[\currentbtxrendering]%
- \edef\currentbtxalternative{\btxrenderingparameter\c!alternative}%
- \edef\currentbtxdataset{\btxrenderingparameter\c!dataset}%
- \let\currentlist\s!btx
- \let\currentbtxlist\currentbtxrendering
- \the\everysetupbtxlistplacement
- \forgetall
- \ctxcommand{btxsetlistmethod("\currentbtxdataset","\btxrenderingparameter\c!method")}%
- \startpacked[\v!blank]%
- % here we just collect items
- \ctxcommand{btxcollectlistentries {
- names = "btx",
- criterium = "\currentbtxcriterium",
- number = "\btxrenderingparameter\c!number",
- btxdataset = "\currentbtxdataset",
- keyword = "\btxrenderingparameter\c!keyword",
- }}%
- % next we analyze the width
- \ifx\btx_reference_inject_indeed\relax \else
- \edef\p_width{\btxrenderingparameter\c!width}%
- \ifx\p_width\v!auto
- \scratchcounter\btxcounter
- \setbox\scratchbox\vbox{\settrialtypesetting\ctxcommand{btxfetchlistentries("\currentbtxdataset")}}%
- \d_publ_number_width\wd\scratchbox
- \global\btxcounter\scratchcounter
- \letbtxlistparameter\c!width\d_publ_number_width
- \fi
- \fi
- % this actually typesets them
- \ctxcommand{btxflushlistentries("\currentbtxdataset","\btxrenderingparameter\c!sorttype")}%
- \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\btxhandlelistentry#1% called at the lua end
- {\begingroup
- \edef\currentbtxtag{#1}%
- \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
- \endgroup}
-
-\unexpanded\def\publ_place_list_entry
- {\global\advance\btxcounter\plusone
- \ifconditional\c_publ_place_register
- \publ_place_list_entry_register
- \fi
- \let\currentlist\s!btx
- \startbtxlistentry\currentbtxrendering
- \btx_entry_inject
- \stopbtxlistentry}
-
-\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\publ_check_list_entry
- {\global\advance\btxcounter\plusone
- % todo, switch to font
- \hbox{\btx_reference_checked}%
- \par}
-
-\unexpanded\def\btx_reference_inject % we can use a faster \reference
- {\dontleavehmode\begingroup % no box
- \iftrialtypesetting\else
- \ctxcommand{btxdestination("\currentbtxdataset","\currentbtxblock","\currentbtxtag","\number\btxcounter")}%
- \fi
- \btx_reference_inject_indeed
- \endgroup}
-
-\unexpanded\def\btx_reference_checked
- {\dontleavehmode\hbox\bgroup
- \btx_reference_inject_indeed
- \egroup}
-
-\setuvalue{\??btxnumbering\v!short }{\btxlistvariant{short}} % these will be setups
-\setuvalue{\??btxnumbering\v!bib }{\btxlistvariant{num}} % these will be setups
-\setuvalue{\??btxnumbering\s!unknown}{\btxlistvariant{num}} % these will be setups
-\setuvalue{\??btxnumbering\v!yes }{\btxlistvariant{num}} % these will be setups
-
-\appendtoks
- \edef\p_btx_numbering{\btxrenderingparameter\c!numbering}%
- \letlistparameter\c!numbercommand\firstofoneargument % for the moment, no doubling needed
- \ifx\p_btx_numbering\v!no
- \letlistparameter\c!textcommand\outdented % needed? we can use titlealign
- \letlistparameter\c!symbol \v!none
- \letlistparameter\c!aligntitle \v!yes
- \let\btx_reference_inject_indeed\relax
- \else
- \ifcsname\??btxnumbering\p_btx_numbering\endcsname \else
- \let\p_btx_numbering\s!unknown
- \fi
- \letlistparameter\c!headnumber\v!always
- \expandafter\let\expandafter\btx_reference_inject_indeed\csname\??btxnumbering\p_btx_numbering\endcsname
- \fi
-\to \everysetupbtxlistplacement
-
-% \appendtoks
-% \edef\currentbtxcriterium{\btxrenderingparameter\c!criterium}%
-% \to \everysetupbtxlistplacement
-
-\unexpanded\def\btxflushauthor
- {\doifnextoptionalelse\btx_flush_author_yes\btx_flush_author_nop}
-
-\def\btx_flush_author_yes[#1]{\btx_flush_author{#1}}
-\def\btx_flush_author_nop {\btx_flush_author{\btxlistvariantparameter\c!author}}
-
-\unexpanded\def\btx_flush_author#1#2%
- {\edef\currentbtxfield{#2}%
- \let\currentbtxlistvariant\currentbtxfield
- \ctxcommand{btxauthor("\currentbtxdataset","\currentbtxtag","\currentbtxfield",{
- combiner = "#1",
- etallimit = \number\btxlistvariantparameter\c!etallimit,
- etaldisplay = \number\btxlistvariantparameter\c!etaldisplay,
- })}}
-
-\unexpanded\def\btxflushauthornormal {\btx_flush_author{normal}} % #1
-\unexpanded\def\btxflushauthornormalshort {\btx_flush_author{normalshort}} % #1
-\unexpanded\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1
-\unexpanded\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1
-
-% \btxflushauthor{author}
-% \btxflushauthor{artauthor}
-% \btxflushauthor{editor}
-%
-% \btxflushauthor[normal]{author}
-% \btxflushauthor[normalshort]{author}
-% \btxflushauthor[inverted]{author}
-% \btxflushauthor[invertedshort]{author}
-
-% Interaction
-
-\newconditional\btxinteractive
-
-\unexpanded\def\btxdoifelseinteraction
- {\iflocation
- \edef\p_interaction{\btxcitevariantparameter\c!interaction}%
- \ifx\p_interaction\v!stop
- \doubleexpandafter\secondoftwoarguments
- \else
- \doubleexpandafter\firstoftwoarguments
- \fi
- \else
- \expandafter\secondoftwoarguments
- \fi}
-
-\appendtoks
- \iflocation
- \edef\p_interaction{\btxlistvariantparameter\c!interaction}%
- \ifx\p_interaction\v!stop
- \let\doifelsebtxinteractionelse\secondoftwoarguments
- \setfalse\btxinteractive
- \else
- \let\doifelsebtxinteractionelse\firstoftwoarguments
- \settrue\btxinteractive
- \fi
- \else
- \let\doifelsebtxinteractionelse\secondoftwoarguments
- \setfalse\btxinteractive
- \fi
-\to \everysetupbtxlistplacement
-
-% bib -> btx
-
-\unexpanded\def\btxgotolink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{#1}}
-\unexpanded\def\btxatlink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{#1}}
-\unexpanded\def\btxinlink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{#1}}
-
-\unexpanded\def\btxdirectlink#1#2{\goto{#2 {\tttf[#1]}}[#1]}
-\unexpanded\def\btxdirectlink#1#2{\goto{#2}[#1]}
-
-\let\gotobiblink\btxgotolink
-\let\atbiblink \btxatlink
-\let\inbiblink \btxinlink
-
-\unexpanded\def\btxnumberedreference[#1]% \bibtexnumref (replaced by \cite[num])
- {\dontleavehmode
- \begingroup
- \btxcitevariantparameter\v!left
- \penalty\plustenthousand % todo
- \ctxcommand{btxresolvelistreference("\currentbtxdataset","#1")}% todo: split dataset from #1, so another call
- \btxcitevariantparameter\v!right
- \endgroup}
-
-% \def\btxnumberedplaceholder[#1]% \nobibtexnumref
-% {[#1]}
-
-\appendtoks
- % for old times sake, for a while at least
- \let\maybeyear\gobbleoneargument
- \let\noopsort \gobbleoneargument
-\to \everysetupbtxlistplacement
-
-\appendtoks
- % for old times sake, for a while at least
- \let\maybeyear\gobbleoneargument
- \let\noopsort \gobbleoneargument
-\to \everysetupbtxciteplacement
-
-\appendtoks
- \doifnot{\btxrenderingparameter\c!continue}\v!yes
- {\global\btxcounter\zerocount}%
-\to \everysetupbtxlistplacement
-
-%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.
-
-\newconditional\c_publ_cite_write
-
-% for reference, but split now done at the lua end
-%
-% \def\publ_cite_write#1% not used
-% {\splitstring#1\at::\to\askedbtxrendering\and\askedbtxtag
-% \ifx\askedbtxtag\empty
-% \let\currentbtxtag \askedbtxrendering
-% \else
-% \let\currentbtxtag \askedbtxtag
-% \let\currentbtxrendering\askedbtxrendering
-% \fi
-% \iftrialtypesetting \else
-% \processcommacommand[\currentbtxtag]{\publ_cite_indeed\currentbtxrendering}%
-% \fi}
-
-\def\publ_cite_indeed#1#2%
- {\expanded{\writedatatolist[btx][btxset=#1,btxref=#2]}}
-
-\def\btxdomarkcitation#1#2% called from lua end
- {\iftrialtypesetting \else
- \writedatatolist[btx][btxset=#1,btxref=#2]% \c!location=\v!here
- \fi}
-
-%D \macros{cite,nocite,citation,nocitation,usecitation}
-%D
-%D The inline \type {\cite} command creates a (often) short reference to a publication
-%D and for historic reasons uses a strict test for brackets. This means, at least
-%D in the default case that spaces are ignored in the argument scanner. The \type
-%D {\citation} commands is more liberal but also gobbles following spaces. Both
-%D commands insert a reference as well as a visual clue.
-%D
-%D The \type {no} commands all do the same (they are synonyms): they make sure that
-%D a reference is injected but show nothing. However, they do create a node so best
-%D attach them to some text in order to avoid spacing interferences. A slightly
-%D less efficient alternative is \type {\cite[none][tag]}.
-
-% [tags]
-% [settings|variant][tags]
-% [base::tags]
-% [settings|variant][base::tags]
-
-\unexpanded\def\btxcite
- {\dontleavehmode
- \begingroup
- \strictdoifnextoptionalelse\publ_cite_tags_options\publ_cite_tags_indeed}
-
-\unexpanded\def\publ_cite_tags_indeed#1%
- {\letinteractionparameter\c!style\empty
- \edef\currentbtxcitevariant{\btxcitevariantparameter\c!alternative}%
- \edef\currentbtxcitetag{#1}%
- \publ_cite_variant
- \endgroup}
-
-\let\publ_citation_tags_indeed\publ_cite_tags_indeed
-
-\unexpanded\def\publ_cite_tags_options[#1]%
- {\strictdoifnextoptionalelse{\publ_cite_tags_options_indeed{#1}}{\publ_cite_tags_indeed{#1}}}
-
-\unexpanded\def\publ_cite_tags_options_indeed#1[#2]%
- {\edef\currentbtxcitetag{#2}%
- \doifassignmentelse{#1}
- {\publ_cite_tags_settings_indeed{#1}}
- {\publ_cite_tags_variants_indeed{#1}}}
-
-\def\publ_cite_tags_settings_indeed#1%
- {\letinteractionparameter\c!style\empty
- %\letinteractionparameter\c!color\empty
- \getdummyparameters[\c!alternative=,\c!extras=,#1]%
- \edef\p_alternative{\dummyparameter\c!alternative}%
- \ifx\p_alternative\empty \else
- \let\currentbtxcitevariant\p_alternative
- \fi
- \setupcurrentbtxcitevariantparameters[#1]%
- \edef\p_extras{\dummyparameter\c!extras}%
- \ifx\p_extras\empty \else
- \edef\p_right{\btxcitevariantparameter\c!right}%
- \ifx\p_right\empty \else
- \setexpandedbtxcitevariantparameter\p_right{\p_extras\p_right}%
- \fi
- \fi
- \publ_cite_variant
- \endgroup}
-
-\def\publ_cite_tags_variants_indeed#1%
- {\letinteractionparameter\c!style\empty
- \edef\currentbtxcitevariant{#1}%
- \publ_cite_variant
- \endgroup}
-
-\newconditional\btxcitecompress
-
-\def\publ_cite_variant
- {\edef\p_compress{\btxcitevariantparameter\c!compress}%
- % \ifx\p_compress\v!no
- % \setfalse\btxcitecompress
- % \else
- % \settrue\btxcitecompress
- % \fi
- \begingroup
- \settrue\c_publ_cite_write
- \publ_cite_handle_variant_indeed[\currentbtxcitetag]}
-
-\unexpanded\def\publ_cite_handle_variant#1%
- {\begingroup
- \the\everysetupbtxciteplacement
- \edef\currentbtxcitevariant{#1}%
- \dosingleargument\publ_cite_handle_variant_indeed}
-
-\def\publ_cite_handle_variant_indeed[#1]%
- {\usebtxcitevariantstyleandcolor\c!style\c!color
- \letbtxcitevariantparameter\c!alternative\currentbtxcitevariant
- \ctxcommand{btxhandlecite(%
- "\currentbtxdataset",%
- "#1",%
- \iftrialtypesetting false\else true\fi,%
- "\currentbtxcitevariant",%
- "\btxcitevariantparameter\c!sorttype",%
- "\btxcitevariantparameter\c!setups"%
- )}%
- \endgroup}
-
-\unexpanded\def\btxcitation
- {\dontleavehmode
- \begingroup
- \dodoubleempty\publ_citation}
-
-\def\publ_citation[#1][#2]% could be made more efficient but not now
- {\ifsecondargument
- \publ_cite_tags_options_indeed{#1}[#2]%
- \else
- \publ_cite_tags_indeed{#1}%
- \fi}
-
-\unexpanded\def\btxnocite
- {\dosingleempty\publ_cite_no}
-
-\unexpanded\def\publ_cite_no[#1]%
- {\iftrialtypesetting \else
- \ctxcommand{btxhandlenocite("\currentbtxdataset","#1",true)}%
- \fi}
-
-%D Compatibility:
-
-\let\cite \btxcite
-\let\citation \btxcitation
-\let\nocite \btxnocite
-\let\nocitation \btxnocite
-\let\usepublication\btxnocite
-
-%D Cite helpers:
-
-\unexpanded\def\btxcitevariant#1%
- {\ctxcommand{btxcitevariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1")}}
-
-%D List helpers:
-
-\def\currentbtxindex{0}
-
-\unexpanded\def\btxlistvariant#1% was \currentbtxindex
- {\begingroup
- \edef\currentbtxlistvariant{#1}%
- \btxlistvariantparameter\c!left
- \ctxcommand{btxlistvariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1","\number\btxcounter")}% some can go
- \btxlistvariantparameter\c!right
- \endgroup}
-
-%D Whatever helpers:
-
-\unexpanded\def\btxsingularplural#1%
- {\ctxcommand{btxsingularorplural("\currentbtxdataset","\currentbtxtag","#1")}}
-
-\let\btxsingularorplural\btxsingularplural
-
-%D Loading variants:
-
-\appendtoks
- \loadbtxdefinitionfile[\btxrenderingparameter\c!alternative]
-\to \everysetupbtxrendering
-
-%D Defaults:
-
-\setupbtxrendering
- [\c!dataset=\v!standard,
- \c!method=\v!global,
- \c!setups=btx:rendering:\btxrenderingparameter\c!alternative,
- \c!alternative=apa,
- \c!sorttype=,
- \c!criterium=,
- \c!refcommand=authoryears, % todo
- \c!numbering=\v!yes,
-% \c!autohang=\v!no,
- \c!width=\v!auto,
- \c!distance=1.5\emwidth]
-
-\definebtxrendering
- [\v!standard]
-
-\setupbtxcitevariant
- [\c!interaction=\v!start,
- \c!setups=btx:cite:\btxcitevariantparameter\c!alternative,
- \c!alternative=num,
- \c!andtext={ and },
- \c!otherstext={ et al.},
- \c!pubsep={, },
- \c!lastpubsep={ and },
- \c!compress=\v!no,
- \c!inbetween={ },
- \c!left=,
- \c!right=]
-
-\definebtxcitevariant
- [author]
- [%c!sorttype=,
- \c!left={(},
- \c!middle={, },
- \c!right={)}]
-
-\definebtxcitevariant
- [authoryear]
- [\c!compress=\v!yes,
- \c!inbetween={, },
- \c!left={(},
- \c!middle={, },
- \c!right={)}]
-
-\definebtxcitevariant
- [authoryears]
- [authoryear]
-
-\definebtxcitevariant
- [authornum]
- [author]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [year]
- [\c!left={(},
- \c!right={)}]
-
-\definebtxcitevariant
- [key]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [serial]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [page]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [short]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [type]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [doi]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [url]
- [\c!left={[},
- \c!right={]}]
-
-\definebtxcitevariant
- [page]
- [\c!left=,
- \c!right=,
- \c!inbetween=\endash]
-
-\definebtxcitevariant
- [num]
- [\c!compress=\v!yes,
- \c!inbetween={--},
- \c!left={[},
- \c!right={]}]
-
-\setupbtxlistvariant
- [\c!namesep={, },
- \c!lastnamesep={ and },
- \c!finalnamesep={ and },
- \c!firstnamesep={ },
- \c!juniorsep={ },
- \c!vonsep={ },
- \c!surnamesep={, },
- \c!surnameinitialsep={, },
- \c!surnamefirstnamesep={, },
- \c!etallimit=5,
- \c!etaldisplay=5,
- \c!etaltext={ et al.},
- \c!monthconversion=\v!number,
- \c!authorconversion=\v!normal]
-
-\definebtxlistvariant
- [author]
- [author=invertedshort] % we could also do this in the apa style itself
-
-\definebtxlistvariant
- [editor]
- [author]
-
-\definebtxlistvariant
- [artauthor]
- [author]
-
-% Do we want these in the format? Loading them delayed is somewhat messy.
-
-\loadbtxdefinitionfile[apa]
-\loadbtxdefinitionfile[cite]
-\loadbtxdefinitionfile[commands]
-\loadbtxdefinitionfile[definitions]
-
-\protect