tabl-xnt.mkvi /size: 3929 b    last modification: 2020-07-01 14:35
1% macros=mkvi
2
3%D \module
4%D   [       file=tabl-xtb,
5%D        version=2011.10.28,
6%D          title=\CONTEXT\ Table Macros,
7%D       subtitle=Natural to Xtreme Tables,
8%D         author=Hans Hagen,
9%D           date=\currentdate,
10%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
11%C
12%C This module is part of the \CONTEXT\ macro||package and is
13%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
14%C details.
15
16\writestatus{loading}{ConTeXt Table Macros / Natural to Xtreme Tables}
17
18\unprotect
19
20%D Don't expect wonders but it might come in handy:
21%D
22%D \starttyping
23%D \mapTABLEtoxtable
24%D \restoreTABLEfromxtable
25%D \stoptyping
26%D
27%D We stick to a simple example:
28%D
29%D \startbuffer
30%D \bTABLE
31%D   \bTR
32%D     \bTD[width=1cm,background=color,backgroundcolor=red] one \eTD
33%D     \bTD[width=2cm] two \eTD
34%D   \eTR
35%D   \bTR
36%D     \bTD alpha \eTD
37%D     \bTD beta  \eTD
38%D   \eTR
39%D \eTABLE
40%D \stopbuffer
41%D
42%D \typebuffer
43%D
44%D \startbuffer
45%D \startlinecorrection
46%D \getbuffer
47%D \stoplinecorrection
48%D
49%D \startlinecorrection
50%D \mapTABLEtoxtable \getbuffer
51%D \stoplinecorrection
52%D \stopbuffer
53%D
54%D \typebuffer \getbuffer
55
56\let\tabl_x_normal_bTABLEhead\bTABLEhead
57\let\tabl_x_normal_eTABLEhead\eTABLEhead
58\let\tabl_x_normal_bTABLEnext\bTABLEnext
59\let\tabl_x_normal_eTABLEnext\eTABLEnext
60\let\tabl_x_normal_bTABLEfoot\bTABLEfoot
61\let\tabl_x_normal_eTABLEfoot\eTABLEfoot
62\let\tabl_x_normal_bTABLEbody\bTABLEbody
63\let\tabl_x_normal_eTABLEbody\eTABLEbody
64\let\tabl_x_normal_bTR       \bTR
65\let\tabl_x_normal_eTR       \eTR
66\let\tabl_x_normal_bTD       \bTD
67\let\tabl_x_normal_eTD       \eTD
68\let\tabl_x_normal_bTH       \bTH
69\let\tabl_x_normal_eTH       \eTH
70\let\tabl_x_normal_setupTABLE\setupTABLE
71\let\tabl_x_normal_bTABLE    \bTABLE
72\let\tabl_x_normal_eTABLE    \eTABLE
73
74\unexpanded\def\restoreTABLEfromxtable
75  {\let\bTABLEhead\tabl_x_normal_bTABLEhead
76   \let\eTABLEhead\tabl_x_normal_eTABLEhead
77   \let\bTABLEnext\tabl_x_normal_bTABLEnext
78   \let\eTABLEnext\tabl_x_normal_eTABLEnext
79   \let\bTABLEfoot\tabl_x_normal_bTABLEfoot
80   \let\eTABLEfoot\tabl_x_normal_eTABLEfoot
81   \let\bTABLEbody\tabl_x_normal_bTABLEbody
82   \let\eTABLEbody\tabl_x_normal_eTABLEbody
83   \let\bTR       \tabl_x_normal_bTR
84   \let\eTR       \tabl_x_normal_eTR
85   \let\bTD       \tabl_x_normal_bTD
86   \let\eTD       \tabl_x_normal_eTD
87   \let\bTH       \tabl_x_normal_bTH
88   \let\eTH       \tabl_x_normal_eTH
89   \let\setupTABLE\tabl_x_normal_setupTABLE
90   \let\bTABLE    \tabl_x_normal_bTABLE
91   \let\eTABLE    \tabl_x_normal_eTABLE}
92
93\unexpanded\def\mapTABLEtoxtable
94  {\let\bTABLEhead\startxtablehead
95   \let\eTABLEhead\stopxtablehead
96   \let\bTABLEnext\startxtablefoot
97   \let\eTABLEnext\stopxtablefoot
98   \let\bTABLEfoot\startxtablefoot
99   \let\eTABLEfoot\stopxtablefoot
100   \let\bTABLEbody\startxtablebody
101   \let\eTABLEbody\stopxtablebody
102   \let\bTR       \startxrow
103   \let\eTR       \stopxrow
104   \let\bTD       \startxcell
105   \let\eTD       \stopxcell
106   \let\bTH       \tabl_x_TABLE_TH_start_cell
107   \let\eTH       \tabl_x_TABLE_TH_stop_cell
108   \let\setupTABLE\tabl_x_TABLE_setup
109   \let\bTABLE    \tabl_x_TABLE_start
110   \let\eTABLE    \tabl_x_TABLE_stop}
111
112\unexpanded\def\tabl_x_TABLE_setup{\dosingleempty\tabl_x_TABLE_setup_indeed}
113\unexpanded\def\tabl_x_TABLE_start{\dosingleempty\tabl_x_TABLE_start_indeed}
114\unexpanded\def\tabl_x_TABLE_stop {\stopxtable}
115
116\unexpanded\def\tabl_x_TABLE_TH_start_cell
117  {\startxcellgroup[\c!foregroundstyle=\v!bold]%
118   \startxcell}
119
120\unexpanded\def\tabl_x_TABLE_TH_stop_cell
121  {\stopxcell
122   \stopxcellgroup}
123
124\unexpanded\def\tabl_x_TABLE_setup_indeed[#settings]%
125  {\iffirstargument
126     \setupxtable[#settings]%
127   \fi}
128
129\unexpanded\def\tabl_x_TABLE_start_indeed[#settings]%
130  {\bgroup
131   \tabl_x_prepare{#settings}%
132   \edef\tabl_x_current_buffer{\tabl_x_default_buffer}%
133   \buff_pickup\tabl_x_current_buffer{bTABLE}{eTABLE}\relax\tabl_x_process\zerocount}
134
135\protect \endinput
136