RelaxNG/publidoc.rnc
author Patrick PIERRE
jeu., 20 juin 2013 11:24:12 +0200
changeset 223 3c7414da40ec
parent 217 787f74e3166d
child 225 4bb2b00913ad
permissions -rw-r--r--
Changement remarque niveau 3
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@217
    29
   (title, shorttitle?, subtitle*)?
patrick@156
    30
 & (identifier, identifier?)?
patrick@181
    31
 & copyright*
Patrick@155
    32
 & collection?
patrick@90
    33
 & contributors?
patrick@90
    34
 & date?
patrick@90
    35
 & place?
patrick@156
    36
 & (source, source?)?
patrick@90
    37
 & keywordset?
patrick@90
    38
 & subjectset?
patrick@90
    39
 & abstract?
patrick@90
    40
 & cover?
patrick@90
    41
 & annotation*
patrick@90
    42
patrick@0
    43
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    44
patrick@90
    45
# ~~~~~~ document
patrick@0
    46
document = element document { document.attributes, document.content }
patrick@0
    47
patrick@0
    48
document.attributes =
patrick@0
    49
   document.id.attribute
patrick@142
    50
 & document.type.attribute?
patrick@66
    51
 & lang.attribute?
patrick@117
    52
document.id.attribute = attribute id { xsd:NMTOKEN }
patrick@142
    53
document.type.attribute = attribute type { xsd:NCName }
patrick@66
    54
lang.attribute = attribute xml:lang { xsd:language }
patrick@0
    55
patrick@0
    56
document.content =
patrick@20
    57
   top.head?,
patrick@56
    58
   (division | topic)+
patrick@0
    59
patrick@0
    60
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    61
patrick@18
    62
top.topic = element topic { top.topic.attributes, top.topic.content }
patrick@0
    63
patrick@20
    64
top.topic.attributes =
patrick@20
    65
   topic.id.attribute
patrick@20
    66
 & topic.type.attribute?
patrick@66
    67
 & lang.attribute?
patrick@117
    68
topic.id.attribute = attribute id { xsd:NMTOKEN }
patrick@20
    69
topic.type.attribute = attribute type { xsd:NCName }
patrick@20
    70
patrick@20
    71
top.topic.content =
patrick@20
    72
   top.head?,
Patrick@137
    73
   header?,
Patrick@190
    74
   ((section+, bibliography?) | bibliography),
Patrick@137
    75
   footer?
patrick@0
    76
patrick@40
    77
patrick@0
    78
# =============================================================================
patrick@20
    79
#                                 DIVISION LEVEL
patrick@0
    80
# =============================================================================
patrick@0
    81
patrick@70
    82
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    83
patrick@90
    84
# ~~~~~~ division
patrick@0
    85
division = element division { division.content }
patrick@0
    86
patrick@0
    87
division.content =
patrick@20
    88
   division.head?,
Patrick@217
    89
   front?,
patrick@56
    90
   (division | topic)+
patrick@0
    91
patrick@90
    92
# ~~~~~~ division.head
patrick@90
    93
division.head = element head { division.head.content }
patrick@90
    94
patrick@90
    95
division.head.content =
Patrick@217
    96
   (title, shorttitle?, subtitle*)?
patrick@90
    97
 & abstract?
patrick@90
    98
 & annotation*
patrick@90
    99
Patrick@217
   100
# ~~~~~~ front
Patrick@217
   101
front = element front { front.content }
Patrick@217
   102
Patrick@217
   103
front.content =
Patrick@217
   104
   section+
Patrick@217
   105
patrick@0
   106
patrick@0
   107
# =============================================================================
patrick@90
   108
#                                COMPONENT LEVEL
patrick@0
   109
# =============================================================================
patrick@0
   110
patrick@90
   111
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ component.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   112
patrick@90
   113
component.head = element head { component.head.content }
patrick@90
   114
patrick@90
   115
component.head.content =
Patrick@217
   116
   (title, shorttitle?, subtitle*)?
patrick@90
   117
 & contributors?
patrick@143
   118
 & date?
patrick@143
   119
 & place?
patrick@143
   120
 & keywordset?
patrick@143
   121
 & subjectset?
patrick@90
   122
 & abstract?
patrick@90
   123
 & annotation*
patrick@90
   124
patrick@0
   125
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   126
patrick@0
   127
topic = element topic { topic.attributes, topic.content }
patrick@0
   128
patrick@0
   129
topic.attributes =
Patrick@191
   130
   (topic.id.attribute | xmlid.attribute)?
patrick@0
   131
 & topic.type.attribute?
patrick@69
   132
 & lang.attribute?
Patrick@191
   133
xmlid.attribute = attribute xml:id { xsd:ID }
patrick@0
   134
patrick@0
   135
topic.content =
patrick@20
   136
   component.head?,
Patrick@137
   137
   header?,
Patrick@190
   138
   ((section+, bibliography?) | bibliography),
Patrick@137
   139
   footer?
patrick@0
   140
patrick@0
   141
patrick@0
   142
# =============================================================================
patrick@20
   143
#                                 SECTION LEVEL
patrick@0
   144
# =============================================================================
patrick@0
   145
Patrick@137
   146
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@137
   147
Patrick@137
   148
header = element header { header.content }
Patrick@137
   149
Patrick@137
   150
header.content =
Patrick@137
   151
   block+
Patrick@137
   152
patrick@20
   153
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   154
patrick@90
   155
# ~~~~~~ section
patrick@58
   156
section = element section { section.attributes, section.content }
patrick@58
   157
patrick@58
   158
section.attributes =
patrick@58
   159
   section.type.attribute?
patrick@64
   160
 & lang.attribute?
patrick@166
   161
 & for.attribute?
patrick@58
   162
section.type.attribute = attribute type { xsd:NCName }
patrick@166
   163
for.attribute = attribute for { xsd:NCName }
patrick@0
   164
patrick@0
   165
section.content =
patrick@20
   166
   section.head?,
patrick@9
   167
   (section+ | block+)
patrick@0
   168
patrick@90
   169
# ~~~~~~ section.head
patrick@90
   170
section.head = element head { section.head.content }
patrick@90
   171
patrick@90
   172
section.head.content =
Patrick@217
   173
   (title, shorttitle?, subtitle*)?
Marc@177
   174
 & keywordset?
Marc@177
   175
 & subjectset?
patrick@90
   176
 & abstract?
patrick@105
   177
 & audio*
patrick@90
   178
 & annotation*
patrick@90
   179
Patrick@189
   180
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliography ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@189
   181
Patrick@189
   182
# ~~~~~~ bibliography
Patrick@189
   183
bibliography = element bibliography { bibliography.content }
Patrick@189
   184
Patrick@189
   185
bibliography.content =
Patrick@189
   186
   bibliography.entry+
Patrick@189
   187
Patrick@137
   188
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@137
   189
Patrick@137
   190
footer = element footer { footer.content }
Patrick@137
   191
Patrick@137
   192
footer.content =
Patrick@137
   193
   block+
Patrick@137
   194
patrick@0
   195
patrick@0
   196
# =============================================================================
patrick@20
   197
#                                 BLOCK LEVEL
patrick@0
   198
# =============================================================================
patrick@0
   199
patrick@20
   200
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   201
patrick@90
   202
# ~~~~~~ block
patrick@44
   203
block = (p | speech | \list | blockquote | table | media)
patrick@9
   204
patrick@90
   205
# ~~~~~~ block.head
patrick@90
   206
block.head = element head { block.head.content }
patrick@90
   207
patrick@90
   208
block.head.content =
Patrick@217
   209
   (title, shorttitle?, subtitle*)?
patrick@90
   210
patrick@42
   211
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   212
patrick@20
   213
p = element p { p.content }
patrick@0
   214
patrick@20
   215
p.content =
patrick@0
   216
   inlines
patrick@0
   217
patrick@18
   218
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@18
   219
patrick@18
   220
# ~~~~~~ speech
patrick@18
   221
speech = element speech { speech.content }
patrick@18
   222
patrick@18
   223
speech.content =
patrick@18
   224
   speaker?,
patrick@18
   225
   stage?,
Patrick@199
   226
   (p | blockquote)+
patrick@18
   227
patrick@18
   228
# ~~~~~~ speaker
patrick@18
   229
speaker = element speaker { speaker.content }
patrick@18
   230
patrick@18
   231
speaker.content = inlines
patrick@18
   232
patrick@17
   233
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   234
patrick@9
   235
# ~~~~~~ list
patrick@75
   236
\list = element list {
patrick@20
   237
   block.head?,
patrick@71
   238
   (  (attribute type {"ordered"}?, item, item+)
patrick@9
   239
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   240
}
patrick@9
   241
patrick@9
   242
# ~~~~~~ item
patrick@9
   243
item = element item { item.content }
patrick@9
   244
patrick@30
   245
item.content =
patrick@73
   246
   inlines
patrick@73
   247
 | block+
patrick@9
   248
patrick@9
   249
# ~~~~~~ glossary.item
patrick@9
   250
glossary.item = element item { glossary.item.content }
patrick@9
   251
patrick@9
   252
glossary.item.content =
patrick@9
   253
   label,
patrick@9
   254
   block+
patrick@9
   255
patrick@44
   256
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@44
   257
patrick@44
   258
# ~~~~~~ blockquote
patrick@44
   259
blockquote = element blockquote { blockquote.content }
patrick@44
   260
patrick@44
   261
blockquote.content =
patrick@44
   262
   block.head?,
patrick@44
   263
   (p | speech | \list)+,
patrick@44
   264
   attribution?
patrick@44
   265
patrick@44
   266
# ~~~~~~ attribution
patrick@72
   267
attribution = element attribution { attribution.content }
patrick@44
   268
patrick@72
   269
attribution.content =
patrick@44
   270
   inlines
patrick@44
   271
patrick@17
   272
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@17
   273
patrick@73
   274
# ~~~~~~ table
patrick@17
   275
table = element table { table.content }
patrick@17
   276
patrick@17
   277
table.content =
patrick@20
   278
   block.head?,
patrick@17
   279
   tgroup+,
patrick@109
   280
   table.caption?
patrick@17
   281
patrick@17
   282
# ~~~~~~ tgroup
patrick@17
   283
tgroup = element tgroup { tgroup.attributes, tgroup.content }
patrick@17
   284
patrick@17
   285
tgroup.content =
patrick@17
   286
   thead?,
patrick@17
   287
   tbody
patrick@17
   288
patrick@17
   289
tgroup.attributes =
patrick@17
   290
   cols.attribute
patrick@17
   291
 & align.attribute?
patrick@17
   292
 & colsep.attribute?
patrick@17
   293
 & rowsep.attribute?
patrick@17
   294
cols.attribute = attribute cols { xsd:positiveInteger }
patrick@17
   295
align.attribute = attribute align { "left"  |  "right"  | "center" | "justify" }
patrick@17
   296
colsep.attribute = attribute colsep { "0" | "1" }
patrick@17
   297
rowsep.attribute = attribute rowsep { "0" | "1" }
patrick@17
   298
patrick@146
   299
# ~~~~~~ thead, tbody
patrick@22
   300
thead = element thead { thead.attributes, thead.content }
patrick@22
   301
tbody = element tbody { tbody.attributes, tbody.content }
patrick@17
   302
patrick@22
   303
thead.attributes =
patrick@22
   304
   valign.attribute?
patrick@22
   305
tbody.attributes =
patrick@22
   306
   valign.attribute?
patrick@22
   307
valign.attribute = attribute valign { "top" | "middle" | "bottom" }
patrick@75
   308
patrick@17
   309
thead.content =
patrick@17
   310
   row+
patrick@17
   311
tbody.content =
patrick@17
   312
   row+
patrick@17
   313
patrick@17
   314
# ~~~~~~ row
patrick@146
   315
row = element row { row.attributes, row.content }
patrick@17
   316
patrick@146
   317
row.attributes =
patrick@17
   318
   valign.attribute?
patrick@146
   319
 & rowsep.attribute?
patrick@17
   320
patrick@17
   321
row.content =
Patrick@189
   322
  table.entry+
patrick@17
   323
Patrick@189
   324
# ~~~~~~ table.entry
Patrick@189
   325
table.entry = element entry { table.entry.attributes, table.entry.content }
patrick@146
   326
Patrick@189
   327
table.entry.attributes =
patrick@146
   328
   align.attribute?
patrick@146
   329
 & valign.attribute?
patrick@146
   330
 & colsep.attribute?
patrick@146
   331
 & rowsep.attribute?
patrick@17
   332
Patrick@189
   333
table.entry.content =
patrick@17
   334
   inlines
patrick@37
   335
 | (p | media)+
patrick@17
   336
patrick@109
   337
# ~~~~~~ table.caption
patrick@109
   338
table.caption = element caption { caption.content }
patrick@17
   339
patrick@17
   340
caption.content =
patrick@20
   341
   inlines
Patrick@138
   342
 | (p | speech | \list | blockquote)+
patrick@17
   343
patrick@35
   344
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   345
patrick@2
   346
# ~~~~~~ media
patrick@0
   347
media = element media { media.content }
patrick@0
   348
patrick@0
   349
media.content =
patrick@24
   350
   block.head?,
patrick@119
   351
   (image | audio | video)+,
patrick@109
   352
   media.caption?,
patrick@36
   353
   link?
patrick@0
   354
patrick@2
   355
# ~~~~~~ image
patrick@0
   356
image = element image { image.attributes, image.content }
Patrick@191
   357
hotspot.image = element image {image.attributes }
patrick@0
   358
patrick@0
   359
image.attributes =
patrick@104
   360
   media.id.attribute
patrick@104
   361
 & image.type?
patrick@17
   362
media.id.attribute = attribute id { xsd:NMTOKEN }
Patrick@184
   363
image.type = attribute type { "cover" | "thumbnail" | "icon" | "animation" }
patrick@0
   364
patrick@0
   365
image.content =
patrick@111
   366
   copyright?,
Patrick@176
   367
   hotspot*
patrick@0
   368
patrick@45
   369
# ~~~~~~ audio
patrick@45
   370
audio = element audio { audio.attributes }
patrick@43
   371
patrick@45
   372
audio.attributes =
patrick@43
   373
   media.id.attribute
patrick@104
   374
 & audio.type?
patrick@113
   375
audio.type = attribute type { "music" | "voice" | "background" | "smil" }
patrick@43
   376
patrick@119
   377
# ~~~~~~ video
patrick@119
   378
video = element video { video.attributes }
patrick@119
   379
patrick@119
   380
video.attributes =
patrick@119
   381
   media.id.attribute
patrick@119
   382
patrick@122
   383
# ~~~~~~ hotspot
patrick@122
   384
hotspot = element hotspot { hotspot.attributes, hotspot.content }
patrick@122
   385
patrick@122
   386
hotspot.attributes =
patrick@122
   387
   x.attribute
patrick@122
   388
 & y.attribute
patrick@182
   389
 & w.attribute
Patrick@183
   390
 & h.attribute?
Patrick@191
   391
 & hotspot.type.attribute?
Patrick@191
   392
 & xmlid.attribute?
Patrick@173
   393
x.attribute = attribute x { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@173
   394
y.attribute = attribute y { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   395
w.attribute = attribute w { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   396
h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@183
   397
hotspot.type.attribute = attribute type { "normal" | "visible" | "pulse" }
Patrick@191
   398
   
Patrick@191
   399
hotspot.content =
Patrick@191
   400
   ((link | p+ | hotspot.image | audio | video), (spot, scenario?)?)
Patrick@191
   401
 | (spot, scenario?)
Patrick@191
   402
   
Patrick@191
   403
# ~~~~~~ spot
Patrick@191
   404
spot = element spot { spot.attributes, spot.content }
Patrick@191
   405
Patrick@191
   406
spot.attributes =
Patrick@191
   407
   dx.attribute?
Patrick@191
   408
 & dy.attribute?
Patrick@191
   409
 & dw.attribute?
Patrick@191
   410
 & dh.attribute?
patrick@188
   411
dx.attribute = attribute dx { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
patrick@188
   412
dy.attribute = attribute dy { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   413
dw.attribute = attribute dw { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   414
dh.attribute = attribute dh { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   415
Patrick@191
   416
spot.content =
Patrick@191
   417
   ((p+ | image), audio?)
Patrick@191
   418
 | audio
Patrick@191
   419
 | video
Patrick@191
   420
patrick@109
   421
# ~~~~~~ media.caption
patrick@109
   422
media.caption = element caption { caption.attributes, caption.content }
patrick@109
   423
patrick@109
   424
caption.attributes =
patrick@109
   425
   x.attribute?
patrick@109
   426
 & y.attribute?
patrick@109
   427
Patrick@191
   428
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ scenario ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@191
   429
Patrick@191
   430
# ~~~~~~ scenario
Patrick@191
   431
scenario = element scenario { scenario.content }
Patrick@191
   432
Patrick@191
   433
scenario.content =
Patrick@191
   434
   init*,
Patrick@191
   435
   onclick*
Patrick@191
   436
Patrick@191
   437
# ~~~~~~ init
Patrick@191
   438
init = element init { init.attributes }
Patrick@191
   439
Patrick@191
   440
init.attributes =
Patrick@191
   441
   init.action.attribute
Patrick@191
   442
 & target.attribute?
Patrick@191
   443
init.action.attribute = attribute action { "hide" }
Patrick@191
   444
target.attribute = attribute target { "hotspot" | "spot" }
Patrick@191
   445
Patrick@191
   446
# ~~~~~~ onclick
Patrick@191
   447
onclick = element onclick { onclick.attributes }
Patrick@191
   448
Patrick@191
   449
onclick.attributes =
Patrick@191
   450
   onclick.action.attribute
Patrick@191
   451
 & target.attribute?
Patrick@191
   452
onclick.action.attribute = attribute action { "show" }
Patrick@191
   453
Patrick@189
   454
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliograpgy.entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@189
   455
Patrick@189
   456
# ~~~~~~ bibliography.entry
Patrick@189
   457
bibliography.entry = element entry { bibliography.entry.content }
Patrick@189
   458
Patrick@189
   459
bibliography.entry.content =
Patrick@189
   460
   identifier.ean?
Patrick@189
   461
 & title
Patrick@189
   462
 & subtitle?
Patrick@189
   463
 & copyright?
Patrick@189
   464
 & collection?
Patrick@189
   465
 & contributors?
Patrick@189
   466
 & date?
Patrick@189
   467
 & place?
Patrick@189
   468
 & folio?
Patrick@189
   469
 & pages?
Patrick@189
   470
Patrick@189
   471
# ~~~~~~ folio
Patrick@189
   472
folio = element folio { folio.content }
Patrick@189
   473
Patrick@189
   474
folio.content = xsd:positiveInteger | xsd:token {pattern = "[DLXVI]+"}
Patrick@189
   475
Patrick@189
   476
# ~~~~~~ pages
Patrick@189
   477
pages = element pages { pages.content }
Patrick@189
   478
Patrick@189
   479
pages.content = xsd:positiveInteger
Patrick@189
   480
patrick@0
   481
patrick@0
   482
# =============================================================================
patrick@90
   483
#                                 HEAD LEVEL
patrick@90
   484
# =============================================================================
patrick@90
   485
patrick@127
   486
# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   487
patrick@90
   488
title = element title { title.content }
patrick@127
   489
shorttitle = element shorttitle { title.content }
patrick@90
   490
subtitle = element subtitle { title.content }
patrick@90
   491
patrick@90
   492
title.content = inlines
patrick@90
   493
patrick@90
   494
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   495
patrick@156
   496
identifier = element identifier {
patrick@156
   497
   (attribute type { "ean" }, xsd:token {pattern = "\d{13}"})
patrick@156
   498
 | (attribute type { "uri" }, xsd:anyURI)
patrick@90
   499
}
patrick@90
   500
patrick@90
   501
identifier.ean = element identifier {
patrick@90
   502
   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
patrick@90
   503
}
patrick@90
   504
patrick@156
   505
identifier.uri = element identifier {
patrick@156
   506
   attribute type { "uri" }, xsd:anyURI
patrick@156
   507
}
patrick@90
   508
patrick@90
   509
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   510
patrick@90
   511
copyright = element copyright { copyright.content }
patrick@90
   512
patrick@90
   513
copyright.content = inlines
patrick@90
   514
Patrick@155
   515
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@155
   516
Patrick@155
   517
collection = element collection { collection.content }
Patrick@155
   518
Patrick@155
   519
collection.content = inlines
Patrick@155
   520
patrick@90
   521
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   522
patrick@90
   523
# ~~~~~~ contributors
patrick@90
   524
contributors = element contributors { contributors.content }
patrick@90
   525
patrick@90
   526
contributors.content =
patrick@90
   527
   contributor+
patrick@90
   528
patrick@90
   529
# ~~~~~~ contributor
patrick@90
   530
contributor = element contributor { contributor.content }
patrick@90
   531
patrick@90
   532
contributor.content =
patrick@90
   533
   (((firstname, secondname?)?, lastname) | label),
patrick@90
   534
   address?,
patrick@90
   535
   link?,
patrick@101
   536
   role+
patrick@90
   537
patrick@90
   538
# ~~~~~~ firstname, secondname, lastname, label
patrick@90
   539
firstname = element firstname { firstname.content }
patrick@90
   540
secondname = element secondname { secondname.content }
patrick@90
   541
lastname = element lastname { lastname.content }
patrick@90
   542
label = element label { label.content }
patrick@90
   543
patrick@90
   544
firstname.content = inlines
patrick@90
   545
secondname.content = inlines
patrick@90
   546
lastname.content = inlines
patrick@90
   547
label.content = inlines
patrick@90
   548
patrick@90
   549
# ~~~~~~ address
patrick@90
   550
address = element address { address.content }
patrick@90
   551
patrick@90
   552
address.content = inlines
patrick@90
   553
patrick@90
   554
# ~~~~~~ role
patrick@90
   555
role = element role { role.content }
patrick@90
   556
patrick@90
   557
role.content = "author" | "illustrator" | "publisher" | "packager"
patrick@90
   558
patrick@90
   559
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   560
patrick@90
   561
place = element place { place.content }
patrick@90
   562
patrick@90
   563
place.content = inlines
patrick@90
   564
patrick@90
   565
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   566
patrick@90
   567
source = element source {
Patrick@189
   568
   (  (attribute type { "book" }, bibliography.entry.content)
patrick@90
   569
    | (attribute type { "file" }, source.content.file)),
patrick@90
   570
   source.content
patrick@90
   571
}
patrick@90
   572
patrick@90
   573
source.content.file =
patrick@90
   574
   identifier.uri
patrick@90
   575
source.content =
patrick@90
   576
   annotation*
patrick@90
   577
Patrick@189
   578
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   579
patrick@90
   580
# ~~~~~~ keywordset
patrick@90
   581
keywordset = element keywordset { keywordset.content }
patrick@90
   582
patrick@90
   583
keywordset.content = keyword+
patrick@90
   584
patrick@90
   585
# ~~~~~~ keyword
patrick@90
   586
keyword = element keyword { keyword.content }
patrick@90
   587
patrick@90
   588
keyword.content = mixed { sup*, sub* }
patrick@90
   589
patrick@90
   590
# ~~~~~~ subjectset
patrick@90
   591
subjectset = element subjectset { subjectset.content }
patrick@90
   592
patrick@90
   593
subjectset.content = subject+
patrick@90
   594
patrick@90
   595
# ~~~~~~ subject
patrick@132
   596
subject = element subject { subject.content }
patrick@90
   597
Patrick@214
   598
subject.content = mixed { sup*, sub* }
patrick@90
   599
patrick@90
   600
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   601
patrick@90
   602
abstract = element abstract { abstract.content }
patrick@90
   603
patrick@90
   604
abstract.content =
patrick@90
   605
   p+
patrick@90
   606
patrick@90
   607
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   608
patrick@90
   609
cover = element cover { cover.content }
patrick@90
   610
patrick@90
   611
cover.content =
patrick@90
   612
   cover.image
patrick@90
   613
patrick@90
   614
cover.image = element image { cover.image.attributes }
patrick@90
   615
patrick@90
   616
cover.image.attributes =
patrick@90
   617
   cover.image.id.attribute
patrick@90
   618
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
patrick@105
   619
   
patrick@90
   620
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   621
patrick@90
   622
annotation = element annotation { annotation.content }
patrick@90
   623
patrick@90
   624
annotation.content = inlines
patrick@90
   625
patrick@90
   626
patrick@90
   627
# =============================================================================
patrick@20
   628
#                                 INLINE LEVEL
patrick@0
   629
# =============================================================================
patrick@0
   630
patrick@0
   631
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   632
patrick@0
   633
inlines = mixed {
patrick@0
   634
   sup*
patrick@0
   635
 & sub*
patrick@42
   636
 & var*
patrick@13
   637
 & number*
patrick@42
   638
 & math*
patrick@0
   639
 & date*
patrick@0
   640
 & name*
Patrick@212
   641
 & foreign*
Patrick@212
   642
 & acronym*
Patrick@212
   643
 & term*
Patrick@212
   644
 & literal*
Patrick@212
   645
 & stage*
Patrick@212
   646
 & highlight*
Patrick@212
   647
 & mentioned*
Patrick@212
   648
 & initial*
patrick@5
   649
 & note*
patrick@5
   650
 & quote*
patrick@25
   651
 & link*
patrick@42
   652
 & anchor*
patrick@93
   653
 & image*
Patrick@208
   654
 & audio*
patrick@105
   655
 & smil*
Patrick@205
   656
 & warning*
patrick@0
   657
}
patrick@0
   658
patrick@42
   659
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   660
patrick@42
   661
sup = element sup { text }
patrick@0
   662
patrick@42
   663
sub = element sub { text }
patrick@42
   664
patrick@42
   665
var = element var { text }
patrick@42
   666
patrick@90
   667
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   668
patrick@90
   669
number = element number {
patrick@90
   670
   ( attribute type {"roman"}, number.attributes, number.roman.content )
patrick@90
   671
 | ( number.attributes, number.content)
patrick@90
   672
}
patrick@90
   673
patrick@90
   674
number.attributes =
patrick@90
   675
   number.value.attribute?
patrick@90
   676
number.value.attribute = attribute value { xsd:integer | xsd:decimal }
patrick@90
   677
Patrick@212
   678
number.content = mixed { sup* & warning* }
patrick@157
   679
number.roman.content = xsd:token {pattern = "[DLXVI]+"}
patrick@90
   680
patrick@42
   681
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   682
patrick@42
   683
math = element math {
patrick@42
   684
   ( attribute notation {"tex"}, math.attributes, math.tex.content )
patrick@42
   685
 | ( math.attributes, math.content)
patrick@42
   686
}
patrick@42
   687
patrick@42
   688
math.attributes =
patrick@42
   689
   wide.attribute?
patrick@42
   690
wide.attribute = attribute wide { xsd:boolean }
patrick@42
   691
patrick@42
   692
math.content = mixed { sup* & sub* & var* }
patrick@42
   693
math.tex.content = text
patrick@0
   694
patrick@36
   695
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   696
patrick@0
   697
date = element date { date.attributes, date.content }
patrick@0
   698
patrick@3
   699
date.attributes =
patrick@13
   700
   date.value.attribute
patrick@13
   701
 & date.of.attribute?
patrick@13
   702
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
patrick@33
   703
date.of.attribute = attribute of { "birth" | "death" }
patrick@0
   704
Patrick@212
   705
date.content = mixed { sup* & warning* }
patrick@0
   706
patrick@36
   707
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   708
patrick@0
   709
name = element name { name.attributes, name.content }
patrick@2
   710
patrick@2
   711
name.attributes =
patrick@2
   712
   name.of.attribute?
patrick@33
   713
name.of.attribute = attribute of
Patrick@135
   714
   { "person" | "company" | "book" | "newspaper" | "party" | "painting" }
patrick@0
   715
Patrick@212
   716
name.content = mixed { sup* & number* & acronym* & warning* }
Patrick@212
   717
Patrick@212
   718
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   719
Patrick@212
   720
foreign = element foreign { foreign.attributes, foreign.content }
Patrick@212
   721
Patrick@212
   722
foreign.attributes =
Patrick@212
   723
   lang.attribute?
Patrick@212
   724
Patrick@212
   725
foreign.content = mixed { sup* & sub* & number* & warning* }
Patrick@212
   726
Patrick@212
   727
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   728
Patrick@212
   729
acronym = element acronym { acronym.content }
Patrick@212
   730
Patrick@212
   731
acronym.content = mixed { sup* & warning* }
Patrick@212
   732
Patrick@212
   733
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   734
Patrick@212
   735
term = element term { term.content }
Patrick@212
   736
Patrick@212
   737
term.content = mixed { sup* & warning* }
Patrick@212
   738
Patrick@212
   739
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ literal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   740
Patrick@212
   741
literal = element literal { literal.content }
Patrick@212
   742
Patrick@212
   743
literal.content = mixed { sup* & warning* }
Patrick@212
   744
Patrick@212
   745
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   746
Patrick@212
   747
stage = element stage { stage.content }
Patrick@212
   748
Patrick@212
   749
stage.content = inlines
Patrick@212
   750
Patrick@212
   751
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   752
Patrick@212
   753
highlight = element highlight { highlight.content }
Patrick@212
   754
Patrick@212
   755
highlight.content = inlines
Patrick@212
   756
Patrick@212
   757
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   758
Patrick@212
   759
mentioned = element mentioned { mentioned.content }
Patrick@212
   760
Patrick@212
   761
mentioned.content = inlines
Patrick@212
   762
Patrick@212
   763
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ initial ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@212
   764
Patrick@212
   765
initial = element initial { initial.content }
Patrick@212
   766
Patrick@212
   767
initial.content =
Patrick@212
   768
   c,
Patrick@212
   769
   w?
Patrick@212
   770
Patrick@212
   771
c = element c { text }
Patrick@212
   772
w = element w { inlines }
patrick@2
   773
patrick@36
   774
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   775
patrick@5
   776
note = element note { note.attributes, note.content }
patrick@0
   777
patrick@5
   778
note.attributes =
patrick@5
   779
   note.label.attribute?
patrick@5
   780
note.label.attribute = attribute label { text }
patrick@0
   781
patrick@5
   782
note.content =
claire@180
   783
   (w?, block+) | inlines
patrick@91
   784
patrick@36
   785
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   786
patrick@5
   787
quote = element quote { quote.content }
patrick@5
   788
patrick@131
   789
quote.content =
patrick@131
   790
   (phrase, attribution) | inlines
patrick@131
   791
patrick@131
   792
phrase = element phrase { phrase.content }
patrick@131
   793
patrick@131
   794
phrase.content = inlines
patrick@5
   795
patrick@36
   796
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   797
patrick@0
   798
link = element link { link.attributes, link.content }
patrick@0
   799
patrick@9
   800
link.attributes =
patrick@42
   801
   (uri.attribute | idref.attribute)
patrick@9
   802
uri.attribute = attribute uri { xsd:anyURI }
patrick@9
   803
idref.attribute = attribute idref { xsd:IDREF }
patrick@0
   804
Patrick@212
   805
link.content =  mixed {
Patrick@212
   806
   sup* & sub* & var* & number* & math* & date* & name* & foreign* & acronym*
Patrick@212
   807
 & term* & literal* & stage* & highlight* & mentioned* & warning* }
patrick@42
   808
patrick@42
   809
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   810
Patrick@147
   811
anchor = element anchor { anchor.attributes, anchor.content }
patrick@42
   812
patrick@42
   813
anchor.attributes =
patrick@42
   814
   anchor.id.attribute
patrick@42
   815
anchor.id.attribute = attribute xml:id { xsd:ID }
patrick@91
   816
Patrick@147
   817
anchor.content = inlines
Patrick@147
   818
patrick@105
   819
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@105
   820
patrick@105
   821
smil = element smil { smil.attributes, smil.content }
patrick@105
   822
patrick@105
   823
smil.attributes =
Patrick@207
   824
   audio.attribute?
Patrick@207
   825
 & begin.attribute?
patrick@105
   826
 & end.attribute?
Patrick@207
   827
audio.attribute = attribute audio { xsd:anyURI }
patrick@105
   828
begin.attribute = attribute begin { xsd:decimal }
patrick@105
   829
end.attribute = attribute end { xsd:decimal }
patrick@105
   830
patrick@105
   831
smil.content = inlines
Patrick@205
   832
Patrick@205
   833
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@205
   834
Patrick@205
   835
warning = element warning { warning.content }
Patrick@205
   836
Patrick@205
   837
warning.content = inlines