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