summaryrefslogtreecommitdiff
path: root/tex/context/base/export-example.rng
blob: 93b21ba50bbd141161ab78725e71287fc83f511e (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# author    : Hans Hagen, PRAGMA-ADE, Hasselt NL
# copyright : PRAGMA ADE / ConTeXt Development Team
# license   : see context related readme files
# comment   : companion to context.mkiv

# todo: check all content (not yet ok but a bit boring job)
# todo: add attributes
# todo: we need more | and less ,
#
# validate with "rnv -c export-example.rng"

namespace m = "http://www.w3.org/1998/Math/MathML"

start = e_document

# Because users can typeset anything the content is somewhat
# unpredictable so this is just an indication of what to expect.

c_everything =
    text
  | c_inline
  | e_verbatimblock
  | e_lines
  | e_itemgroup
  | e_table
  | e_tabulate
  | e_register
  | e_list
  | e_section
  | e_float
  | e_formula
  | e_combination

c_inline =
    text
  | e_ignore
  | e_metadata
  | e_construct
  | e_highlight
  | e_verbatim
  | e_description
  | e_descriptionsymbol
  | e_sorting
  | e_synonym
  | e_image
  | e_mpgraphic
  | e_math
  | e_sub
  | e_sup
  | e_subsup
  | e_link
  | e_margintext
  | e_margintextblock

# We pass some relevant information via attributes. The detail attribute
# is common and provides information about the class or environment used.

a_detail = attribute detail {
    text
}

# The document element is the root of all.

e_document = element document {
    c_everything *
}

e_ignore = element ignore {
    c_everything *
}

e_metadata = element metadata {
    element metavariable {
        attribute name { text } ?
      , text
    } *
}

e_section = element section {
    a_detail ?
  | (
        element sectiontitle {
            c_inline *
        }
      , element sectionnumber {
            c_inline *
        } *
      , element sectioncontent {
            c_everything *
        }
    )
}

e_paragraph = element paragraph {
    c_inline *
}

e_p = element p {
    c_inline *
}

e_break = element break {
    empty
}

e_construct = element construct {
    c_everything*
}

e_highlight = element highlight {
    c_inline*
}

e_itemgroup = element itemgroup {
    element item {
        element itemtag {
            c_inline *
        }
    } ,
    element itemcontent {
        c_everything *
    }
}

e_combination = element combination {
    element combinationpair {
        element combinationcontent {
            inline*
        } ,
        element combinationcaption {
            inline*
        }
    }
}

e_description = element description {
    element descriptiontag     {
        c_inline*
    } ,
    element descriptioncontent {
        c_inline*
    } ,
    element descriptionsymbol  {
        c_inline*
    }
}

e_descriptionsymbol = element descriptionsymbol {
    c_inline*
}

e_verbatimblock = element verbatimblock {
    element verbatimlines {
        element verbatimline {
            text
        } *
    } *
}

e_verbatim = element verbatim {
    text
}

e_lines = element lines {
    element line {
        text
    } *
}

e_synonym = element synonym {
    text
}

e_sorting = element sorting {
    text
}

e_register = element register {
    element registersection {
        element registertag {
            text
        } ?
        ,
        element registerentries {
            (
                element registerentry {
                    text
                } |
                element registersee  {
                    text
                }
            ),
            (
                element registerpages {
                    element registerpage {
                        text
                    } *
                } |
                element registerpage {
                    text
                } |
                element registerpagerange {
                    element registerpage {
                        text
                    } ,
                    element registerpage {
                        text
                    }
                }
            )
        } ?
    } *
}

e_table = element table {
    element tablerow {
        element tablecell {
            c_inline *
        } *
    } *
}

e_tabulate = element tabulate {
    element tabulaterow {
        element tabulatecell {
            c_inline *
        } *
    } *
}

e_list = element list {
    element listitem {
        element listtag {
            text
        } ? ,
        element listcontent {
            text
        } ? ,
        element listdata {
            text
        } ? ,
        element listpage {
            text
        } ?
    }
}

e_delimitedblock = element delimitedblock {
    c_everything*
}

e_delimited = element delimited {
    c_inline
}

e_subsentence = element subsentence {
    c_inline
}

e_float = element float {
    element floatcaption {
        element floatlabel {
            text
        } ,
        element floatnumber {
            text
        } ,
        element floattext {
            c_inline
        }
    } ,
    element floatcontent {
        c_inline
    }
}

e_image = element image {
    empty
}

e_mpgraphic = element mpgraphic {
    empty
}

e_formula = element formula {
    element subformula {
        element formulacontent {
            e_math*
        }
    } ,
    element formulaset {
        element formulacontent {
            e_math*
        }
    } ,
    element formulacaption {
        element formulalabel {
            text
        } ,
        element formulanumber {
            text
        }
    } ,
    element formulacontent {
        e_math*
    }
}

e_link = element link {
    c_inline
}

e_margintextblock = element margintextblock {
    c_inline
}

e_margintext = element margintext {
    c_inline
}

e_quantity = element quantity {
    element unit {
        text
    } ,
    element number {
        text
    }
}

e_unit = element unit {
    text |
    e_math
}

e_sub = element sub {
    c_inline
}

e_sup = element sup {
    c_inline
}

e_subsup = element subsup {
    c_inline,
    c_inline
}

# There are enough mathml dtd's out there so this is just a
# simplified placeholder.

e_math_basics =
    element m:mn | m:mi | m:mo | m:ms | m:merror | m:mtext {
        text
    } |
    element m:mrow | m:msub | m:msup | m:msqrt | m:mfenced | m:maction {
        e_math_basics *
    } |
    element m:msubsup | m:munder | m:mover | m:mfrac | m:mroot {
        e_math_basics,
        e_math_basics
    } |
    element m:munderover {
        e_math_basics,
        e_math_basics,
        e_math_basics
    } |
    element m:mtable {
        element m:mtr {
            element m:mtd {
                e_math_basics *
            } *
        } *
    }

e_math = element m:math {
    e_math_basics *
}