RelaxNG/publidoc.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
dim., 17 juin 2012 19:55:34 +0200
changeset 121 f3e221b25f64
parent 120 01d4b1ac09af
child 122 a0b8294a5a99
permissions -rw-r--r--
Augmentation de la précision du positionnement
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@117
    50
document.id.attribute = attribute id { xsd:NMTOKEN }
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@117
    65
topic.id.attribute = attribute id { xsd:NMTOKEN }
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@118
   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@109
   240
   table.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@109
   296
# ~~~~~~ table.caption
patrick@109
   297
table.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@119
   310
   (image | audio | video)+,
patrick@109
   311
   media.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@111
   321
image.type = attribute type { "thumbnail" | "icon" }
patrick@0
   322
patrick@0
   323
image.content =
patrick@111
   324
   copyright?,
patrick@111
   325
   tooltip*
patrick@0
   326
patrick@45
   327
# ~~~~~~ audio
patrick@45
   328
audio = element audio { audio.attributes }
patrick@43
   329
patrick@45
   330
audio.attributes =
patrick@43
   331
   media.id.attribute
patrick@104
   332
 & audio.type?
patrick@113
   333
audio.type = attribute type { "music" | "voice" | "background" | "smil" }
patrick@43
   334
patrick@119
   335
# ~~~~~~ video
patrick@119
   336
video = element video { video.attributes }
patrick@119
   337
patrick@119
   338
video.attributes =
patrick@119
   339
   media.id.attribute
patrick@119
   340
patrick@109
   341
# ~~~~~~ tooltip
patrick@109
   342
patrick@109
   343
tooltip = element tooltip { tooltip.attributes, tooltip.content }
patrick@109
   344
patrick@109
   345
tooltip.attributes =
patrick@109
   346
   x.attribute
patrick@109
   347
 & y.attribute
patrick@109
   348
 & dx.attribute?
patrick@109
   349
 & dy.attribute?
patrick@120
   350
x.attribute = attribute x { xsd:token {pattern = "\d{1,2}(\.\d)?%"} }
patrick@120
   351
y.attribute = attribute y { xsd:token {pattern = "\d{1,2}(\.\d)?%"} }
patrick@120
   352
dx.attribute = attribute dx { xsd:token {pattern = "-?\d{1,2}(\.\d)?"} }
patrick@120
   353
dy.attribute = attribute dy { xsd:token {pattern = "-?\d{1,2}(\.\d)?"} }
patrick@109
   354
patrick@109
   355
tooltip.content =
patrick@109
   356
   (p | image)+
patrick@109
   357
   
patrick@109
   358
# ~~~~~~ media.caption
patrick@109
   359
media.caption = element caption { caption.attributes, caption.content }
patrick@109
   360
patrick@109
   361
caption.attributes =
patrick@109
   362
   x.attribute?
patrick@109
   363
 & y.attribute?
patrick@109
   364
patrick@0
   365
patrick@0
   366
# =============================================================================
patrick@90
   367
#                                 HEAD LEVEL
patrick@90
   368
# =============================================================================
patrick@90
   369
patrick@90
   370
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   371
patrick@90
   372
title = element title { title.content }
patrick@90
   373
subtitle = element subtitle { title.content }
patrick@90
   374
patrick@90
   375
title.content = inlines
patrick@90
   376
patrick@90
   377
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   378
patrick@90
   379
identifier.uri = element identifier {
patrick@90
   380
   attribute type { "uri" }, xsd:anyURI
patrick@90
   381
}
patrick@90
   382
patrick@90
   383
identifier.ean = element identifier {
patrick@90
   384
   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
patrick@90
   385
}
patrick@90
   386
patrick@90
   387
identifier = identifier.uri | identifier.ean
patrick@90
   388
patrick@90
   389
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   390
patrick@90
   391
copyright = element copyright { copyright.content }
patrick@90
   392
patrick@90
   393
copyright.content = inlines
patrick@90
   394
patrick@90
   395
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   396
patrick@90
   397
# ~~~~~~ contributors
patrick@90
   398
contributors = element contributors { contributors.content }
patrick@90
   399
patrick@90
   400
contributors.content =
patrick@90
   401
   contributor+
patrick@90
   402
patrick@90
   403
# ~~~~~~ contributor
patrick@90
   404
contributor = element contributor { contributor.content }
patrick@90
   405
patrick@90
   406
contributor.content =
patrick@90
   407
   (((firstname, secondname?)?, lastname) | label),
patrick@90
   408
   address?,
patrick@90
   409
   link?,
patrick@101
   410
   role+
patrick@90
   411
patrick@90
   412
# ~~~~~~ firstname, secondname, lastname, label
patrick@90
   413
firstname = element firstname { firstname.content }
patrick@90
   414
secondname = element secondname { secondname.content }
patrick@90
   415
lastname = element lastname { lastname.content }
patrick@90
   416
label = element label { label.content }
patrick@90
   417
patrick@90
   418
firstname.content = inlines
patrick@90
   419
secondname.content = inlines
patrick@90
   420
lastname.content = inlines
patrick@90
   421
label.content = inlines
patrick@90
   422
patrick@90
   423
# ~~~~~~ address
patrick@90
   424
address = element address { address.content }
patrick@90
   425
patrick@90
   426
address.content = inlines
patrick@90
   427
patrick@90
   428
# ~~~~~~ role
patrick@90
   429
role = element role { role.content }
patrick@90
   430
patrick@90
   431
role.content = "author" | "illustrator" | "publisher" | "packager"
patrick@90
   432
patrick@90
   433
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   434
patrick@90
   435
place = element place { place.content }
patrick@90
   436
patrick@90
   437
place.content = inlines
patrick@90
   438
patrick@90
   439
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   440
patrick@90
   441
# ~~~~~~ source
patrick@90
   442
source = element source {
patrick@90
   443
   (  (attribute type { "book" }, source.content.book)
patrick@90
   444
    | (attribute type { "file" }, source.content.file)),
patrick@90
   445
   source.content
patrick@90
   446
}
patrick@90
   447
patrick@90
   448
source.content.book =
patrick@90
   449
   identifier.ean,
patrick@90
   450
   title?,
patrick@90
   451
   pagenumber*
patrick@90
   452
source.content.file =
patrick@90
   453
   identifier.uri
patrick@90
   454
source.content =
patrick@90
   455
   annotation*
patrick@90
   456
patrick@90
   457
# ~~~~~~ pagenumber
patrick@90
   458
pagenumber = element pagenumber { pagenumber.content }
patrick@90
   459
patrick@90
   460
pagenumber.content = xsd:positiveInteger
patrick@90
   461
patrick@90
   462
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   463
patrick@90
   464
# ~~~~~~ keywordset
patrick@90
   465
keywordset = element keywordset { keywordset.content }
patrick@90
   466
patrick@90
   467
keywordset.content = keyword+
patrick@90
   468
patrick@90
   469
# ~~~~~~ keyword
patrick@90
   470
keyword = element keyword { keyword.content }
patrick@90
   471
patrick@90
   472
keyword.content = mixed { sup*, sub* }
patrick@90
   473
patrick@90
   474
# ~~~~~~ subjectset
patrick@90
   475
subjectset = element subjectset { subjectset.content }
patrick@90
   476
patrick@90
   477
subjectset.content = subject+
patrick@90
   478
patrick@90
   479
# ~~~~~~ subject
patrick@90
   480
subject = element subject { subject.attributes }
patrick@90
   481
patrick@90
   482
subject.attributes =
patrick@90
   483
   subject.id.attribute
patrick@90
   484
subject.id.attribute = attribute id { xsd:NMTOKEN }
patrick@90
   485
patrick@90
   486
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   487
patrick@90
   488
abstract = element abstract { abstract.content }
patrick@90
   489
patrick@90
   490
abstract.content =
patrick@90
   491
   p+
patrick@90
   492
patrick@90
   493
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   494
patrick@90
   495
cover = element cover { cover.content }
patrick@90
   496
patrick@90
   497
cover.content =
patrick@90
   498
   cover.image
patrick@90
   499
patrick@90
   500
cover.image = element image { cover.image.attributes }
patrick@90
   501
patrick@90
   502
cover.image.attributes =
patrick@90
   503
   cover.image.id.attribute
patrick@90
   504
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
patrick@105
   505
   
patrick@90
   506
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   507
patrick@90
   508
annotation = element annotation { annotation.content }
patrick@90
   509
patrick@90
   510
annotation.content = inlines
patrick@90
   511
patrick@90
   512
patrick@90
   513
# =============================================================================
patrick@20
   514
#                                 INLINE LEVEL
patrick@0
   515
# =============================================================================
patrick@0
   516
patrick@0
   517
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   518
patrick@0
   519
inlines = mixed {
patrick@0
   520
   sup*
patrick@0
   521
 & sub*
patrick@42
   522
 & var*
patrick@13
   523
 & number*
patrick@42
   524
 & math*
patrick@0
   525
 & date*
patrick@0
   526
 & name*
patrick@5
   527
 & note*
patrick@0
   528
 & foreign*
patrick@0
   529
 & highlight*
patrick@5
   530
 & mentioned*
patrick@5
   531
 & quote*
patrick@8
   532
 & acronym*
patrick@8
   533
 & term*
patrick@25
   534
 & link*
patrick@42
   535
 & anchor*
patrick@91
   536
 & initial*
patrick@93
   537
 & image*
patrick@105
   538
 & smil*
patrick@0
   539
}
patrick@0
   540
patrick@42
   541
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   542
patrick@42
   543
sup = element sup { text }
patrick@0
   544
patrick@42
   545
sub = element sub { text }
patrick@42
   546
patrick@42
   547
var = element var { text }
patrick@42
   548
patrick@90
   549
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   550
patrick@90
   551
number = element number {
patrick@90
   552
   ( attribute type {"roman"}, number.attributes, number.roman.content )
patrick@90
   553
 | ( number.attributes, number.content)
patrick@90
   554
}
patrick@90
   555
patrick@90
   556
number.attributes =
patrick@90
   557
   number.value.attribute?
patrick@90
   558
number.value.attribute = attribute value { xsd:integer | xsd:decimal }
patrick@90
   559
patrick@90
   560
number.content = mixed { sup* }
patrick@90
   561
number.roman.content = xsd:token {pattern = "[dlxvi]+"}
patrick@90
   562
patrick@42
   563
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   564
patrick@42
   565
math = element math {
patrick@42
   566
   ( attribute notation {"tex"}, math.attributes, math.tex.content )
patrick@42
   567
 | ( math.attributes, math.content)
patrick@42
   568
}
patrick@42
   569
patrick@42
   570
math.attributes =
patrick@42
   571
   wide.attribute?
patrick@42
   572
wide.attribute = attribute wide { xsd:boolean }
patrick@42
   573
patrick@42
   574
math.content = mixed { sup* & sub* & var* }
patrick@42
   575
math.tex.content = text
patrick@0
   576
patrick@36
   577
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   578
patrick@0
   579
date = element date { date.attributes, date.content }
patrick@0
   580
patrick@3
   581
date.attributes =
patrick@13
   582
   date.value.attribute
patrick@13
   583
 & date.of.attribute?
patrick@13
   584
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
patrick@33
   585
date.of.attribute = attribute of { "birth" | "death" }
patrick@0
   586
patrick@13
   587
date.content = mixed { sup* }
patrick@0
   588
patrick@36
   589
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   590
patrick@0
   591
name = element name { name.attributes, name.content }
patrick@2
   592
patrick@2
   593
name.attributes =
patrick@2
   594
   name.of.attribute?
patrick@33
   595
name.of.attribute = attribute of
patrick@33
   596
   { "person" | "company" | "book" | "newspaper" | "party" }
patrick@0
   597
patrick@2
   598
name.content = inlines
patrick@2
   599
patrick@36
   600
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   601
patrick@5
   602
note = element note { note.attributes, note.content }
patrick@0
   603
patrick@5
   604
note.attributes =
patrick@5
   605
   note.label.attribute?
patrick@5
   606
note.label.attribute = attribute label { text }
patrick@0
   607
patrick@5
   608
note.content =
patrick@91
   609
   (w, p+) | inlines
patrick@91
   610
patrick@91
   611
w = element w { inlines }
patrick@0
   612
patrick@36
   613
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   614
patrick@0
   615
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   616
patrick@9
   617
foreign.attributes =
patrick@9
   618
   lang.attribute?
patrick@0
   619
patrick@0
   620
foreign.content = inlines
patrick@0
   621
patrick@36
   622
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   623
patrick@0
   624
highlight = element highlight { highlight.content }
patrick@0
   625
patrick@0
   626
highlight.content = inlines
patrick@0
   627
patrick@36
   628
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   629
patrick@5
   630
mentioned = element mentioned { mentioned.content }
patrick@5
   631
patrick@5
   632
mentioned.content = inlines
patrick@5
   633
patrick@36
   634
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   635
patrick@5
   636
quote = element quote { quote.content }
patrick@5
   637
patrick@5
   638
quote.content = inlines
patrick@5
   639
patrick@36
   640
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   641
patrick@8
   642
acronym = element acronym { acronym.content }
patrick@8
   643
patrick@8
   644
acronym.content = inlines
patrick@8
   645
patrick@36
   646
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   647
patrick@8
   648
term = element term { term.content }
patrick@8
   649
patrick@8
   650
term.content = inlines
patrick@8
   651
patrick@36
   652
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   653
patrick@0
   654
link = element link { link.attributes, link.content }
patrick@0
   655
patrick@9
   656
link.attributes =
patrick@42
   657
   (uri.attribute | idref.attribute)
patrick@9
   658
uri.attribute = attribute uri { xsd:anyURI }
patrick@9
   659
idref.attribute = attribute idref { xsd:IDREF }
patrick@0
   660
patrick@0
   661
link.content = inlines
patrick@42
   662
patrick@42
   663
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   664
patrick@43
   665
anchor = element anchor { anchor.attributes }
patrick@42
   666
patrick@42
   667
anchor.attributes =
patrick@42
   668
   anchor.id.attribute
patrick@42
   669
anchor.id.attribute = attribute xml:id { xsd:ID }
patrick@91
   670
patrick@91
   671
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ initial ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@91
   672
patrick@91
   673
initial = element initial { initial.content }
patrick@91
   674
patrick@91
   675
initial.content =
patrick@91
   676
   c,
patrick@91
   677
   w?
patrick@91
   678
patrick@91
   679
c = element c { text }
patrick@105
   680
patrick@105
   681
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@105
   682
patrick@105
   683
smil = element smil { smil.attributes, smil.content }
patrick@105
   684
patrick@105
   685
smil.attributes =
patrick@105
   686
   begin.attribute?
patrick@105
   687
 & end.attribute?
patrick@105
   688
begin.attribute = attribute begin { xsd:decimal }
patrick@105
   689
end.attribute = attribute end { xsd:decimal }
patrick@105
   690
patrick@105
   691
smil.content = inlines