summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/bib/t-bibltx.tex
blob: cb9e787adcf7b03ab69efe5990839eca5efa6cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
%D \module
%D   [       file=t-bibltx,
%D        version=2005.01.04,
%D          title=\CONTEXT\ Publication Module,
%D       subtitle=Publications,
%D         author={Taco Hoekwater},
%D           date=\currentdate,
%D      copyright={Public Domain}]
%C
%C Donated to the public domain.

%D \macros{newcommand}
%D
%D Just about all databases define something that uses
%D \type {\newcommand}. This fake version does not cover
%D everything \type {\newcommand} does, but it should be
%D enough for simple definitions like the ones found in
%D \BIBTEX\ files.

\unprotect

\def\@star@or@long#1%
  {\doifnextcharelse*{\afterassignment#1\let\next=}{#1}}

\def\newcommand
  {\@star@or@long\new@command}

\def\new@command#1%
  {\@testopt{\@newcommand#1}0}

\def\@newcommand#1[#2]%
  {\doifnextcharelse[{\@xargdef#1[#2]}{\@argdef#1[#2]}}

\long\def\@argdef#1[#2]#3%
  {\@yargdef#1\@ne{#2}{#3}}

\long\def\@xargdef#1[#2][#3]#4%
  {\@EA\def\@EA#1\@EA{\@EA\do@testopt\@EA#1\csname\string#1\endcsname{#3}}%
   \@EA\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}}

\def\@testopt#1#2%
  {\doifnextcharelse[{#1}{#1[#2]}}

\def\do@testopt#1%
  {\expandafter\@testopt}

\long\def\@yargdef#1#2#3%
  {\!!counta#3\relax
   \advance \!!counta \@ne
   \let\@hash@\relax
   \edef\!!tempa{\ifx#2\tw@ [\@hash@1]\fi}%
   \!!countb #2%
   \loop
     \ifnum\!!countb <\!!counta
       \edef\!!tempa{\!!tempa\@hash@\the\!!countb}%
       \advance\!!countb \@ne
   \repeat
   \let\@hash@##%
   \long\@EA\def\@EA#1\!!tempa}

\long\def\@reargdef#1[#2]%
  {\@yargdef#1\@ne{#2}}

%D Something like the following is needed to support the
%D average \LATEX-based \BIBTEX\ databases.
%D
%D \starttyping
%D \let\textsc\kap
%D \def\emph#1{{\em#1}}
%D \let\sf\ss
%D \stoptyping
%D
%D But we happily leave that to the user.

\protect \endinput