RelaxNG/publiquiz.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
jeu., 26 janv. 2012 21:52:36 +0100
changeset 84 666cb4bd1342
parent 81 a9276e7bcdf1
child 85 deac30469ca6
permissions -rw-r--r--
Ajout des quiz dans les divisions
patrick@73
     1
# $Id$
patrick@73
     2
patrick@73
     3
patrick@73
     4
include "publidoc.rnc" {
patrick@73
     5
   start = publiquiz
patrick@73
     6
patrick@73
     7
   document.content =
patrick@73
     8
      top.head?,
patrick@73
     9
      (division | topic | quiz)+
patrick@84
    10
patrick@84
    11
   division.content =
patrick@84
    12
      division.head?,
patrick@84
    13
      (division | topic | quiz)+
patrick@73
    14
}
patrick@73
    15
patrick@75
    16
patrick@73
    17
publiquiz = element publiquiz {
patrick@73
    18
   publiquiz.attributes,
patrick@73
    19
   publiquiz.content
patrick@73
    20
}
patrick@73
    21
patrick@73
    22
publiquiz.attributes =
patrick@73
    23
   version.attribute
patrick@73
    24
patrick@73
    25
publiquiz.content =
patrick@73
    26
   document
patrick@73
    27
 | top.quiz
patrick@73
    28
patrick@73
    29
patrick@73
    30
# =============================================================================
patrick@73
    31
#                                  TOP LEVEL
patrick@73
    32
# =============================================================================
patrick@73
    33
patrick@73
    34
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    35
patrick@73
    36
top.quiz = element quiz { top.quiz.attributes, quiz.content }
patrick@73
    37
patrick@73
    38
top.quiz.attributes =
patrick@73
    39
   quiz.id.attribute
patrick@73
    40
 & lang.attribute?
patrick@73
    41
patrick@73
    42
patrick@73
    43
# =============================================================================
patrick@73
    44
#                               COMPONENT LEVEL
patrick@73
    45
# =============================================================================
patrick@73
    46
patrick@73
    47
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    48
patrick@73
    49
quiz = element quiz { quiz.attributes, quiz.content }
patrick@73
    50
patrick@73
    51
quiz.attributes =
patrick@73
    52
   quiz.id.attribute?
patrick@73
    53
 & lang.attribute?
patrick@73
    54
quiz.id.attribute = attribute xml:id { xsd:ID }
patrick@73
    55
patrick@73
    56
quiz.content =
patrick@73
    57
   component.head?,
patrick@73
    58
   instructions,
patrick@73
    59
   (engine | composite)?,
patrick@73
    60
   help?,
patrick@73
    61
   commentary?
patrick@73
    62
patrick@73
    63
patrick@73
    64
# =============================================================================
patrick@73
    65
#                                 SECTION LEVEL
patrick@73
    66
# =============================================================================
patrick@73
    67
patrick@73
    68
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    69
patrick@73
    70
blanks.section = element section { section.attributes, blanks.section.content }
patrick@73
    71
point.section = element section { section.attributes, point.section.content }
patrick@73
    72
patrick@73
    73
blanks.section.content =
patrick@73
    74
   section.head?,
patrick@73
    75
   (blanks.section+ | blanks.block+)
patrick@73
    76
point.section.content =
patrick@73
    77
   section.head?,
patrick@73
    78
   (point.section+ | point.block+)
patrick@73
    79
patrick@73
    80
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ instructions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    81
patrick@73
    82
instructions = element instructions { section.content }
patrick@73
    83
patrick@73
    84
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ engine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    85
patrick@73
    86
engine =
patrick@75
    87
   choices
patrick@75
    88
 | blanks
patrick@73
    89
 | point
patrick@73
    90
 | matching
patrick@73
    91
 | sort
patrick@73
    92
patrick@73
    93
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ choices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    94
patrick@75
    95
choices = element choices {
patrick@75
    96
   (attribute type {"radio"}, choices.attributes, choices.radio.content)
patrick@75
    97
 | (attribute type {"check"}, choices.attributes, choices.check.content)
patrick@75
    98
}
patrick@73
    99
patrick@73
   100
choices.attributes =
patrick@73
   101
   shuffle.attribute?
patrick@73
   102
shuffle.attribute = attribute shuffle { xsd:boolean }
patrick@73
   103
patrick@73
   104
choices.radio.content =
patrick@73
   105
   choices.right
patrick@73
   106
 & choices.wrong+
patrick@73
   107
choices.check.content =
patrick@73
   108
   (choices.right | choices.wrong)+
patrick@73
   109
patrick@73
   110
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   111
patrick@75
   112
blanks = element blanks {
patrick@75
   113
   (attribute type {"fill"}, blanks.fill.attributes, blanks.fill.content)
patrick@75
   114
 | (attribute type {"select"}, blanks.select.attributes, blanks.select.content)
patrick@75
   115
}
patrick@73
   116
patrick@73
   117
blanks.fill.attributes =
patrick@75
   118
   strict.attribute?
patrick@73
   119
blanks.select.attributes =
patrick@73
   120
   multiple.attribute?
patrick@73
   121
strict.attribute = attribute strict { xsd:boolean }
patrick@73
   122
multiple.attribute = attribute multiple { xsd:boolean }
patrick@73
   123
patrick@73
   124
blanks.fill.content =
patrick@73
   125
   (blanks.block+ | blanks.section+)
patrick@73
   126
blanks.select.content =
patrick@73
   127
   blanks.wrongs?,
patrick@73
   128
   (blanks.block+ | blanks.section+)
patrick@73
   129
patrick@73
   130
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   131
patrick@73
   132
point = element point { point.attributes, point.content }
patrick@75
   133
patrick@73
   134
point.attributes =
patrick@73
   135
   point.type.attribute?
patrick@73
   136
point.type.attribute = attribute type {
patrick@73
   137
   "radio" | "radio_button" | "check" | "check_button" }
patrick@73
   138
patrick@73
   139
point.content =
patrick@73
   140
   (point.section+ | point.block+)
patrick@73
   141
patrick@73
   142
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   143
patrick@73
   144
matching = element matching { matching.content }
patrick@75
   145
patrick@73
   146
matching.content =
patrick@73
   147
   match,
patrick@73
   148
   match+
patrick@73
   149
patrick@73
   150
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sort ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   151
patrick@73
   152
sort = element sort { sort.attributes, sort.content }
patrick@73
   153
patrick@73
   154
sort.attributes =
patrick@73
   155
   shuffle.attribute?
patrick@75
   156
patrick@73
   157
sort.content =
patrick@73
   158
   comparison?,
patrick@73
   159
   sort.item,
patrick@73
   160
   sort.item+
patrick@73
   161
patrick@73
   162
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composite ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   163
patrick@77
   164
# ~~~~~~ composite
patrick@73
   165
composite = element composite { composite.content }
patrick@75
   166
patrick@73
   167
composite.content =
patrick@77
   168
   composite.quiz,
patrick@77
   169
   composite.quiz+
patrick@77
   170
patrick@77
   171
# ~~~~~~ composite.quiz
patrick@77
   172
composite.quiz = element quiz { composite.quiz.content }
patrick@77
   173
patrick@77
   174
composite.quiz.content =
patrick@77
   175
   instructions?,
patrick@77
   176
   engine
patrick@73
   177
patrick@73
   178
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   179
patrick@73
   180
help = element help { help.content }
patrick@73
   181
patrick@73
   182
help.content =
patrick@73
   183
   (section+ | block+)?,
patrick@73
   184
   link*
patrick@73
   185
patrick@73
   186
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ commentary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   187
patrick@73
   188
commentary = element commentary { commentary.content }
patrick@73
   189
patrick@73
   190
commentary.content =
patrick@81
   191
   (section+ | block+)?,
patrick@80
   192
   link*
patrick@73
   193
patrick@73
   194
patrick@73
   195
# =============================================================================
patrick@73
   196
#                                 BLOCK LEVEL
patrick@73
   197
# =============================================================================
patrick@73
   198
patrick@73
   199
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   200
patrick@73
   201
blanks.block =
patrick@73
   202
   (blanks.p | speech | blanks.list | blockquote | blanks.table | media)
patrick@73
   203
point.block =
patrick@73
   204
   (point.p | speech | point.list | blockquote | point.table | media)
patrick@73
   205
patrick@73
   206
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   207
patrick@73
   208
blanks.p = element p { blanks.p.content }
patrick@73
   209
point.p = element p { point.p.content }
patrick@73
   210
patrick@73
   211
blanks.p.content =
patrick@75
   212
   blanks.inlines
patrick@73
   213
point.p.content =
patrick@75
   214
   point.inlines
patrick@73
   215
patrick@73
   216
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   217
patrick@73
   218
# ~~~~~~ list
patrick@75
   219
blanks.list = element list {
patrick@73
   220
   block.head?,
patrick@73
   221
   (  (attribute type {"ordered"}?, blanks.item, blanks.item+)
patrick@73
   222
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   223
}
patrick@75
   224
point.list = element list {
patrick@73
   225
   block.head?,
patrick@73
   226
   (  (attribute type {"ordered"}?, point.item, point.item+)
patrick@73
   227
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   228
}
patrick@73
   229
patrick@73
   230
# ~~~~~~ item
patrick@73
   231
blanks.item = element item { blanks.item.content }
patrick@73
   232
point.item = element item { point.item.content }
patrick@73
   233
patrick@73
   234
blanks.item.content =
patrick@75
   235
   blanks.inlines
patrick@73
   236
 | blanks.block+
patrick@73
   237
point.item.content =
patrick@75
   238
   point.inlines
patrick@73
   239
 | point.block+
patrick@73
   240
patrick@73
   241
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   242
patrick@73
   243
blanks.table = element table { blanks.table.content }
patrick@73
   244
point.table = element table { point.table.content }
patrick@73
   245
patrick@73
   246
blanks.table.content =
patrick@73
   247
   block.head?,
patrick@73
   248
   blanks.tgroup+,
patrick@73
   249
   caption?
patrick@73
   250
point.table.content =
patrick@73
   251
   block.head?,
patrick@73
   252
   point.tgroup+,
patrick@73
   253
   caption?
patrick@73
   254
patrick@73
   255
# ~~~~~~ tgroup
patrick@73
   256
blanks.tgroup = element tgroup { tgroup.attributes, blanks.tgroup.content }
patrick@73
   257
point.tgroup = element tgroup { tgroup.attributes, point.tgroup.content }
patrick@73
   258
patrick@73
   259
blanks.tgroup.content =
patrick@73
   260
   thead?,
patrick@73
   261
   blanks.tbody
patrick@73
   262
point.tgroup.content =
patrick@73
   263
   thead?,
patrick@73
   264
   point.tbody
patrick@73
   265
patrick@73
   266
# ~~~~~~ tbody
patrick@73
   267
blanks.tbody = element tbody { tbody.attributes, blanks.tbody.content }
patrick@73
   268
point.tbody = element tbody { tbody.attributes, point.tbody.content }
patrick@73
   269
patrick@73
   270
blanks.tbody.content =
patrick@73
   271
   blanks.row+
patrick@73
   272
point.tbody.content =
patrick@73
   273
   point.row+
patrick@73
   274
patrick@73
   275
# ~~~~~~ row
patrick@73
   276
blanks.row = element row { row.attribute, blanks.row.content }
patrick@73
   277
point.row = element row { row.attribute, point.row.content }
patrick@73
   278
patrick@73
   279
blanks.row.content =
patrick@73
   280
  blanks.entry+
patrick@73
   281
point.row.content =
patrick@73
   282
  point.entry+
patrick@73
   283
patrick@73
   284
# ~~~~~~ entry
patrick@73
   285
blanks.entry = element entry { blanks.entry.content }
patrick@73
   286
point.entry = element entry { point.entry.content }
patrick@73
   287
patrick@73
   288
blanks.entry.content =
patrick@75
   289
   blanks.inlines
patrick@73
   290
 | (p | media)+
patrick@73
   291
patrick@73
   292
point.entry.content =
patrick@75
   293
   point.inlines
patrick@73
   294
 | (p | media)+
patrick@73
   295
patrick@73
   296
patrick@73
   297
# ~~~~~~~~~~~~~~~~~~~~~~~~ choices.right, choices.wrong ~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   298
patrick@73
   299
choices.right = element right { choices.right.content }
patrick@73
   300
choices.wrong = element wrong { choices.right.content }
patrick@73
   301
patrick@73
   302
choices.right.content =
patrick@73
   303
   inlines
patrick@73
   304
 | p+
patrick@73
   305
patrick@73
   306
patrick@73
   307
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks.wrongs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   308
patrick@73
   309
# ~~~~~~ blanks.wrongs
patrick@73
   310
blanks.wrongs = element wrongs { blanks.wrongs.content }
patrick@73
   311
patrick@73
   312
blanks.wrongs.content =
patrick@73
   313
   blanks.wrong+
patrick@73
   314
patrick@73
   315
# ~~~~~~ blanks.wrong
patrick@73
   316
blanks.wrong = element wrong { blanks.wrong.content }
patrick@73
   317
patrick@73
   318
blanks.wrong.content = text
patrick@73
   319
patrick@73
   320
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ match ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   321
patrick@73
   322
match = element match { match.content }
patrick@73
   323
patrick@73
   324
match.content =
patrick@73
   325
   (p | section),
patrick@73
   326
   (p | section)
patrick@73
   327
patrick@75
   328
# ~~~~~~~~~~~~~~~~~~~~~~~~ (sort) comparison, item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   329
patrick@73
   330
# ~~~~~~ comparison
patrick@73
   331
comparison = element comparison { comparison.content }
patrick@73
   332
patrick@73
   333
comparison.content = inlines
patrick@73
   334
patrick@73
   335
# ~~~~~~ sort.item
patrick@73
   336
sort.item = element item { sort.item.attributes, sort.item.content }
patrick@73
   337
patrick@73
   338
sort.item.attributes =
patrick@73
   339
   item.shuffle.attribute?
patrick@73
   340
item.shuffle.attribute = attribute shuffle { xsd:integer }
patrick@73
   341
patrick@73
   342
sort.item.content = inlines
patrick@73
   343
patrick@73
   344
patrick@73
   345
# =============================================================================
patrick@73
   346
#                                 INLINE LEVEL
patrick@73
   347
# =============================================================================
patrick@73
   348
patrick@75
   349
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@75
   350
patrick@75
   351
blanks.inlines = mixed {
patrick@75
   352
   sup*
patrick@75
   353
 & sub*
patrick@75
   354
 & var*
patrick@75
   355
 & number*
patrick@75
   356
 & math*
patrick@75
   357
 & date*
patrick@75
   358
 & name*
patrick@75
   359
 & note*
patrick@75
   360
 & foreign*
patrick@75
   361
 & highlight*
patrick@75
   362
 & mentioned*
patrick@75
   363
 & quote*
patrick@75
   364
 & acronym*
patrick@75
   365
 & term*
patrick@75
   366
 & link*
patrick@75
   367
 & anchor*
patrick@75
   368
 & blank*
patrick@75
   369
}
patrick@75
   370
point.inlines = mixed {
patrick@75
   371
   sup*
patrick@75
   372
 & sub*
patrick@75
   373
 & var*
patrick@75
   374
 & number*
patrick@75
   375
 & math*
patrick@75
   376
 & date*
patrick@75
   377
 & name*
patrick@75
   378
 & note*
patrick@75
   379
 & foreign*
patrick@75
   380
 & highlight*
patrick@75
   381
 & mentioned*
patrick@75
   382
 & quote*
patrick@75
   383
 & acronym*
patrick@75
   384
 & term*
patrick@75
   385
 & link*
patrick@75
   386
 & anchor*
patrick@75
   387
 & blank*
patrick@75
   388
 & point.right*
patrick@75
   389
 & point.wrong*
patrick@75
   390
}
patrick@75
   391
patrick@73
   392
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blank ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   393
patrick@73
   394
# ~~~~~~ blank
patrick@73
   395
blank = element blank { blank.content }
patrick@73
   396
patrick@73
   397
blank.content =
patrick@73
   398
   text
patrick@73
   399
 | (s+, help?, commentary?)
patrick@73
   400
patrick@73
   401
# ~~~~~~ s
patrick@73
   402
s = element s { s.content }
patrick@73
   403
patrick@73
   404
s.content = text
patrick@73
   405
patrick@73
   406
# ~~~~~~~~~~~~~~~~~~~~~~~~~ point.right, point.wrong ~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   407
patrick@73
   408
point.right = element right { point.right.content }
patrick@73
   409
point.wrong = element wrong { point.right.content }
patrick@73
   410
patrick@73
   411
point.right.content = inlines