RelaxNG/publidoc.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
jeu., 24 mai 2012 16:43:58 +0200
changeset 105 ce5c5b08cb94
parent 104 2db7cb9721c0
child 109 78dceeeda33a
permissions -rw-r--r--
Ajout de smil
patrick@0
     1
# $Id$
patrick@0
     2
patrick@0
     3
start = publidoc
patrick@0
     4
patrick@0
     5
patrick@0
     6
publidoc = element publidoc {
patrick@0
     7
   publidoc.attributes,
patrick@0
     8
   publidoc.content
patrick@0
     9
}
patrick@0
    10
patrick@0
    11
publidoc.attributes =
patrick@0
    12
   version.attribute
patrick@0
    13
version.attribute = attribute version { "1.0" }
patrick@0
    14
patrick@0
    15
publidoc.content =
patrick@0
    16
   document
patrick@0
    17
 | top.topic
patrick@0
    18
patrick@0
    19
patrick@0
    20
# =============================================================================
patrick@20
    21
#                                  TOP LEVEL
patrick@0
    22
# =============================================================================
patrick@0
    23
patrick@98
    24
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
    25
patrick@90
    26
top.head = element head { top.head.content }
patrick@90
    27
patrick@90
    28
top.head.content =
patrick@90
    29
   (title, subtitle?)?
patrick@90
    30
 & identifier*
patrick@90
    31
 & copyright?
patrick@90
    32
 & contributors?
patrick@90
    33
 & date?
patrick@90
    34
 & place?
patrick@90
    35
 & source*
patrick@90
    36
 & keywordset?
patrick@90
    37
 & subjectset?
patrick@90
    38
 & abstract?
patrick@90
    39
 & cover?
patrick@90
    40
 & annotation*
patrick@90
    41
patrick@0
    42
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    43
patrick@90
    44
# ~~~~~~ document
patrick@0
    45
document = element document { document.attributes, document.content }
patrick@0
    46
patrick@0
    47
document.attributes =
patrick@0
    48
   document.id.attribute
patrick@66
    49
 & lang.attribute?
patrick@0
    50
document.id.attribute = attribute xml:id { xsd:ID }
patrick@66
    51
lang.attribute = attribute xml:lang { xsd:language }
patrick@0
    52
patrick@0
    53
document.content =
patrick@20
    54
   top.head?,
patrick@56
    55
   (division | topic)+
patrick@0
    56
patrick@0
    57
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    58
patrick@18
    59
top.topic = element topic { top.topic.attributes, top.topic.content }
patrick@0
    60
patrick@20
    61
top.topic.attributes =
patrick@20
    62
   topic.id.attribute
patrick@20
    63
 & topic.type.attribute?
patrick@66
    64
 & lang.attribute?
patrick@20
    65
topic.id.attribute = attribute xml:id { xsd:ID }
patrick@20
    66
topic.type.attribute = attribute type { xsd:NCName }
patrick@20
    67
patrick@20
    68
top.topic.content =
patrick@20
    69
   top.head?,
patrick@20
    70
   section+
patrick@0
    71
patrick@40
    72
patrick@0
    73
# =============================================================================
patrick@20
    74
#                                 DIVISION LEVEL
patrick@0
    75
# =============================================================================
patrick@0
    76
patrick@70
    77
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    78
patrick@90
    79
# ~~~~~~ division
patrick@0
    80
division = element division { division.content }
patrick@0
    81
patrick@0
    82
division.content =
patrick@20
    83
   division.head?,
patrick@56
    84
   (division | topic)+
patrick@0
    85
patrick@90
    86
# ~~~~~~ division.head
patrick@90
    87
division.head = element head { division.head.content }
patrick@90
    88
patrick@90
    89
division.head.content =
patrick@90
    90
   (title, subtitle?)?
patrick@90
    91
 & abstract?
patrick@90
    92
 & annotation*
patrick@90
    93
patrick@0
    94
patrick@0
    95
# =============================================================================
patrick@90
    96
#                                COMPONENT LEVEL
patrick@0
    97
# =============================================================================
patrick@0
    98
patrick@90
    99
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ component.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   100
patrick@90
   101
component.head = element head { component.head.content }
patrick@90
   102
patrick@90
   103
component.head.content =
patrick@90
   104
   (title, subtitle?)?
patrick@90
   105
 & contributors?
patrick@90
   106
 & abstract?
patrick@90
   107
 & annotation*
patrick@90
   108
patrick@0
   109
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   110
patrick@0
   111
topic = element topic { topic.attributes, topic.content }
patrick@0
   112
patrick@0
   113
topic.attributes =
patrick@0
   114
   topic.id.attribute?
patrick@0
   115
 & topic.type.attribute?
patrick@69
   116
 & lang.attribute?
patrick@0
   117
patrick@0
   118
topic.content =
patrick@20
   119
   component.head?,
patrick@0
   120
   section+
patrick@0
   121
patrick@0
   122
patrick@0
   123
# =============================================================================
patrick@20
   124
#                                 SECTION LEVEL
patrick@0
   125
# =============================================================================
patrick@0
   126
patrick@20
   127
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   128
patrick@90
   129
# ~~~~~~ section
patrick@58
   130
section = element section { section.attributes, section.content }
patrick@58
   131
patrick@58
   132
section.attributes =
patrick@58
   133
   section.type.attribute?
patrick@64
   134
 & lang.attribute?
patrick@58
   135
section.type.attribute = attribute type { xsd:NCName }
patrick@0
   136
patrick@0
   137
section.content =
patrick@20
   138
   section.head?,
patrick@9
   139
   (section+ | block+)
patrick@0
   140
patrick@90
   141
# ~~~~~~ section.head
patrick@90
   142
section.head = element head { section.head.content }
patrick@90
   143
patrick@90
   144
section.head.content =
patrick@90
   145
   (title, subtitle?)?
patrick@90
   146
 & abstract?
patrick@105
   147
 & audio*
patrick@90
   148
 & annotation*
patrick@90
   149
patrick@0
   150
patrick@0
   151
# =============================================================================
patrick@20
   152
#                                 BLOCK LEVEL
patrick@0
   153
# =============================================================================
patrick@0
   154
patrick@20
   155
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   156
patrick@90
   157
# ~~~~~~ block
patrick@44
   158
block = (p | speech | \list | blockquote | table | media)
patrick@9
   159
patrick@90
   160
# ~~~~~~ block.head
patrick@90
   161
block.head = element head { block.head.content }
patrick@90
   162
patrick@90
   163
block.head.content =
patrick@90
   164
   (title, subtitle?)?
patrick@90
   165
patrick@42
   166
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   167
patrick@20
   168
p = element p { p.content }
patrick@0
   169
patrick@20
   170
p.content =
patrick@0
   171
   inlines
patrick@0
   172
patrick@18
   173
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@18
   174
patrick@18
   175
# ~~~~~~ speech
patrick@18
   176
speech = element speech { speech.content }
patrick@18
   177
patrick@18
   178
speech.content =
patrick@18
   179
   speaker?,
patrick@18
   180
   stage?,
patrick@20
   181
   p+
patrick@18
   182
patrick@18
   183
# ~~~~~~ speaker
patrick@18
   184
speaker = element speaker { speaker.content }
patrick@18
   185
patrick@18
   186
speaker.content = inlines
patrick@18
   187
patrick@18
   188
# ~~~~~~ stage
patrick@18
   189
stage = element stage { stage.content }
patrick@18
   190
patrick@18
   191
stage.content = inlines
patrick@18
   192
patrick@17
   193
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   194
patrick@9
   195
# ~~~~~~ list
patrick@75
   196
\list = element list {
patrick@20
   197
   block.head?,
patrick@71
   198
   (  (attribute type {"ordered"}?, item, item+)
patrick@9
   199
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   200
}
patrick@9
   201
patrick@9
   202
# ~~~~~~ item
patrick@9
   203
item = element item { item.content }
patrick@9
   204
patrick@30
   205
item.content =
patrick@73
   206
   inlines
patrick@73
   207
 | block+
patrick@9
   208
patrick@9
   209
# ~~~~~~ glossary.item
patrick@9
   210
glossary.item = element item { glossary.item.content }
patrick@9
   211
patrick@9
   212
glossary.item.content =
patrick@9
   213
   label,
patrick@9
   214
   block+
patrick@9
   215
patrick@44
   216
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@44
   217
patrick@44
   218
# ~~~~~~ blockquote
patrick@44
   219
blockquote = element blockquote { blockquote.content }
patrick@44
   220
patrick@44
   221
blockquote.content =
patrick@44
   222
   block.head?,
patrick@44
   223
   (p | speech | \list)+,
patrick@44
   224
   attribution?
patrick@44
   225
patrick@44
   226
# ~~~~~~ attribution
patrick@72
   227
attribution = element attribution { attribution.content }
patrick@44
   228
patrick@72
   229
attribution.content =
patrick@44
   230
   inlines
patrick@44
   231
patrick@17
   232
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@17
   233
patrick@73
   234
# ~~~~~~ table
patrick@17
   235
table = element table { table.content }
patrick@17
   236
patrick@17
   237
table.content =
patrick@20
   238
   block.head?,
patrick@17
   239
   tgroup+,
patrick@17
   240
   caption?
patrick@17
   241
patrick@17
   242
# ~~~~~~ tgroup
patrick@17
   243
tgroup = element tgroup { tgroup.attributes, tgroup.content }
patrick@17
   244
patrick@17
   245
tgroup.content =
patrick@17
   246
   thead?,
patrick@17
   247
   tfoot?,
patrick@17
   248
   tbody
patrick@17
   249
patrick@17
   250
tgroup.attributes =
patrick@17
   251
   cols.attribute
patrick@17
   252
 & align.attribute?
patrick@17
   253
 & colsep.attribute?
patrick@17
   254
 & rowsep.attribute?
patrick@17
   255
cols.attribute = attribute cols { xsd:positiveInteger }
patrick@17
   256
align.attribute = attribute align { "left"  |  "right"  | "center" | "justify" }
patrick@17
   257
colsep.attribute = attribute colsep { "0" | "1" }
patrick@17
   258
rowsep.attribute = attribute rowsep { "0" | "1" }
patrick@17
   259
patrick@17
   260
# ~~~~~~ thead, tfoot, tbody
patrick@22
   261
thead = element thead { thead.attributes, thead.content }
patrick@22
   262
tfoot = element tfoot { tfoot.attributes, tfoot.content }
patrick@22
   263
tbody = element tbody { tbody.attributes, tbody.content }
patrick@17
   264
patrick@22
   265
thead.attributes =
patrick@22
   266
   valign.attribute?
patrick@22
   267
tfoot.attributes =
patrick@22
   268
   valign.attribute?
patrick@22
   269
tbody.attributes =
patrick@22
   270
   valign.attribute?
patrick@22
   271
valign.attribute = attribute valign { "top" | "middle" | "bottom" }
patrick@75
   272
patrick@17
   273
thead.content =
patrick@17
   274
   row+
patrick@17
   275
tfoot.content =
patrick@17
   276
   row+
patrick@17
   277
tbody.content =
patrick@17
   278
   row+
patrick@17
   279
patrick@17
   280
# ~~~~~~ row
patrick@17
   281
row = element row { row.attribute, row.content }
patrick@17
   282
patrick@17
   283
row.attribute =
patrick@17
   284
   valign.attribute?
patrick@17
   285
patrick@17
   286
row.content =
patrick@17
   287
  entry+
patrick@17
   288
patrick@17
   289
# ~~~~~~ entry
patrick@17
   290
entry = element entry { entry.content }
patrick@17
   291
patrick@17
   292
entry.content =
patrick@17
   293
   inlines
patrick@37
   294
 | (p | media)+
patrick@17
   295
patrick@17
   296
# ~~~~~~ caption
patrick@17
   297
caption = element caption { caption.content }
patrick@17
   298
patrick@17
   299
caption.content =
patrick@20
   300
   inlines
patrick@20
   301
 | p+
patrick@17
   302
patrick@35
   303
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   304
patrick@2
   305
# ~~~~~~ media
patrick@0
   306
media = element media { media.content }
patrick@0
   307
patrick@0
   308
media.content =
patrick@24
   309
   block.head?,
patrick@45
   310
   (image | audio)+,
patrick@35
   311
   caption?,
patrick@36
   312
   link?
patrick@0
   313
patrick@2
   314
# ~~~~~~ image
patrick@0
   315
image = element image { image.attributes, image.content }
patrick@0
   316
patrick@0
   317
image.attributes =
patrick@104
   318
   media.id.attribute
patrick@104
   319
 & image.type?
patrick@17
   320
media.id.attribute = attribute id { xsd:NMTOKEN }
patrick@93
   321
image.type = attribute type { "cover" | "thumbnail" | "icon" }
patrick@0
   322
patrick@0
   323
image.content =
patrick@0
   324
   copyright?
patrick@0
   325
patrick@45
   326
# ~~~~~~ audio
patrick@45
   327
audio = element audio { audio.attributes }
patrick@43
   328
patrick@45
   329
audio.attributes =
patrick@43
   330
   media.id.attribute
patrick@104
   331
 & audio.type?
patrick@105
   332
audio.type = attribute type { "music" | "voice" | "ambiance" | "smil" }
patrick@43
   333
patrick@0
   334
patrick@0
   335
# =============================================================================
patrick@90
   336
#                                 HEAD LEVEL
patrick@90
   337
# =============================================================================
patrick@90
   338
patrick@90
   339
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   340
patrick@90
   341
title = element title { title.content }
patrick@90
   342
subtitle = element subtitle { title.content }
patrick@90
   343
patrick@90
   344
title.content = inlines
patrick@90
   345
patrick@90
   346
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   347
patrick@90
   348
identifier.uri = element identifier {
patrick@90
   349
   attribute type { "uri" }, xsd:anyURI
patrick@90
   350
}
patrick@90
   351
patrick@90
   352
identifier.ean = element identifier {
patrick@90
   353
   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
patrick@90
   354
}
patrick@90
   355
patrick@90
   356
identifier = identifier.uri | identifier.ean
patrick@90
   357
patrick@90
   358
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   359
patrick@90
   360
copyright = element copyright { copyright.content }
patrick@90
   361
patrick@90
   362
copyright.content = inlines
patrick@90
   363
patrick@90
   364
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   365
patrick@90
   366
# ~~~~~~ contributors
patrick@90
   367
contributors = element contributors { contributors.content }
patrick@90
   368
patrick@90
   369
contributors.content =
patrick@90
   370
   contributor+
patrick@90
   371
patrick@90
   372
# ~~~~~~ contributor
patrick@90
   373
contributor = element contributor { contributor.content }
patrick@90
   374
patrick@90
   375
contributor.content =
patrick@90
   376
   (((firstname, secondname?)?, lastname) | label),
patrick@90
   377
   address?,
patrick@90
   378
   link?,
patrick@101
   379
   role+
patrick@90
   380
patrick@90
   381
# ~~~~~~ firstname, secondname, lastname, label
patrick@90
   382
firstname = element firstname { firstname.content }
patrick@90
   383
secondname = element secondname { secondname.content }
patrick@90
   384
lastname = element lastname { lastname.content }
patrick@90
   385
label = element label { label.content }
patrick@90
   386
patrick@90
   387
firstname.content = inlines
patrick@90
   388
secondname.content = inlines
patrick@90
   389
lastname.content = inlines
patrick@90
   390
label.content = inlines
patrick@90
   391
patrick@90
   392
# ~~~~~~ address
patrick@90
   393
address = element address { address.content }
patrick@90
   394
patrick@90
   395
address.content = inlines
patrick@90
   396
patrick@90
   397
# ~~~~~~ role
patrick@90
   398
role = element role { role.content }
patrick@90
   399
patrick@90
   400
role.content = "author" | "illustrator" | "publisher" | "packager"
patrick@90
   401
patrick@90
   402
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   403
patrick@90
   404
place = element place { place.content }
patrick@90
   405
patrick@90
   406
place.content = inlines
patrick@90
   407
patrick@90
   408
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   409
patrick@90
   410
# ~~~~~~ source
patrick@90
   411
source = element source {
patrick@90
   412
   (  (attribute type { "book" }, source.content.book)
patrick@90
   413
    | (attribute type { "file" }, source.content.file)),
patrick@90
   414
   source.content
patrick@90
   415
}
patrick@90
   416
patrick@90
   417
source.content.book =
patrick@90
   418
   identifier.ean,
patrick@90
   419
   title?,
patrick@90
   420
   pagenumber*
patrick@90
   421
source.content.file =
patrick@90
   422
   identifier.uri
patrick@90
   423
source.content =
patrick@90
   424
   annotation*
patrick@90
   425
patrick@90
   426
# ~~~~~~ pagenumber
patrick@90
   427
pagenumber = element pagenumber { pagenumber.content }
patrick@90
   428
patrick@90
   429
pagenumber.content = xsd:positiveInteger
patrick@90
   430
patrick@90
   431
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   432
patrick@90
   433
# ~~~~~~ keywordset
patrick@90
   434
keywordset = element keywordset { keywordset.content }
patrick@90
   435
patrick@90
   436
keywordset.content = keyword+
patrick@90
   437
patrick@90
   438
# ~~~~~~ keyword
patrick@90
   439
keyword = element keyword { keyword.content }
patrick@90
   440
patrick@90
   441
keyword.content = mixed { sup*, sub* }
patrick@90
   442
patrick@90
   443
# ~~~~~~ subjectset
patrick@90
   444
subjectset = element subjectset { subjectset.content }
patrick@90
   445
patrick@90
   446
subjectset.content = subject+
patrick@90
   447
patrick@90
   448
# ~~~~~~ subject
patrick@90
   449
subject = element subject { subject.attributes }
patrick@90
   450
patrick@90
   451
subject.attributes =
patrick@90
   452
   subject.id.attribute
patrick@90
   453
subject.id.attribute = attribute id { xsd:NMTOKEN }
patrick@90
   454
patrick@90
   455
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   456
patrick@90
   457
abstract = element abstract { abstract.content }
patrick@90
   458
patrick@90
   459
abstract.content =
patrick@90
   460
   p+
patrick@90
   461
patrick@90
   462
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   463
patrick@90
   464
cover = element cover { cover.content }
patrick@90
   465
patrick@90
   466
cover.content =
patrick@90
   467
   cover.image
patrick@90
   468
patrick@90
   469
cover.image = element image { cover.image.attributes }
patrick@90
   470
patrick@90
   471
cover.image.attributes =
patrick@90
   472
   cover.image.id.attribute
patrick@90
   473
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
patrick@105
   474
   
patrick@90
   475
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   476
patrick@90
   477
annotation = element annotation { annotation.content }
patrick@90
   478
patrick@90
   479
annotation.content = inlines
patrick@90
   480
patrick@90
   481
patrick@90
   482
# =============================================================================
patrick@20
   483
#                                 INLINE LEVEL
patrick@0
   484
# =============================================================================
patrick@0
   485
patrick@0
   486
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   487
patrick@0
   488
inlines = mixed {
patrick@0
   489
   sup*
patrick@0
   490
 & sub*
patrick@42
   491
 & var*
patrick@13
   492
 & number*
patrick@42
   493
 & math*
patrick@0
   494
 & date*
patrick@0
   495
 & name*
patrick@5
   496
 & note*
patrick@0
   497
 & foreign*
patrick@0
   498
 & highlight*
patrick@5
   499
 & mentioned*
patrick@5
   500
 & quote*
patrick@8
   501
 & acronym*
patrick@8
   502
 & term*
patrick@25
   503
 & link*
patrick@42
   504
 & anchor*
patrick@91
   505
 & initial*
patrick@93
   506
 & image*
patrick@105
   507
 & smil*
patrick@0
   508
}
patrick@0
   509
patrick@42
   510
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   511
patrick@42
   512
sup = element sup { text }
patrick@0
   513
patrick@42
   514
sub = element sub { text }
patrick@42
   515
patrick@42
   516
var = element var { text }
patrick@42
   517
patrick@90
   518
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   519
patrick@90
   520
number = element number {
patrick@90
   521
   ( attribute type {"roman"}, number.attributes, number.roman.content )
patrick@90
   522
 | ( number.attributes, number.content)
patrick@90
   523
}
patrick@90
   524
patrick@90
   525
number.attributes =
patrick@90
   526
   number.value.attribute?
patrick@90
   527
number.value.attribute = attribute value { xsd:integer | xsd:decimal }
patrick@90
   528
patrick@90
   529
number.content = mixed { sup* }
patrick@90
   530
number.roman.content = xsd:token {pattern = "[dlxvi]+"}
patrick@90
   531
patrick@42
   532
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   533
patrick@42
   534
math = element math {
patrick@42
   535
   ( attribute notation {"tex"}, math.attributes, math.tex.content )
patrick@42
   536
 | ( math.attributes, math.content)
patrick@42
   537
}
patrick@42
   538
patrick@42
   539
math.attributes =
patrick@42
   540
   wide.attribute?
patrick@42
   541
wide.attribute = attribute wide { xsd:boolean }
patrick@42
   542
patrick@42
   543
math.content = mixed { sup* & sub* & var* }
patrick@42
   544
math.tex.content = text
patrick@0
   545
patrick@36
   546
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   547
patrick@0
   548
date = element date { date.attributes, date.content }
patrick@0
   549
patrick@3
   550
date.attributes =
patrick@13
   551
   date.value.attribute
patrick@13
   552
 & date.of.attribute?
patrick@13
   553
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
patrick@33
   554
date.of.attribute = attribute of { "birth" | "death" }
patrick@0
   555
patrick@13
   556
date.content = mixed { sup* }
patrick@0
   557
patrick@36
   558
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   559
patrick@0
   560
name = element name { name.attributes, name.content }
patrick@2
   561
patrick@2
   562
name.attributes =
patrick@2
   563
   name.of.attribute?
patrick@33
   564
name.of.attribute = attribute of
patrick@33
   565
   { "person" | "company" | "book" | "newspaper" | "party" }
patrick@0
   566
patrick@2
   567
name.content = inlines
patrick@2
   568
patrick@36
   569
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   570
patrick@5
   571
note = element note { note.attributes, note.content }
patrick@0
   572
patrick@5
   573
note.attributes =
patrick@5
   574
   note.label.attribute?
patrick@5
   575
note.label.attribute = attribute label { text }
patrick@0
   576
patrick@5
   577
note.content =
patrick@91
   578
   (w, p+) | inlines
patrick@91
   579
patrick@91
   580
w = element w { inlines }
patrick@0
   581
patrick@36
   582
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   583
patrick@0
   584
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   585
patrick@9
   586
foreign.attributes =
patrick@9
   587
   lang.attribute?
patrick@0
   588
patrick@0
   589
foreign.content = inlines
patrick@0
   590
patrick@36
   591
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   592
patrick@0
   593
highlight = element highlight { highlight.content }
patrick@0
   594
patrick@0
   595
highlight.content = inlines
patrick@0
   596
patrick@36
   597
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   598
patrick@5
   599
mentioned = element mentioned { mentioned.content }
patrick@5
   600
patrick@5
   601
mentioned.content = inlines
patrick@5
   602
patrick@36
   603
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   604
patrick@5
   605
quote = element quote { quote.content }
patrick@5
   606
patrick@5
   607
quote.content = inlines
patrick@5
   608
patrick@36
   609
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   610
patrick@8
   611
acronym = element acronym { acronym.content }
patrick@8
   612
patrick@8
   613
acronym.content = inlines
patrick@8
   614
patrick@36
   615
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   616
patrick@8
   617
term = element term { term.content }
patrick@8
   618
patrick@8
   619
term.content = inlines
patrick@8
   620
patrick@36
   621
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   622
patrick@0
   623
link = element link { link.attributes, link.content }
patrick@0
   624
patrick@9
   625
link.attributes =
patrick@42
   626
   (uri.attribute | idref.attribute)
patrick@9
   627
uri.attribute = attribute uri { xsd:anyURI }
patrick@9
   628
idref.attribute = attribute idref { xsd:IDREF }
patrick@0
   629
patrick@0
   630
link.content = inlines
patrick@42
   631
patrick@42
   632
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   633
patrick@43
   634
anchor = element anchor { anchor.attributes }
patrick@42
   635
patrick@42
   636
anchor.attributes =
patrick@42
   637
   anchor.id.attribute
patrick@42
   638
anchor.id.attribute = attribute xml:id { xsd:ID }
patrick@91
   639
patrick@91
   640
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ initial ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@91
   641
patrick@91
   642
initial = element initial { initial.content }
patrick@91
   643
patrick@91
   644
initial.content =
patrick@91
   645
   c,
patrick@91
   646
   w?
patrick@91
   647
patrick@91
   648
c = element c { text }
patrick@105
   649
patrick@105
   650
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@105
   651
patrick@105
   652
smil = element smil { smil.attributes, smil.content }
patrick@105
   653
patrick@105
   654
smil.attributes =
patrick@105
   655
   begin.attribute?
patrick@105
   656
 & end.attribute?
patrick@105
   657
begin.attribute = attribute begin { xsd:decimal }
patrick@105
   658
end.attribute = attribute end { xsd:decimal }
patrick@105
   659
patrick@105
   660
smil.content = inlines