Debian Codegraph @

texmf-dist/tex/generic/tex4ht/bibtex.4ht

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % bibtex.4ht 2009-05-21-09:32 %
3 % Copyright (C) 1999--2009 Eitan M. Gurari %
4 % %
5 % This work may be distributed and/or modified under the %
6 % conditions of the LaTeX Project Public License, either %
7 % version 1.3c of this license or (at your option) any %
8 % later version. The latest version of this license is %
9 % in %
10 % http://www.latex-project.org/lppl.txt %
11 % and version 1.3c or later is part of all distributions %
12 % of LaTeX version 2005/12/01 or later. %
13 % %
14 % This work has the LPPL maintenance status "maintained".%
15 % %
16 % This Current Maintainer of this work %
17 % is Eitan M. Gurari. %
18 % %
19 % If you modify this program your changing its signature %
20 % with a directive of the following form will be %
21 % appreciated. %
22 % \message{signature} %
23 % %
24 % [email protected] %
25 % http://www.cse.ohio-state.edu/~gurari %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 \immediate\write-1{version 2009-05-21-09:32}
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 % Usage: \input bibtex.4ht \bibtex{file.bib} %
31 % Provides: \bibkey, \thisbib, \Configure{@...}, \Configure{...} %
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 \expandafter\ifx\csname :RestoreCatcodes\endcsname\relax
34 \expandafter\let\csname :RestoreCatcodes\endcsname=\empty
35 \fi
36 \edef\bibstack{\noexpand\PushStack\expandafter\noexpand
37 \csname Cat:Stack\endcsname
38 \expandafter\noexpand \csname :RestoreCatcodes\endcsname}
39 \bibstack
40 \expandafter\edef\csname :RestoreCatcodes\endcsname{%
41 \catcode`\noexpand :\the\catcode`:%
42 \catcode`\noexpand "\the\catcode`"%
43 \catcode`\noexpand @\the\catcode`@%
44 \catcode`\noexpand _\the\catcode`_%
45 \catcode`\noexpand ^\the\catcode`^%
46 \catcode`\noexpand |\the\catcode`|%
47 \csname no:restore\endcsname
48 \noexpand\PopStack\expandafter\noexpand\csname Cat:Stack\endcsname
49 \expandafter\noexpand \csname :RestoreCatcodes\endcsname}
50 \catcode`\:11 \catcode`\@11 \catcode`\^7 \catcode`\|=12
51 \catcode`"12
52
53 \catcode`\_=13
54 \gdef\bib:parse#1,{{\def_{\string_}%
55 \xdef\bibkey{#1}\open:tag{\bib:type}{entry}\hfil\break}\cont:parse}
56 \catcode`\_=8
57 \gdef\bib:eat{\bgroup \catcode`\@=12 \catcode`\^^M=10 \catcode`\#=12
58 \a:@bibtex \csname a:@\bib:type\endcsname
59 \ifx \thisbib\:UnDef \expandafter\bib:conteat
60 \else \pend:defI\thisbib{\egroup}\expandafter\thisbib \fi}
61 \NewConfigure{@bibtex}{1}
62 \def\get:key#1 #2///{\def\:temp{#2}\ifx\:temp\empty \def\bib:tag{#1}\else
63 \def\:temp{\get:key#1#2///}\expandafter\:temp
64 \fi}
65 \long\def\bib:conteat#1{\egroup
66 {\bib:parse #1@="@"}\csname b:\bib:type\endcsname \vfil\break}
67 \def\open:tag#1#2{%
68 \expandafter\ifx \csname a:#1\endcsname\relax
69 \:warning{no configuration for #2 <#1>...</#1>}%
70 \global\expandafter\let \csname a:#1\endcsname\empty
71 \fi \csname a:#1\endcsname}
72 \def\bib:scan{\ifx \:next\bgroup \expandafter\bib:eat
73 \else \expandafter\bib:more \fi}
74 \def\bib:more#1{\edef\bib:type{\bib:type#1}\futurelet\:next\bib:scan}
75
76 \def\b:btitem#1{\egroup\def\bib:type{#1}\futurelet\:next\bib:scan}
77
78 \catcode`\@=13\relax
79 \gdef\bibtex#1{\begingroup
80 \def@{\bgroup \catcode`\@=12\b:btitem}%
81 \catcode`\@=13\relax
82 \input #1\endgroup}
83 \catcode`\@=11\relax
84
85 \def\cont:parse{\futurelet\:next\cont:parseY}
86 \def\cont:parseY{%
87 \expandafter\ifx \space\:next
88 \expandafter \def\expandafter\:temp\space{\cont:parse}%
89 \else \let\:temp\cont:parseX \fi \:temp}
90 \long\def\cont:parseX#1={%%
91 \expandafter\get:key#1 ///\futurelet\:next\parse:value}
92 \def\parse:value{%
93 \expandafter\ifx \space\:next
94 \expandafter\def\expandafter\:temp\space{\futurelet
95 \:next\parse:value}%
96 \else \if "\:next \let\:temp=\parse:valueX
97 \else
98 \ifx \bgroup\:next \let\:temp=\parse:valueG
99 \else \let\:temp=\parse:valueC \fi
100 \fi \fi \:temp}
101 \def\parse:valueC#1,{\parse:valueY{#1},}
102 \def\parse:valueX"#1"{\parse:valueY{#1}}
103 \def\parse:valueG#1{\parse:valueY{#1}}
104 \def\parse:valueY#1{%
105 \def\:temp{@}\def\:tempa{#1}\ifx \:temp\:tempa \else
106 \def\:tempb{#1}\ifx \:tempb\empty\else \open:tag\bib:tag{key}%
107 \:tempb\csname b:\bib:tag\endcsname\hfil\break
108 \fi
109 \expandafter\tail:parse
110 \fi}
111 \def\tail:parse{\futurelet\:next\tail:parseY}
112 \def\tail:parseY{\ifx \:com\:next \def\:temp##1{\cont:parse}%
113 \else \expandafter\ifx \space\:next
114 \expandafter \def\expandafter\:temp\space{\tail:parse}%
115 \else \ifx\:next\egroup \let\:temp\empty
116 \else\def\:temp##1{\tail:parse}\fi
117 \fi\fi \:temp}
118 \let\:com=,
119
120 \:RestoreCatcodes
121 \endinput
122