strc-tag.mkiv /size: 20 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=strc-tag,
3
%D version=2010.07.16,
4
%D title=\CONTEXT\ Structure Macros,
5
%D subtitle=Tags,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
% labels: no language needed
15
% key/values and other names might change (and probably will)
16 17
\writestatus
{
loading
}{
ConTeXt
Structure
Macros
/
Tags
}
18 19
\registerctxluafile
{
strc
-
tag
}{}
20 21
\unprotect
22 23
%D Eventually these labels will either move to the modules
24
%D where they're used, or they will en dup in mult-tag.
25 26
\def
\t!document
{
document
}
% Div
27 28
\def
\t!division
{
division
}
% Div
29
\def
\t!paragraph
{
paragraph
}
% P
30
\def
\t!p
{
p
}
% P
31
\def
\t!construct
{
construct
}
% Span
32
\def
\t!highlight
{
highlight
}
% Span
33 34
\def
\t!section
{
section
}
% Sect
35
\def
\t!sectioncaption
{
sectioncaption
}
% Div
36
\def
\t!sectiontitle
{
sectiontitle
}
% H
37
\def
\t!sectionnumber
{
sectionnumber
}
% H
38
\def
\t!sectioncontent
{
sectioncontent
}
% Div
39 40
\def
\t!itemgroup
{
itemgroup
}
% L
41
\def
\t!item
{
item
}
% Li
42
\def
\t!itemtag
{
itemtag
}
% Lbl
43
\def
\t!itemcontent
{
itemcontent
}
% LBody
44
\def
\t!itemhead
{
itemhead
}
% Div
45
\def
\t!itembody
{
itembody
}
% Div
46 47
\def
\t!description
{
description
}
% Li
48
\def
\t!descriptiontag
{
descriptiontag
}
% Lbl
49
\def
\t!descriptioncontent
{
descriptioncontent
}
% LBody
50
\def
\t!descriptionsymbol
{
descriptionsymbol
}
% Span
51 52
\let
\t!construction
\t!description
53
\let
\t!constructiontag
\t!descriptiontag
54
\let
\t!constructioncontent
\t!descriptioncontent
55
\let
\t!constructionsymbol
\t!descriptionsymbol
56 57
\def
\t!verbatimblock
{
verbatimblock
}
% Code
58
\def
\t!verbatimlines
{
verbatimlines
}
% Code
59
\def
\t!verbatimline
{
verbatimline
}
% Code
60
\def
\t!verbatim
{
verbatim
}
% Code
61 62
\def
\t!lines
{
lines
}
% Code
63
\def
\t!line
{
line
}
% Code
64
\def
\t!linenumber
{
linenumber
}
% Span
65 66
\def
\t!sorting
{
sorting
}
% Span
67
\def
\t!synonym
{
synonym
}
% Span
68 69
\def
\t!register
{
register
}
% Div
70
\def
\t!registerlocation
{
registerlocation
}
% Span
71
\def
\t!registersection
{
registersection
}
% Div
72
\def
\t!registertag
{
registertag
}
% Span
73
\def
\t!registerentries
{
registerentries
}
% Div
74
\def
\t!registerentry
{
registerentry
}
% Span
75
\def
\t!registercontent
{
registercontent
}
% Span
76
\def
\t!registersee
{
registersee
}
% Span
77
\def
\t!registersection
{
registersection
}
% Span
78
\def
\t!registerpages
{
registerpages
}
% Span
79
\def
\t!registerpage
{
registerpage
}
% Span
80
\def
\t!registerpagerange
{
registerpagerange
}
% Span
81
\def
\t!registerfrompage
{
registerfrompage
}
% Span
82
\def
\t!registertopage
{
registertopage
}
% Span
83
\def
\t!registerseparator
{
registerseparator
}
% Span
84 85
\def
\t!table
{
table
}
% Table
86
\def
\t!tablerow
{
tablerow
}
% TR
87
\def
\t!tablecell
{
tablecell
}
% TD
88
\def
\t!tableheadcell
{
tableheadcell
}
% TH
89
\def
\t!tablehead
{
tablehead
}
% THEAD
90
\def
\t!tablebody
{
tablebody
}
% TBODY
91
\def
\t!tablefoot
{
tablefoot
}
% TFOOT
92 93 94
\def
\t!tabulate
{
tabulate
}
% Table
95
\def
\t!tabulaterow
{
tabulaterow
}
% TR
96
\def
\t!tabulatecell
{
tabulatecell
}
% TD
97
\def
\t!tabulateheadcell
{
tabulateheadcell
}
% TH
98
\def
\t!tabulatehead
{
tabulatehead
}
% THEAD
99
\def
\t!tabulatebody
{
tabulatebody
}
% TBODY
100
\def
\t!tabulatefoot
{
tabulatefoot
}
% TFOOT
101 102
\def
\t!math
{
math
}
% math
103
\def
\t!mathtable
{
mtable
}
% Table
104
\def
\t!mathtablerow
{
mtr
}
% TR
105
\def
\t!mathtablecell
{
mtd
}
% TD
106
\def
\t!mathaction
{
maction
}
%
107
\def
\t!mathstacker
{
mstacker
}
108
\def
\t!mathstackertop
{
mstackertop
}
109
\def
\t!mathstackermid
{
mstackermid
}
110
\def
\t!mathstackerbot
{
mstackerbot
}
111 112
\def
\t!munderover
{
munderover
}
% special cases
113
\def
\t!munder
{
munder
}
% special cases
114
\def
\t!mover
{
mover
}
% special cases
115 116
\def
\t!list
{
list
}
% TOC
117
\def
\t!listitem
{
listitem
}
% TOCI
118
\def
\t!listtag
{
listtag
}
% Lbl
119
\def
\t!listcontent
{
listcontent
}
% P
120
\def
\t!listdata
{
listdata
}
% P
121
\def
\t!listpage
{
listpage
}
% Reference
122
\def
\t!listtext
{
listtext
}
% Span
123 124
\def
\t!delimitedblock
{
delimited
}
% BlockQuote
125
\def
\t!delimited
{
delimited
}
% Quote
126
\def
\t!delimitedsymbol
{
delimitedsymbol
}
% Span
127
\def
\t!delimitedcontent
{
delimitedcontent
}
% Span
128
\def
\t!subsentence
{
subsentence
}
% Span
129
\def
\t!subsentencecontent
{
subsentencecontent
}
% Span
130
\def
\t!subsentencesymbol
{
subsentencesymbol
}
% Span
131 132
\def
\t!float
{
float
}
% Div
133
\def
\t!floatcaption
{
floatcaption
}
% Caption
134
\def
\t!floatlabel
{
floatlabel
}
% Span
135
\def
\t!floattext
{
floattext
}
% Span
136
\def
\t!floatnumber
{
floatnumber
}
% Span
137
\def
\t!floatcontent
{
floatcontent
}
% P
138 139
\def
\t!image
{
image
}
% P
140 141
\def
\t!mpgraphic
{
mpgraphic
}
% P
142 143
\def
\t!formulaset
{
formulaset
}
% Div
144
\def
\t!formula
{
formula
}
% Div
145
\def
\t!formulacaption
{
formulacaption
}
% Span
146
\def
\t!formulalabel
{
formulalabel
}
% Span
147
\def
\t!formulanumber
{
formulanumber
}
% P
148
\def
\t!formulacontent
{
formulacontent
}
% P
149
\def
\t!subformula
{
subformula
}
% Div
150 151
\def
\t!link
{
link
}
% Link
152
\def
\t!reference
{
reference
}
% Span
153 154
\def
\t!margintext
{
margintext
}
% Span
155
\def
\t!margintextblock
{
margintextblock
}
% Div
156
\def
\t!marginanchor
{
marginanchor
}
% Span
157 158
% we might opt for verbose variants so this is experimental:
159 160
\def
\t!label
{
label
}
% Span
161
\def
\t!number
{
number
}
% Span
162 163
\def
\t!ignore
{
ignore
}
% Span
164
\def
\t!private
{
private
}
% Span
165 166
\def
\t!mid
{
mid
}
% Span
167
\def
\t!sub
{
sub
}
% Span
168
\def
\t!sup
{
sup
}
% Span
169
\def
\t!subsup
{
subsup
}
% Span
170 171
\def
\t!unit
{
unit
}
% Span
172
\def
\t!quantity
{
quantity
}
% Span
173
\def
\t!number
{
number
}
% Span
174 175
\def
\t!combination
{
combination
}
% Span
176
\def
\t!combinationpair
{
combinationpair
}
% Span
177
\def
\t!combinationcontent
{
combinationcontent
}
% Span
178
\def
\t!combinationcaption
{
combinationcaption
}
% Span
179 180
\def
\t!publications
{
publications
}
% Span
181
\def
\t!publication
{
publication
}
% Span
182
\def
\t!pubfld
{
pubfld
}
% Span
183 184
\def
\t!block
{
block
}
% Div
185
\def
\t!userdata
{
userdata
}
% Div
186 187
% \setuptaglabeltext
188
% [en]
189
% [\t!document=document]
190 191
% the real code
192 193
\definesystemattribute
[
tagged
][
public
]
194
\definesystemattribute
[
image
]
[
public
]
195 196
\unexpanded
\def
\setelementbackendtag
{
\dodoubleargument
\strc_tags_set_backend
}
197
\unexpanded
\def
\setelementnature
{
\dodoubleargument
\strc_tags_set_nature
}
198 199
\def
\strc_tags_set_backend
[#
1
][#
2
]
{
\clf_settagproperty_b
{
#
1
}{
#
2
}}
% todo: ignore when no export
200
\def
\strc_tags_set_nature
[#
1
][#
2
]
{
\clf_settagproperty_n
{
#
1
}{
#
2
}}
% todo: ignore when no export
201 202
\unexpanded
\def
\strc_tags_set_aspect_nop
#
1
#
2
{}
203
\unexpanded
\def
\strc_tags_set_aspect_yes
#
1
#
2
{
\clf_settagaspect
{
#
1
}{
#
2
}}
% todo: ignore when no export / also \let
204 205
\unexpanded
\def
\ignoretagsinexport
[#
1
]
%
206
{
\clf_ignoretagsinexport
{
#
1
}}
207 208
\installcorenamespace
{
tagging
}
209 210
\installsetuponlycommandhandler
\??tagging
{
tagging
}
211 212
% it makes no sense to have labels ... maybe some day as a last 'replace' in the export
213
% which might be more efficient then ... okay, we now cannot overload but who cares
214 215
\unexpanded
\def
\strc_tags_element_start_yes
{
\dodoubleempty
\strc_tags_element_start_yes_indeed
}
216
\unexpanded
\def
\strc_tags_element_start_nop
{
\dodoubleempty
\strc_tags_element_start_nop_indeed
}
217 218
\unexpanded
\def
\strc_tags_element_start_yes_indeed
219
{
\iftrialtypesetting
220
\expandafter
\strc_tags_element_start_yes_indeed_nop
221
\else
222
\expandafter
\strc_tags_element_start_yes_indeed_yes
223
\fi
}
224 225
\unexpanded
\def
\strc_tags_element_start_yes_indeed_nop
[#
1
][#
2
]
%
226
{}
227 228
\unexpanded
\def
\strc_tags_element_start_yes_indeed_yes
[#
1
][#
2
]
%
229
{
\clf_starttag_u
{
#
1
}{
#
2
}}
230 231
\unexpanded
\def
\strc_tags_element_stop_yes
232
{
\iftrialtypesetting
233
\expandafter
\strc_tags_element_stop_yes_indeed_nop
234
\else
235
\expandafter
\strc_tags_element_stop_yes_indeed_yes
236
\fi
}
237 238
\unexpanded
\def
\strc_tags_element_stop_nop
239
{}
240 241
\unexpanded
\def
\strc_tags_element_stop_yes_indeed_nop
242
{}
243 244
\unexpanded
\def
\strc_tags_element_stop_yes_indeed_yes
245
{
\clf_stoptag
}
246 247
\let
\strc_tags_element_start_nop_indeed
\strc_tags_element_start_yes_indeed_nop
248
\let
\strc_tags_element_stop_nop_indeed
\strc_tags_element_stop_yes_indeed_nop
249 250
\def
\strc_tags_report_hyphen
#
1
%
251
{
\writestatus
\m!languages
{
setting
#
1
to
U
+
0
0
AD
}}
252 253
\unexpanded
\def
\strc_tags_patch_hyphen
254
{
% for the moment here
255
\ifnum
\languageparameter
\s!lefthyphenchar
>
\zerocount
256
\setuplanguage
[
\s!default
][
\s!lefthyphenchar
="
AD
]
%
257
\strc_tags_report_hyphen
\s!lefthyphenchar
258
\fi
259
\ifnum
\languageparameter
\s!righthyphenchar
>
\zerocount
260
\setuplanguage
[
\s!default
][
\s!righthyphenchar
="
AD
]
%
261
\strc_tags_report_hyphen
\s!righthyphenchar
262
\fi
263
\let
\strc_tags_report_hyphen
\gobbleoneargument
}
264 265
\unexpanded
\def
\strc_tags_enable_elements
266
{
\strc_tags_patch_hyphen
267
\let
\startelement
\strc_tags_element_start_yes
268
\let
\stopelement
\strc_tags_element_stop_yes
269
\let
\dosettagproperty
\strc_tags_set_aspect_yes
}
270 271
\unexpanded
\def
\strc_tags_disable_elements
272
{
\let
\startelement
\strc_tags_element_start_nop
273
\let
\stopelement
\strc_tags_element_stop_nop
274
\let
\dosettagproperty
\strc_tags_set_aspect_nop
}
275 276
% beware: making these unexpanded spoils tables (noalign problem)
277 278
\def
\strc_tags_enabled_start_no_detail
279
{
\iftrialtypesetting
280
\expandafter
\strc_tags_start_nop_no_detail
281
\else
282
\expandafter
\strc_tags_start_yes_no_detail
283
\fi
}
284 285
\def
\strc_tags_enabled_start_detail
286
{
\iftrialtypesetting
287
\expandafter
\strc_tags_start_nop_detail
288
\else
289
\expandafter
\strc_tags_start_yes_detail
290
\fi
}
291 292
\def
\strc_tags_enabled_start_chained
293
{
\iftrialtypesetting
294
\expandafter
\strc_tags_start_nop_chained
295
\else
296
\expandafter
\strc_tags_start_yes_chained
297
\fi
}
298 299
\def
\strc_tags_enabled_stop
300
{
\iftrialtypesetting
301
\expandafter
\strc_tags_stop_nop
302
\else
303
\expandafter
\strc_tags_stop_yes
304
\fi
}
305 306
\def
\strc_tags_start_yes_no_detail
#
1
{
\clf_starttag
{
#
1
}}
307
\def
\strc_tags_start_yes_detail
#
1
#
2
{
\clf_starttag_d
{
#
1
}{
#
2
}}
308
\def
\strc_tags_start_yes_chained
#
1
#
2
#
3
{
\clf_starttag_c
{
#
1
}{
#
2
}{
\getcurrentparentchain
#
3
{
#
2
}}}
309
\def
\strc_tags_stop_yes
{
\clf_stoptag
}
310 311
\let
\strc_tags_start_nop_no_detail
\gobbleoneargument
312
\let
\strc_tags_start_nop_detail
\gobbletwoarguments
313
\let
\strc_tags_start_nop_chained
\gobblethreearguments
314
\let
\strc_tags_stop_nop
\donothing
315 316
\def
\strc_tags_start_yes_ignore
{
\clf_starttag
{
\t!ignore
}}
317
\let
\strc_tags_stop_yes_ignore
\strc_tags_stop_yes
318
\let
\strc_tags_start_nop_ignore
\donothing
319
\let
\strc_tags_stop_nop_ignore
\donothing
320 321
% more efficient:
322 323
% \dostarttagged % {tag} {detail}
324
% \dostarttaggedchained % {tag} {detail} \??hash
325
% \dostarttaggednodetail % {tag}
326 327
\newconditional
\c_strc_tags_enabled
328 329
\let
\dotaggedplaceholder
\empty
330 331
\chardef
\strc_tags_placeholder_char
\zerocount
% "FFFC
332 333
\unexpanded
\def
\strc_tags_enable_indeed
334
{
\let
\dotaggedplaceholder
\strc_tags_placeholder_char
335
\let
\dostarttagged
\strc_tags_enabled_start_detail
336
\let
\dostarttaggednodetail
\strc_tags_enabled_start_no_detail
337
\let
\dostarttaggedchained
\strc_tags_enabled_start_chained
338
\let
\dostoptagged
\strc_tags_enabled_stop
339
\let
\dostartignoretagging
\strc_tags_start_yes_ignore
340
\let
\dostopignoretagging
\strc_tags_stop_yes_ignore
}
341 342
\unexpanded
\def
\strc_tags_enable
343
{
% once enable one is toast
344
\global
\settrue
\c_strc_tags_enabled
345
% and gets:
346
\strc_tags_enable_indeed
}
347 348
\unexpanded
\def
\strc_tags_disable
349
{
\ifconditional
\c_strc_tags_enabled
350
% so now all are artifacts
351
\let
\dotaggedplaceholder
\strc_tags_placeholder_char
352
\let
\dostarttagged
\strc_tags_start_nop_detail
353
\let
\dostarttaggednodetail
\strc_tags_start_nop_no_detail
354
\let
\dostarttaggedchained
\strc_tags_start_nop_chained
355
\let
\dostoptagged
\strc_tags_stop_nop_ignore
356
\else
357
% initial
358
\let
\dotaggedplaceholder
\empty
359
\let
\dostarttagged
\strc_tags_start_nop_detail
360
\let
\dostarttaggednodetail
\strc_tags_start_nop_no_detail
361
\let
\dostarttaggedchained
\strc_tags_start_nop_chained
362
\let
\dostoptagged
\strc_tags_stop_nop_ignore
363
\let
\dostartignoretagging
\strc_tags_start_nop_ignore
364
\let
\dostopignoretagging
\strc_tags_stop_nop_ignore
365
\fi
}
366 367
% for luigi (beware: fully expandable):
368 369
\def
\strc_tags_get_element_tag_yes
{
\clf_getelementtag
}
370
\let
\strc_tags_get_element_tag_nop
\donothing
371 372
\unexpanded
\def
\strc_tags_setup_element_user_properties_yes
373
{
\dodoubleempty
\strc_tags_setup_element_user_properties_indeed
}
374 375
\unexpanded
\def
\strc_tags_setup_element_user_properties_nop
376
{
\dodoubleempty
\strc_tags_setup_element_user_properties_indeed_nop
}
377 378
\def
\strc_tags_setup_element_user_properties_indeed
379
{
\iftrialtypesetting
380
\expandafter
\strc_tags_setup_element_user_properties_indeed_nop
381
\else
382
\expandafter
\strc_tags_setup_element_user_properties_indeed_yes
383
\fi
}
384 385
\def
\strc_tags_setup_element_user_properties_indeed_nop
[#
1
][#
2
]
{}
386
\def
\strc_tags_setup_element_user_properties_indeed_yes
[#
1
][#
2
]
{
\clf_setelementuserproperties
{
#
1
}{
#
2
}}
387 388
\unexpanded
\def
\strc_tags_enable_properties
389
{
\let
\getelementtag
\strc_tags_get_element_tag_yes
390
\let
\setupelementuserproperties
\strc_tags_setup_element_user_properties_yes
}
391 392
\unexpanded
\def
\strc_tags_disable_properties
393
{
\let
\getelementtag
\strc_tags_get_element_tag_nop
394
\let
\setupelementuserproperties
\strc_tags_setup_element_user_properties_nop
}
395 396
%D The triggers:
397 398
\newtoks
\everyenableelements
399
\newtoks
\everydisableelements
400 401
\appendtoks
402
\strc_tags_enable_elements
403
\strc_tags_enable_properties
404
\doifelse
{
\taggingparameter
\c!method
}
\v!auto
\strc_tags_enable
\strc_tags_disable
405
\to
\everyenableelements
406 407
\appendtoks
408
\strc_tags_disable_elements
409
\strc_tags_disable_properties
410
\strc_tags_disable
411
\to
\everydisableelements
412 413
\appendtoks
414
\doifelse
{
\taggingparameter
\c!state
}
\v!start
{
\the
\everyenableelements
}{
\the
\everydisableelements
}
%
415
\to
\everysetuptagging
416 417
\unexpanded
\def
\forgettagging
418
{
\c_attr_tagged
\attributeunsetvalue
}
419 420
\setuptagging
421
[
\c!state
=
\v!stop
,
422
\c!method
=
\v!auto
]
423 424
% \unexpanded\def\startparagraph
425
% {\dostarttagged\t!paragraph\empty}
426
%
427
% \unexpanded\def\stopparagraph
428
% {% \removeunwantedspaces % yes or no
429
% \dostoptagged
430
% \par}
431 432
% Cf suggestion by Wolfgang we now have named paragraphs. Watch out, the content
433
% is grouped but only when we have an instance.
434
%
435
% \defineparagraph[red] [color=red]
436
% \defineparagraph[bold][style=bold]
437
%
438
% \startparagraph \input ward \stopparagraph
439
% \startparagraph[red] \input ward \stopparagraph
440
% \startparagraph[bold] \input ward \stopparagraph
441 442
\installcorenamespace
{
paragraph
}
443
\installcommandhandler
\??paragraph
{
paragraph
}
\??paragraph
444 445
\setupparagraph
% someday maybe also strut (beg/end) and align
446
[
\c!color
=
,
447
\c!style
=]
448 449
\unexpanded
\def
\startparagraph
450
{
\dodoubleempty
\paragraph_start
}
451 452
\def
\paragraph_start
453
{
\endgraf
% we end before the group
454
\begingroup
455
\iffirstargument
456
\ifsecondargument
457
\doubleexpandafter
\paragraph_start_two
458
\else
459
\doubleexpandafter
\paragraph_start_one
460
\fi
461
\else
462
\expandafter
\paragraph_start_zero
463
\fi
}
464 465
\def
\paragraph_start_two
[#
1
][#
2
]
%
466
{
\edef
\currentparagraph
{
#
1
}
%
467
\setupcurrentparagraph
[#
2
]
%
468
\paragraph_start_indeed
}
469 470
\def
\paragraph_start_one
[#
1
][#
2
]
%
471
{
\doifelseassignment
{
#
1
}
472
{
\let
\currentparagraph
\empty
473
\setupcurrentparagraph
[#
1
]
}
474
{
\edef
\currentparagraph
{
#
1
}}
%
475
\paragraph_start_indeed
}
476 477
\def
\paragraph_start_zero
[#
1
][#
2
]
%
478
{
\let
\currentparagraph
\empty
479
\paragraph_start_indeed
}
480 481
\ifdefined
\dotagparagraph
\else
\let
\dotagparagraph
\gobbleoneargument
\fi
482 483
\def
\paragraph_start_indeed
484
{
\useparagraphstyleandcolor
\c!style\c!color
485
\usealignparameter
\paragraphparameter
486
\usesetupsparameter
\paragraphparameter
487
\dostarttagged
\t!paragraph
\currentparagraph
488
\dotagparagraph
{
\paragraphparameter
\c!align
}}
489 490
\unexpanded
\def
\stopparagraph
491
{
\dostoptagged
492
\endgraf
% we end inside the group
493
\endgroup
}
494 495
\let
\startpar\startparagraph
496
\let
\stoppar
\stopparagraph
497 498
\def
\strc_tags_document_start_indeed
499
{
\glet
\strc_tags_document_start_indeed
\relax
500
\dostarttagged
\t!document
\empty
}
501 502
\def
\strc_tags_document_stop_indeed
503
{
\glet
\strc_tags_document_stop_indeed
\relax
504
\dostoptagged
}
505 506
\appendtoks
507
\strc_tags_document_start_indeed
% here because otherwise products don't get a root (starttext before env)
508
\to
\everyenableelements
509 510
% \appendtoks
511
% \strc_tags_document_start_indeed
512
% \to \everystarttext
513 514
\appendtoks
515
\strc_tags_document_stop_indeed
516
\to
\everystoptext
517 518
\appendtoks
519
\strc_tags_disable_elements
520
\strc_tags_disable
521
\to
\everybeforepagebody
522 523
%D This will only work well with sane use.
524 525
% \appendtoks
526
% {%
527
% \doglobal\appendtoks
528
% \strc_tags_start_yes_ignore
529
% \to \everybeforepagebody
530
% \doglobal\appendtoks
531
% \strc_tags_stop_yes_ignore
532
% \to \everyafterpagebody
533
% }%
534
% \to \everyenableelements
535 536
% This doesn't work well either, so instead we handle the ornaments in the
537
% tagging in a different way (see attr -> false code).
538 539
% \appendtoks
540
% \dostartignoretagging
541
% \to \everybeforepagebody
542
%
543
% \appendtoks
544
% \dostopignoretagging
545
% \to \everyafterpagebody
546 547
% \doifelseinelement{structure:section} {yes} {no}
548
% \doifelseinelement{structure:chapter} {yes} {no}
549
% \doifelseinelement{division:*-structure:chapter} {yes} {no}
550 551
\unexpanded
\def
\doifelseinelement
#
1
%
552
{
\clf_doifelseinelement
{
#
1
}}
553 554
\let
\doifinelementelse\doifelseinelement
555 556
\unexpanded
\def
\taggedlabeltexts
#
1
#
2
#
3
% experimental: label, numberdetail, numbercontent
557
{
\begingroup
558
\dostarttagged
\t!label
{
#
1
}
%
559
\labeltexts
{
#
1
}
%
560
{
\dostoptagged
561
\dostarttagged
\t!number
{
#
2
}
%
562
#
3
%
563
\dostoptagged
564
\dostarttagged
\t!label
{
#
1
}}
%
565
\dostoptagged
566
\endgroup
}
567 568
\unexpanded
\def
\namedtaggedlabeltexts
#
1
#
2
#
3
#
4
#
5
% experimental: labeltag label numbertag numberdetail numbercontent
569
{
\begingroup
570
\dostarttagged
{
#
1
}{
#
2
}
%
571
\labeltexts
{
#
2
}
%
572
{
\dostoptagged
573
\dostarttagged
{
#
3
}{
#
4
}
%
574
#
5
%
575
\dostoptagged
576
\dostarttagged
{
#
1
}{
#
2
}}
%
577
\dostoptagged
578
\endgroup
}
579 580
%D Metadata is added after the following structure element so
581
%D here we get some as child of the document root and some as child
582
%D of the chapter element.
583
%D
584
%D \settaggedmetadata[title=Hello World!,author=Hans Hagen]
585
%D
586
%D \starttyping
587
%D \starttext
588
%D \startelement[ignore]
589
%D \input tufte
590
%D \stopelement
591
%D \par \input ward \par
592
%D \settaggedmetadata[whatever=Again and Again]
593
%D \startchapter[title=test]
594
%D \input ward
595
%D \stopchapter
596
%D \stoptext
597
%D \stoptyping
598 599
\unexpanded
\def
\settaggedmetadata
[#
1
]
%
600
{
\clf_settaggedmetadata
{
#
1
}}
601 602
%D An overload:
603 604
\let
\strc_tagged_saved_bpar
\bpar
605
\let
\strc_tagged_saved_epar
\epar
606 607
\unexpanded
\def
\bpar
{
\dostarttagged
\t!paragraph
\empty
\strc_tagged_saved_bpar
}
608
\unexpanded
\def
\epar
{
\strc_tagged_saved_epar
\dostoptagged
}
609 610
% \def\untagged{attr \taggedattribute\attributeunsetvalue}
611 612
\protect
613