export-example.rng /size: 6578 b    last modification: 2020-07-01 14:35
1# author    : Hans Hagen, PRAGMA-ADE, Hasselt NL
2# copyright : PRAGMA ADE / ConTeXt Development Team
3# license   : see context related readme files
4# comment   : companion to context.mkiv
5
6# todo: check all content (not yet ok but a bit boring job)
7# todo: add attributes
8# todo: we need more | and less ,
9#
10# validate with "rnv -c export-example.rng"
11
12namespace m = "http://www.w3.org/1998/Math/MathML"
13
14start = e_document
15
16# Because users can typeset anything the content is somewhat
17# unpredictable so this is just an indication of what to expect.
18
19c_everything =
20    text
21  | c_inline
22  | e_verbatimblock
23  | e_lines
24  | e_itemgroup
25  | e_table
26  | e_tabulate
27  | e_register
28  | e_list
29  | e_section
30  | e_float
31  | e_formula
32  | e_combination
33
34c_inline =
35    text
36  | e_ignore
37  | e_metadata
38  | e_construct
39  | e_highlight
40  | e_verbatim
41  | e_description
42  | e_descriptionsymbol
43  | e_sorting
44  | e_synonym
45  | e_image
46  | e_mpgraphic
47  | e_math
48  | e_sub
49  | e_sup
50  | e_subsup
51  | e_link
52  | e_margintext
53  | e_margintextblock
54
55# We pass some relevant information via attributes. The detail attribute
56# is common and provides information about the class or environment used.
57
58a_detail = attribute detail {
59    text
60}
61
62# The document element is the root of all.
63
64e_document = element document {
65    c_everything *
66}
67
68e_ignore = element ignore {
69    c_everything *
70}
71
72e_metadata = element metadata {
73    element metavariable {
74        attribute name { text } ?
75      , text
76    } *
77}
78
79e_section = element section {
80    a_detail ?
81  | (
82        element sectiontitle {
83            c_inline *
84        }
85      , element sectionnumber {
86            c_inline *
87        } *
88      , element sectioncontent {
89            c_everything *
90        }
91    )
92}
93
94e_paragraph = element paragraph {
95    c_inline *
96}
97
98e_p = element p {
99    c_inline *
100}
101
102e_break = element break {
103    empty
104}
105
106e_construct = element construct {
107    c_everything*
108}
109
110e_highlight = element highlight {
111    c_inline*
112}
113
114e_itemgroup = element itemgroup {
115    element item {
116        element itemtag {
117            c_inline *
118        }
119    } ,
120    element itemcontent {
121        c_everything *
122    }
123}
124
125e_combination = element combination {
126    element combinationpair {
127        element combinationcontent {
128            inline*
129        } ,
130        element combinationcaption {
131            inline*
132        }
133    }
134}
135
136e_description = element description {
137    element descriptiontag     {
138        c_inline*
139    } ,
140    element descriptioncontent {
141        c_inline*
142    } ,
143    element descriptionsymbol  {
144        c_inline*
145    }
146}
147
148e_descriptionsymbol = element descriptionsymbol {
149    c_inline*
150}
151
152e_verbatimblock = element verbatimblock {
153    element verbatimlines {
154        element verbatimline {
155            text
156        } *
157    } *
158}
159
160e_verbatim = element verbatim {
161    text
162}
163
164e_lines = element lines {
165    element line {
166        text
167    } *
168}
169
170e_synonym = element synonym {
171    text
172}
173
174e_sorting = element sorting {
175    text
176}
177
178e_register = element register {
179    element registersection {
180        element registertag {
181            text
182        } ?
183        ,
184        element registerentries {
185            (
186                element registerentry {
187                    text
188                } |
189                element registersee  {
190                    text
191                }
192            ),
193            (
194                element registerpages {
195                    element registerpage {
196                        text
197                    } *
198                } |
199                element registerpage {
200                    text
201                } |
202                element registerpagerange {
203                    element registerpage {
204                        text
205                    } ,
206                    element registerpage {
207                        text
208                    }
209                }
210            )
211        } ?
212    } *
213}
214
215e_table = element table {
216    element tablerow {
217        element tablecell {
218            c_inline *
219        } *
220    } *
221}
222
223e_tabulate = element tabulate {
224    element tabulaterow {
225        element tabulatecell {
226            c_inline *
227        } *
228    } *
229}
230
231e_list = element list {
232    element listitem {
233        element listtag {
234            text
235        } ? ,
236        element listcontent {
237            text
238        } ? ,
239        element listdata {
240            text
241        } ? ,
242        element listpage {
243            text
244        } ?
245    }
246}
247
248e_delimitedblock = element delimitedblock {
249    c_everything*
250}
251
252e_delimited = element delimited {
253    c_inline
254}
255
256e_subsentence = element subsentence {
257    c_inline
258}
259
260e_float = element float {
261    element floatcaption {
262        element floatlabel {
263            text
264        } ,
265        element floatnumber {
266            text
267        } ,
268        element floattext {
269            c_inline
270        }
271    } ,
272    element floatcontent {
273        c_inline
274    }
275}
276
277e_image = element image {
278    empty
279}
280
281e_mpgraphic = element mpgraphic {
282    empty
283}
284
285e_formula = element formula {
286    element subformula {
287        element formulacontent {
288            e_math*
289        }
290    } ,
291    element formulaset {
292        element formulacontent {
293            e_math*
294        }
295    } ,
296    element formulacaption {
297        element formulalabel {
298            text
299        } ,
300        element formulanumber {
301            text
302        }
303    } ,
304    element formulacontent {
305        e_math*
306    }
307}
308
309e_link = element link {
310    c_inline
311}
312
313e_margintextblock = element margintextblock {
314    c_inline
315}
316
317e_margintext = element margintext {
318    c_inline
319}
320
321e_quantity = element quantity {
322    element unit {
323        text
324    } ,
325    element number {
326        text
327    }
328}
329
330e_unit = element unit {
331    text |
332    e_math
333}
334
335e_sub = element sub {
336    c_inline
337}
338
339e_sup = element sup {
340    c_inline
341}
342
343e_subsup = element subsup {
344    c_inline,
345    c_inline
346}
347
348# There are enough mathml dtd's out there so this is just a
349# simplified placeholder.
350
351e_math_basics =
352    element m:mn | m:mi | m:mo | m:ms | m:merror | m:mtext {
353        text
354    } |
355    element m:mrow | m:msub | m:msup | m:msqrt | m:mfenced | m:maction {
356        e_math_basics *
357    } |
358    element m:msubsup | m:munder | m:mover | m:mfrac | m:mroot {
359        e_math_basics,
360        e_math_basics
361    } |
362    element m:munderover {
363        e_math_basics,
364        e_math_basics,
365        e_math_basics
366    } |
367    element m:mtable {
368        element m:mtr {
369            element m:mtd {
370                e_math_basics *
371            } *
372        } *
373    }
374
375e_math = element m:math {
376    e_math_basics *
377}
378