summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-xml.mkiv
blob: 96375b9cc61a440aa9e84e2eaecd0218c6b60dc8 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%D \module
%D   [       file=publ-xml,
%D        version=2013.12.24,
%D          title=\CONTEXT\ Publication Support,
%D       subtitle=XML,
%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.

\writestatus{loading}{ConTeXt Publication Support / XML}

\unprotect

\unexpanded\def\convertbtxdatasettoxml
  {\dosingleempty\publ_convert_to_xml}

\def\publ_convert_to_xml[#1]%
  {\clf_convertbtxdatasettoxml{\iffirstargument#1\else\s!default\fi}} % or current when not empty

% \startxmlsetups btx:initialize
%     \xmlregistereddocumentsetups{#1}{}
%     \xmlsetsetup{#1}{bibtex|entry|field}{btx:*}
%     \xmlmain{#1}
% \stopxmlsetups

\startxmlsetups btx:initialize
    \xmlsetsetup{#1}{bibtex|entry|field}{btx:*}
    \xmlmain{#1}
\stopxmlsetups

% \startxmlsetups btx:entry
%     \xmlflush{#1}
% \stopxmlsetups

\startxmlsetups btx:field
    \xmlflushcontext{#1}
\stopxmlsetups

\protect \endinput

% \startxmlsetups bibtex:entry:getkeys
%     \xmladdsortentry{bibtex}{#1}{\xmlfilter{#1}{/field[@name='author']/text()}}
%     \xmladdsortentry{bibtex}{#1}{\xmlfilter{#1}{/field[@name='year'  ]/text()}}
%     \xmladdsortentry{bibtex}{#1}{\xmlatt{#1}{tag}}
% \stopxmlsetups

% \startbuffer
% \startxmlsetups xml:bibtex:sorter
%     \xmlresetsorter{bibtex}
%   % \xmlfilter{#1}{entry/command(bibtex:entry:getkeys)}
%     \xmlfilter{#1}{
%         bibtex
%         /entry[@category='article']
%         /field[@name='author' and find(text(),'Knuth')]
%         /../command(bibtex:entry:getkeys)}
%     \xmlsortentries{bibtex}
%     \xmlflushsorter{bibtex}{bibtex:entry:flush}
% \stopxmlsetups
% \stopbuffer

% \bgroup
%     \setups[bibtex-commands]
%     \getbuffer
% \egroup

% \startxmlsetups bibtex:entry:flush
%     \xmlfilter{#1}{/field[@name='author']/context()} / %
%     \xmlfilter{#1}{/field[@name='year'  ]/context()} / %
%     \xmlatt{#1}{tag}\par
% \stopxmlsetups

% \startpacked
% \getbuffer
% \stoppacked


% \unexpanded\def\btx_xml_list_handle_entry
%   {\begingroup
%    \ignorespaces
%    \xmlfilter{btx:\currentbtxrendering}{/bibtex/entry[@tag='\currentbtxtag']/command(btx:format)}%
%    \removeunwantedspaces
%    \endgroup}

% \startxmlsetups btx:format
%     \btxlistparameter\c!before\relax % prevents lookahead
%     \edef\currentbibxmlnode {#1}
%     \edef\currentbibxmltag  {\xmlatt{#1}{tag}}
%     \edef\currentbtxcategory{\xmlatt{#1}{category}}
%     \ignorespaces
%     \xmlcommand{#1}{.}{btx:\currentbtxformat:\currentbibxmlcategory}
%     \removeunwantedspaces
%     \btxlistparameter\c!after\relax % prevents lookahead
% \stopxmlsetups

% \startxmlsetups btx:list
%     \xmlfilter{#1}{/bibtex/entry/command(bibtex:format)}
% \stopxmlsetups

% \startxmlsetups btx:btx
%     \xmlfilter{#1}{/entry/command(btx:format)}
% \stopxmlsetups

% \unexpanded\def\btx_xml_doifelse#1{\xmldoifelse\currentbibxmlnode{/field[@name='#1']}}
% \unexpanded\def\btx_xml_doif    #1{\xmldoif    \currentbibxmlnode{/field[@name='#1']}}
% \unexpanded\def\btx_xml_doifnot #1{\xmldoifnot \currentbibxmlnode{/field[@name='#1']}}
%            \def\btx_xml_flush   #1{\xmlcontext \currentbibxmlnode{/field[@name='#1']}}
%            \def\btx_xml_setup     {\xmlsetup   \currentbibxmlnode} % {#1}
% \unexpanded\def\btx_xml_todo    #1{[#1]}

% \xmlfilter{#1}{/field[@name='\currentbtxfield']/btxconcat('\currentbtxfield')}