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