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