RelaxNG/publiquiz.rnc
changeset 336 15beef04b08c
parent 313 e4f154ea2837
child 337 fc5a30e23d0d
equal deleted inserted replaced
335:b12500fa2400 336:15beef04b08c
    76 # =============================================================================
    76 # =============================================================================
    77 
    77 
    78 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    78 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    79 
    79 
    80 blanks.section = element section { section.attributes, blanks.section.content }
    80 blanks.section = element section { section.attributes, blanks.section.content }
    81 point.section = element section { section.attributes, point.section.content }
    81 pointing.section = element section {
       
    82    section.attributes, pointing.section.content }
    82 
    83 
    83 blanks.section.content =
    84 blanks.section.content =
    84    section.head?,
    85    section.head?,
    85    (blanks.section+ | blanks.block+)
    86    (blanks.section+ | blanks.block+)
    86 point.section.content =
    87 pointing.section.content =
    87    section.head?,
    88    section.head?,
    88    (point.section+ | point.block+)
    89    (pointing.section+ | pointing.block+)
    89 
    90 
    90 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ instructions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    91 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ instructions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    91 
    92 
    92 instructions = element instructions { section.content }
    93 instructions = element instructions { section.content }
    93 
    94 
    97    choices-radio
    98    choices-radio
    98  | choices-check
    99  | choices-check
    99  | blanks-fill
   100  | blanks-fill
   100  | blanks-select
   101  | blanks-select
   101  | blanks-char
   102  | blanks-char
   102  | point
   103  | pointing
       
   104  | pointing-categories
   103  | matching
   105  | matching
   104  | sort
   106  | sort
   105  | categories
   107  | categories
   106  | pip
   108  | pip
   107  | production
   109  | production
   142    (blanks.block+ | blanks.section+)
   144    (blanks.block+ | blanks.section+)
   143 blanks-select.content =
   145 blanks-select.content =
   144    blanks.wrongs?,
   146    blanks.wrongs?,
   145    (blanks.block+ | blanks.section+)
   147    (blanks.block+ | blanks.section+)
   146 
   148 
   147 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   149 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pointing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   148 
   150 
   149 point = element point { point.attributes, point.content }
   151 pointing = element pointing { pointing.attributes, pointing.content }
   150 
   152 
   151 point.attributes =
   153 pointing.attributes =
   152    point.type.attribute?
   154    pointing.type.attribute?
   153 point.type.attribute = attribute type {
   155 pointing.type.attribute = attribute type { "radio" | "check" }
   154    "radio" | "radio_button" | "check" | "check_button" }
   156 
   155 
   157 pointing.content =
   156 point.content =
   158    (pointing.section+ | pointing.block+)
   157    (point.section+ | point.block+)
   159 
       
   160 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pointing-categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   161 
       
   162 # ~~~~~~ pointing-categories
       
   163 pointing-categories = element pointing-categories { pointing-c.content }
       
   164 
       
   165 pointing-c.content =
       
   166    pointing-c.categories,
       
   167    pointing.section
       
   168 
       
   169 # ~~~~~~ pointing-c.categories
       
   170 pointing-c.categories = element categories { pointing-c.categories.content }
       
   171 
       
   172 pointing-c.categories.content =
       
   173    pointing-c.category1,
       
   174    pointing-c.category2,
       
   175    (pointing-c.category3,
       
   176       (pointing-c.category4, pointing-c.category5?)?)?
       
   177 
       
   178 # ~~~~~~ pointing-c.categoryN
       
   179 pointing-c.category1 = element category {
       
   180    attribute id { "1" }, pointing-c.category.content }
       
   181 pointing-c.category2 = element category {
       
   182    attribute id { "2" }, pointing-c.category.content }
       
   183 pointing-c.category3 = element category {
       
   184    attribute id { "3" }, pointing-c.category.content }
       
   185 pointing-c.category4 = element category {
       
   186    attribute id { "4" }, pointing-c.category.content }
       
   187 pointing-c.category5 = element category {
       
   188    attribute id { "5" }, pointing-c.category.content }
       
   189 
       
   190 pointing-c.category.content = inlines
       
   191 
   158 
   192 
   159 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   160 
   194 
   161 # ~~~~~~ matching
   195 # ~~~~~~ matching
   162 matching = element matching { matching.attributes, matching.content }
   196 matching = element matching { matching.attributes, matching.content }
   275 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   309 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   276 
   310 
   277 blanks.block = (
   311 blanks.block = (
   278    blanks.p | blanks.list | blanks.blockquote | blanks.speech | blanks.table
   312    blanks.p | blanks.list | blanks.blockquote | blanks.speech | blanks.table
   279  | blanks.media)
   313  | blanks.media)
   280 point.block = (
   314 pointing.block = (
   281    point.p | point.list | point.blockquote | point.speech | point.table | media)
   315    pointing.p | pointing.list | pointing.blockquote | pointing.speech
       
   316  | pointing.table | media)
   282 
   317 
   283 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   318 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   284 
   319 
   285 blanks.p = element p { blanks.p.content }
   320 blanks.p = element p { blanks.p.content }
   286 point.p = element p { point.p.content }
   321 pointing.p = element p { pointing.p.content }
   287 
   322 
   288 blanks.p.content =
   323 blanks.p.content =
   289    blanks.inlines
   324    blanks.inlines
   290 point.p.content =
   325 pointing.p.content =
   291    point.inlines
   326    pointing.inlines
   292 
   327 
   293 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   328 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   294 
   329 
   295 # ~~~~~~ list
   330 # ~~~~~~ list
   296 blanks.list = element list {
   331 blanks.list = element list {
   297    block.head?,
   332    block.head?,
   298    (  (attribute type {"ordered"}?, blanks.item, blanks.item+)
   333    (  (attribute type {"ordered"}?, blanks.item, blanks.item+)
   299     | (attribute type {"glossary"}, glossary.item+) )
   334     | (attribute type {"glossary"}, glossary.item+) )
   300 }
   335 }
   301 point.list = element list {
   336 pointing.list = element list {
   302    block.head?,
   337    block.head?,
   303    (  (attribute type {"ordered"}?, point.item, point.item+)
   338    (  (attribute type {"ordered"}?, pointing.item, pointing.item+)
   304     | (attribute type {"glossary"}, glossary.item+) )
   339     | (attribute type {"glossary"}, glossary.item+) )
   305 }
   340 }
   306 
   341 
   307 # ~~~~~~ item
   342 # ~~~~~~ item
   308 blanks.item = element item { blanks.item.content }
   343 blanks.item = element item { blanks.item.content }
   309 point.item = element item { point.item.content }
   344 pointing.item = element item { pointing.item.content }
   310 
   345 
   311 blanks.item.content =
   346 blanks.item.content =
   312    blanks.inlines
   347    blanks.inlines
   313  | blanks.block+
   348  | blanks.block+
   314 point.item.content =
   349 pointing.item.content =
   315    point.inlines
   350    pointing.inlines
   316  | point.block+
   351  | pointing.block+
   317 
   352 
   318 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   353 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   319 
   354 
   320 blanks.blockquote = element blockquote {
   355 blanks.blockquote = element blockquote {
   321    blockquote.attributes, blanks.blockquote.content }
   356    blockquote.attributes, blanks.blockquote.content }
   322 point.blockquote = element blockquote {
   357 pointing.blockquote = element blockquote {
   323    blockquote.attributes, point.blockquote.content }
   358    blockquote.attributes, pointing.blockquote.content }
   324 
   359 
   325 blanks.blockquote.content =
   360 blanks.blockquote.content =
   326    block.head?,
   361    block.head?,
   327    (blanks.p | speech | blanks.list)+,
   362    (blanks.p | speech | blanks.list)+,
   328    attribution?
   363    attribution?
   329 point.blockquote.content =
   364 pointing.blockquote.content =
   330    block.head?,
   365    block.head?,
   331    (point.p | speech | point.list)+,
   366    (pointing.p | speech | pointing.list)+,
   332    attribution?
   367    attribution?
   333 
   368 
   334 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   369 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   335 
   370 
   336 # ~~~~~~ speech
   371 # ~~~~~~ speech
   337 blanks.speech = element speech { blanks.speech.content }
   372 blanks.speech = element speech { blanks.speech.content }
   338 point.speech = element speech { point.speech.content }
   373 pointing.speech = element speech { pointing.speech.content }
   339 
   374 
   340 blanks.speech.content =
   375 blanks.speech.content =
   341    blanks.speaker?,
   376    blanks.speaker?,
   342    stage?,
   377    stage?,
   343    (blanks.p | blanks.blockquote)+
   378    (blanks.p | blanks.blockquote)+
   344 point.speech.content =
   379 pointing.speech.content =
   345    point.speaker?,
   380    pointing.speaker?,
   346    stage?,
   381    stage?,
   347    (point.p | point.blockquote)+
   382    (pointing.p | pointing.blockquote)+
   348 
   383 
   349 # ~~~~~~ speaker
   384 # ~~~~~~ speaker
   350 blanks.speaker = element speaker { blanks.speaker.content }
   385 blanks.speaker = element speaker { blanks.speaker.content }
   351 point.speaker = element speaker { point.speaker.content }
   386 pointing.speaker = element speaker { pointing.speaker.content }
   352 
   387 
   353 blanks.speaker.content = blanks.inlines
   388 blanks.speaker.content = blanks.inlines
   354 point.speaker.content = point.inlines
   389 pointing.speaker.content = pointing.inlines
   355 
   390 
   356 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   391 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   357 
   392 
   358 # ~~~~~~ table
   393 # ~~~~~~ table
   359 blanks.table = element table { table.attributes, blanks.table.content }
   394 blanks.table = element table { table.attributes, blanks.table.content }
   360 point.table = element table { table.attributes, point.table.content }
   395 pointing.table = element table { table.attributes, pointing.table.content }
   361 
   396 
   362 blanks.table.content =
   397 blanks.table.content =
   363    block.head?,
   398    block.head?,
   364    thead?,
   399    thead?,
   365    (blanks.tbody+ | blanks.tr+),
   400    (blanks.tbody+ | blanks.tr+),
   366    blanks.table.caption?
   401    blanks.table.caption?
   367 point.table.content =
   402 pointing.table.content =
   368    block.head?,
   403    block.head?,
   369    (point.tbody+ | point.tr+),
   404    (pointing.tbody+ | pointing.tr+),
   370    point.table.caption?
   405    pointing.table.caption?
   371 
   406 
   372 # ~~~~~~ tbody
   407 # ~~~~~~ tbody
   373 blanks.tbody = element tbody { blanks.tbody.content }
   408 blanks.tbody = element tbody { blanks.tbody.content }
   374 point.tbody = element tbody { point.tbody.content }
   409 pointing.tbody = element tbody { pointing.tbody.content }
   375 
   410 
   376 blanks.tbody.content =
   411 blanks.tbody.content =
   377    blanks.tr+
   412    blanks.tr+
   378 point.tbody.content =
   413 pointing.tbody.content =
   379    point.tr+
   414    pointing.tr+
   380 
   415 
   381 # ~~~~~~ tr
   416 # ~~~~~~ tr
   382 blanks.tr = element tr { tr.attributes, blanks.tr.content }
   417 blanks.tr = element tr { tr.attributes, blanks.tr.content }
   383 point.tr = element tr { tr.attributes, point.tr.content }
   418 pointing.tr = element tr { tr.attributes, pointing.tr.content }
   384 
   419 
   385 blanks.tr.content =
   420 blanks.tr.content =
   386   (blanks.td | blanks.th)+
   421   (blanks.td | blanks.th)+
   387 point.tr.content =
   422 pointing.tr.content =
   388   (point.td | point.th)+
   423   (pointing.td | pointing.th)+
   389 
   424 
   390 # ~~~~~~ td, th
   425 # ~~~~~~ td, th
   391 blanks.td = element td { td.attributes, blanks.td.content }
   426 blanks.td = element td { td.attributes, blanks.td.content }
   392 blanks.th = element th { td.attributes, blanks.td.content }
   427 blanks.th = element th { td.attributes, blanks.td.content }
   393 point.td = element td { td.attributes, point.td.content }
   428 pointing.td = element td { td.attributes, pointing.td.content }
   394 point.th = element th { td.attributes, point.td.content }
   429 pointing.th = element th { td.attributes, pointing.td.content }
   395 
   430 
   396 blanks.td.content =
   431 blanks.td.content =
   397    blanks.inlines
   432    blanks.inlines
   398  | (blanks.p | blanks.media)+
   433  | (blanks.p | blanks.media)+
   399 
   434 
   400 point.td.content =
   435 pointing.td.content =
   401    point.inlines
   436    pointing.inlines
   402  | (point.p | media)+
   437  | (pointing.p | media)+
   403 
   438 
   404 # ~~~~~~ table.caption
   439 # ~~~~~~ table.caption
   405 blanks.table.caption = element caption { blanks.caption.content }
   440 blanks.table.caption = element caption { blanks.caption.content }
   406 point.table.caption = element caption { point.caption.content }
   441 pointing.table.caption = element caption { pointing.caption.content }
   407 
   442 
   408 blanks.caption.content =
   443 blanks.caption.content =
   409    blanks.inlines
   444    blanks.inlines
   410  | (blanks.p | speech | blanks.list | blockquote)+
   445  | (blanks.p | speech | blanks.list | blockquote)+
   411 point.caption.content =
   446 pointing.caption.content =
   412    point.inlines
   447    pointing.inlines
   413  | (point.p | speech | point.list | blockquote)+
   448  | (pointing.p | speech | pointing.list | blockquote)+
   414 
   449 
   415 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   450 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   416 
   451 
   417 # ~~~~~~ media
   452 # ~~~~~~ media
   418 blanks.media = element media { media.attributes, blanks.media.content }
   453 blanks.media = element media { media.attributes, blanks.media.content }
   419 point.media = element media { media.attributes, point.media.content }
   454 pointing.media = element media { media.attributes, pointing.media.content }
   420 
   455 
   421 blanks.media.content =
   456 blanks.media.content =
   422    block.head?,
   457    block.head?,
   423    (blanks.image | audio | video)+,
   458    (blanks.image | audio | video)+,
   424    blanks.media.caption?,
   459    blanks.media.caption?,
   425    link?
   460    link?
   426 point.media.content =
   461 pointing.media.content =
   427    block.head?,
   462    block.head?,
   428    (image | audio | video)+,
   463    (image | audio | video)+,
   429    point.media.caption?,
   464    pointing.media.caption?,
   430    link?
   465    link?
   431 
   466 
   432 # ~~~~~~ blanks.image
   467 # ~~~~~~ blanks.image
   433 blanks.image = element image { image.attributes, blanks.image.content }
   468 blanks.image = element image { image.attributes, blanks.image.content }
   434 pip.image = element image { image.attributes, pip.image.content }
   469 pip.image = element image { image.attributes, pip.image.content }
   460    image?
   495    image?
   461 
   496 
   462 # ~~~~~~ media.caption
   497 # ~~~~~~ media.caption
   463 blanks.media.caption = element caption {
   498 blanks.media.caption = element caption {
   464    caption.attributes, blanks.caption.content }
   499    caption.attributes, blanks.caption.content }
   465 point.media.caption = element caption {
   500 pointing.media.caption = element caption {
   466    caption.attributes, point.caption.content }
   501    caption.attributes, pointing.caption.content }
   467 
   502 
   468 # ~~~~~~~~~~~~~~~~~~~~~~~~ choices.right, choices.wrong ~~~~~~~~~~~~~~~~~~~~~~~
   503 # ~~~~~~~~~~~~~~~~~~~~~~~~ choices.right, choices.wrong ~~~~~~~~~~~~~~~~~~~~~~~
   469 
   504 
   470 choices.right = element right { choices.right.content }
   505 choices.right = element right { choices.right.content }
   471 choices.wrong = element wrong { choices.right.content }
   506 choices.wrong = element wrong { choices.right.content }
   557  & index*
   592  & index*
   558 
   593 
   559  & blank*
   594  & blank*
   560 }
   595 }
   561 
   596 
   562 point.inlines = mixed {
   597 pointing.inlines = mixed {
   563    sup*
   598    sup*
   564  & sub*
   599  & sub*
   565  & var*
   600  & var*
   566  & number*
   601  & number*
   567  & math*
   602  & math*
   585  & note*
   620  & note*
   586  & link*
   621  & link*
   587  & anchor*
   622  & anchor*
   588  & index*
   623  & index*
   589 
   624 
   590  & blank*
   625  & point*
   591  & point.right*
       
   592  & point.wrong*
       
   593 }
   626 }
   594 
   627 
   595 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blank ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   628 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blank ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   596 
   629 
   597 # ~~~~~~ blank
   630 # ~~~~~~ blank
   608 # ~~~~~~ s
   641 # ~~~~~~ s
   609 s = element s { s.content }
   642 s = element s { s.content }
   610 
   643 
   611 s.content = text
   644 s.content = text
   612 
   645 
   613 # ~~~~~~~~~~~~~~~~~~~~~~~~~ point.right, point.wrong ~~~~~~~~~~~~~~~~~~~~~~~~~~
   646 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   614 
   647 
   615 point.right = element right { point.right.content }
   648 point = element point { point.attributes, point.content }
   616 point.wrong = element wrong { point.right.content }
   649 
   617 
   650 point.attributes =
   618 point.right.content = inlines
   651    point.ref.attribute?
       
   652 point.value.attribute = attribute ref { "right" | "1" | "2" | "3" | "4" | "5" }
       
   653 
       
   654 point.content = simple.inlines