summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-imp-cite.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/publ-imp-cite.mkvi')
-rw-r--r--tex/context/base/publ-imp-cite.mkvi281
1 files changed, 281 insertions, 0 deletions
diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi
new file mode 100644
index 000000000..7ce9ea0da
--- /dev/null
+++ b/tex/context/base/publ-imp-cite.mkvi
@@ -0,0 +1,281 @@
+%D \module
+%D [ file=publ-imp-cite,
+%D version=2013.12.24,
+%D title=\CONTEXT\ Publication Support,
+%D subtitle=Citations,
+%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 btx:cite:inject #content
+ \ifconditional\btxinteractive
+ \ifx\currentbtxinternal\empty
+ #content
+ \else
+ \goto {
+ #content
+ } [
+ \s!internal(\currentbtxinternal)
+ ]
+ \fi
+ \else
+ #content
+ \fi
+\stoptexdefinition
+
+\starttexdefinition btx:cite:checkconcat
+ \ifnum\currentbtxcount>\zerocount
+ \let\currentbtxinternal\empty
+ \let\currentbtxbacklink\empty
+ \fi
+\stoptexdefinition
+
+% The null case:
+
+\startsetups btx:cite:none
+ \btxcitereference
+ % dummy
+\stopsetups
+
+\startsetups btx:cite:nocite
+ \dontleavehmode
+ \btxcitereference
+\stopsetups
+
+\startsetups btx:cite:unknown
+ \begingroup
+ \tttf
+ \btxcitereference
+ \currentbtxfirst
+ \endgroup
+\stopsetups
+
+\startsetups btx:cite:empty
+ \btxcitereference
+ <empty>
+\stopsetups
+
+\startsetups btx:cite:invalid
+ \btxcitereference
+ {\tt <\currentbtxreference>}
+\stopsetups
+
+\starttexdefinition btx:cite:concat
+ \btxparameter{\c!separator:\number\currentbtxconcat}
+\stoptexdefinition
+
+% when we have an author-year combination, the first and seconds is not
+% fields data but something more complex (that itself calls for a setup)
+
+% \startsetups btx:cite:normal
+% \texdefinition{\s!btx:\s!cite:concat}
+% \currentbtxlefttext
+% \ifx\currentbtxfirst\empty
+% \fastsetup{\s!btx:\s!cite:\s!empty}
+% \else
+% \texdefinition {\s!btx:\s!cite:inject} {
+% \btxcitereference
+% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+% \currentbtxfirst
+% }
+% }
+% \ifx\currentbtxsecond\empty
+% \btxflushsuffix
+% \else
+% \btxparameter\c!inbetween
+% \texdefinition {\s!btx:\s!cite:inject} {
+% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+% \currentbtxsecond
+% }
+% }
+% % quite likely an error
+% \btxflushsuffix
+% \fi
+% \fi
+% \currentbtxrighttext
+% \stopsetups
+
+\startsetups btx:cite:normal
+ \texdefinition{\s!btx:\s!cite:concat}
+ \currentbtxlefttext
+ \ifx\currentbtxfirst\empty
+ \fastsetup{\s!btx:\s!cite:\s!empty}
+ \else\ifx\currentbtxsecond\empty
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \btxcitereference
+ \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+ \currentbtxfirst
+ \btxflushsuffix
+ }
+ }
+ \else
+ % \texdefinition {\s!btx:\s!cite:inject} {
+ % \btxcitereference
+ % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+ % \currentbtxfirst
+ % }
+ % }
+ % \btxparameter\c!inbetween
+ % \texdefinition {\s!btx:\s!cite:inject} {
+ % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+ % \currentbtxsecond
+ % }
+ % }
+ % \btxflushsuffix
+ %
+ % probably better:
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \btxcitereference
+ \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+ \currentbtxfirst
+ \btxparameter\c!inbetween
+ \currentbtxsecond
+ \btxflushsuffix
+ }
+ }
+ \fi\fi
+ \currentbtxrighttext
+\stopsetups
+
+
+\startsetups btx:cite:range
+ \texdefinition{\s!btx:\s!cite:concat}
+ \currentbtxlefttext
+ \ifx\currentbtxfirst\empty
+ \fastsetup{\s!btx:\s!cite:\s!empty}
+ \else
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \btxcitereference
+ \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
+ \currentbtxfirst
+ \ifx\currentbtxsecond\empty \else
+ \btxparameter\c!range
+ \currentbtxsecond
+ \fi
+ \btxflushsuffix
+ }
+ }
+ \fi
+ \currentbtxrighttext
+\stopsetups
+
+% somehow related to keywords:
+
+\startsetups btx:cite:listelement
+ \texdefinition{\s!btx:\s!cite:concat}
+ \currentbtxlefttext
+ \ifx\currentbtxfirst\empty
+ \fastsetup{\s!btx:\s!cite:\s!empty}
+ \else
+ \texdefinition {\s!btx:\s!cite:inject} {
+ \btxcitereference
+ \currentbtxfirst
+ }
+ \fi
+ \currentbtxrighttext
+\stopsetups
+
+\startsetups \s!btx:\s!cite:entry
+ \texdefinition{\s!btx:\s!cite:concat}
+ \currentbtxlefttext
+ \btxhandleciteentry
+ \currentbtxrighttext
+\stopsetups
+
+% these three are goodies to get something but are not set up as it makes no
+% sense to have something root for combinations like this (esp not because one
+% gets default anyway
+
+% AB: not so sure about that. Why define them in default rather than here?
+
+\startsetups \s!btx:\s!cite:author
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:authoryear
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:authoryears
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:authornum
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:num
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+\startsetups \s!btx:\s!cite:default
+ \fastsetup{\s!btx:\s!cite:num}
+\stopsetups
+\startsetups \s!btx:\s!cite:textnum
+ \fastsetup{\s!btx:\s!cite:num}
+\stopsetups
+\startsetups \s!btx:\s!cite:year
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+\startsetups \s!btx:\s!cite:author:num
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+\startsetups \s!btx:\s!cite:author:year
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+\startsetups \s!btx:\s!cite:author:years
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+
+\startsetups \s!btx:\s!cite:index
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+\startsetups \s!btx:\s!cite:category
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:short
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:tag
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+
+% the following correspond to fields, but can be used in many renderings
+
+\startsetups \s!btx:\s!cite:keywords
+ \fastsetup{\s!btx:\s!cite:list}
+\stopsetups
+\startsetups \s!btx:\s!cite:title
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+\startsetups \s!btx:\s!cite:pages
+ \fastsetup{\s!btx:\s!cite:range}
+\stopsetups
+
+% is the next one used?
+% Yes, bibtex is a mess and one can have pages or sometimes page
+
+\startsetups \s!btx:\s!cite:page
+ \fastsetup{\s!btx:\s!cite:normal}
+\stopsetups
+
+% the following is kind of specific, but can be used in many renderings
+
+\startsetups btx:cite:url
+ \ifx\currentbtxfirst\empty
+ \fastsetup{\s!btx:\s!cite:\s!empty}
+ \else\ifconditional\btxinteractive
+ \goto {
+ \btxcitereference
+ \hyphenatedurl{\doif{\currentbtxcitealternative}{doi}{doi:}\currentbtxfirst}
+ } [
+ url(\doif{\currentbtxcitealternative}{doi}{http://dx.doi.org/}\currentbtxfirst)
+ ]
+ \else
+ \btxcitereference
+ \hyphenatedurl{\doif{\currentbtxcitealternative}{doi}{doi:}\currentbtxfirst}
+ \fi\fi
+\stopsetups
+
+\protect