RelaxNG/publidoc.rnc
changeset 310 13939fb7824a
parent 309 b748affd5db2
child 312 7f6b762880b4
--- a/RelaxNG/publidoc.rnc	mer. avril 16 13:07:05 2014 +0200
+++ b/RelaxNG/publidoc.rnc	jeu. avril 24 20:36:03 2014 +0200
@@ -18,6 +18,172 @@
 
 
 # =============================================================================
+#                                 HEAD LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+title = element title { title.content }
+shorttitle = element shorttitle { title.content }
+subtitle = element subtitle { title.content }
+
+title.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ identifier
+identifier = element identifier {
+   (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
+ | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
+}
+
+# ~~~~~~ identifier.ean
+identifier.ean = element identifier {
+   attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
+}
+
+# ~~~~~~ identifier.uri
+identifier.uri = element identifier {
+   attribute type { "uri" }, for.attribute?, xsd:anyURI
+}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+copyright = element copyright { copyright.content }
+
+copyright.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+collection = element collection { collection.content }
+
+collection.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ contributors
+contributors = element contributors { contributors.content }
+
+contributors.content =
+   contributor+
+
+# ~~~~~~ contributor
+contributor = element contributor { contributor.content }
+
+contributor.content =
+   identifier.uri?,
+   (((firstname, secondname?)?, lastname) | label),
+   address?,
+   link?,
+   role+
+
+# ~~~~~~ firstname, secondname, lastname, label
+firstname = element firstname { firstname.content }
+secondname = element secondname { secondname.content }
+lastname = element lastname { lastname.content }
+label = element label { label.content }
+
+firstname.content = simple.inlines
+secondname.content = simple.inlines
+lastname.content = simple.inlines
+label.content = simple.inlines
+
+# ~~~~~~ address
+address = element address { address.content }
+
+address.content = simple.inlines
+
+# ~~~~~~ role
+role = element role { role.content }
+
+role.content = "author" | "illustrator" | "publisher" | "packager"
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+place = element place { place.content }
+
+place.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+source = element source {
+   (  (attribute type { "book" }, bibliography.entry.content)
+    | (attribute type { "file" }, source.content.file)),
+   source.content
+}
+
+source.content.file =
+   identifier.uri
+source.content =
+   annotation*
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ keywordset
+keywordset = element keywordset { keywordset.content }
+
+keywordset.content = keyword+
+
+# ~~~~~~ keyword
+keyword = element keyword { keyword.content }
+
+keyword.content = simple.inlines
+
+# ~~~~~~ subjectset
+subjectset = element subjectset { subjectset.content }
+
+subjectset.content = subject+
+
+# ~~~~~~ subject
+subject = element subject { subject.content }
+
+subject.content = simple.inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ index
+index = element index { index.content }
+head.index = element index { head.index.content }
+
+index.content =
+   (index.w, index.entry?)
+ | (index.entry, (index.w | index.entry)?)
+head.index.content =
+   index.entry, index.entry?
+
+# ~~~~~~ index.w
+index.w = element w { simple.inlines }
+
+# ~~~~~~ index.entry
+index.entry = element entry { simple.inlines }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+abstract = element abstract { abstract.content }
+
+abstract.content =
+   p+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+cover = element cover { cover.content }
+
+cover.content =
+   cover.image
+
+cover.image = element image { cover.image.attributes }
+
+cover.image.attributes =
+   media.id.attribute
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+annotation = element annotation { annotation.content }
+
+annotation.content = inlines
+
+
+# =============================================================================
 #                                  TOP LEVEL
 # =============================================================================
 
@@ -43,7 +209,6 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ document
 document = element document { document.attributes, document.content }
 
 document.attributes =
@@ -58,7 +223,7 @@
    top.head?,
    (division | topic)+
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 top.topic = element topic { top.topic.attributes, top.topic.content }
 
@@ -80,9 +245,18 @@
 #                                 DIVISION LEVEL
 # =============================================================================
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+division.head = element head { division.head.content }
+
+division.head.content =
+   (title, shorttitle?, subtitle*)?
+ & head.index*
+ & abstract?
+ & annotation*
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ division
 division = element division { division.attributes, division.content }
 
 division.attributes =
@@ -94,16 +268,8 @@
    front?,
    (division | topic)+
 
-# ~~~~~~ division.head
-division.head = element head { division.head.content }
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ front ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-division.head.content =
-   (title, shorttitle?, subtitle*)?
- & head.index*
- & abstract?
- & annotation*
-
-# ~~~~~~ front
 front = element front { front.content }
 
 front.content =
@@ -150,6 +316,19 @@
 #                                 SECTION LEVEL
 # =============================================================================
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+section.head = element head { section.head.content }
+
+section.head.content =
+   (title, shorttitle?, subtitle*)?
+ & keywordset?
+ & subjectset?
+ & head.index*
+ & abstract?
+ & audio*
+ & annotation*
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 header = element header { header.content }
@@ -159,7 +338,6 @@
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ section
 section = element section { section.attributes, section.content }
 
 section.attributes =
@@ -174,21 +352,8 @@
    section.head?,
    (section+ | block+)
 
-# ~~~~~~ section.head
-section.head = element head { section.head.content }
-
-section.head.content =
-   (title, shorttitle?, subtitle*)?
- & keywordset?
- & subjectset?
- & head.index*
- & abstract?
- & audio*
- & annotation*
-
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliography ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ bibliography
 bibliography = element bibliography { bibliography.content }
 
 bibliography.content =
@@ -206,18 +371,18 @@
 #                                 BLOCK LEVEL
 # =============================================================================
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-# ~~~~~~ block
-block = (p | speech | \list | blockquote | table | table.cals | media)
-
-# ~~~~~~ block.head
 block.head = element head { block.head.content }
 
 block.head.content =
    (title, shorttitle?, subtitle*)?
  & head.index*
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+block = (p | speech | \list | blockquote | table | table.cals | media)
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 p = element p { p.content }
@@ -271,7 +436,7 @@
 blockquote.attributes =
    blockquote.type.attribute?
 blockquote.type.attribute = attribute type { xsd:NCName }
-   
+
 blockquote.content =
    block.head?,
    (p | speech | \list)+,
@@ -458,12 +623,12 @@
 h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 hotspot.display.attribute = attribute display { "normal" | "visible" | "pulse" }
 hotspot.type.attribute = attribute type { xsd:NCName }
-   
+
 hotspot.content =
    ((link | p+ | image | audio | video), (spot, scenario?)?)
  | (spot, scenario?)
- | empty 
-   
+ | empty
+
 # ~~~~~~ spot
 spot = element spot { spot.attributes, spot.content }
 
@@ -544,172 +709,6 @@
 
 
 # =============================================================================
-#                                 HEAD LEVEL
-# =============================================================================
-
-# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
-
-title = element title { title.content }
-shorttitle = element shorttitle { title.content }
-subtitle = element subtitle { title.content }
-
-title.content = inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ identifier
-identifier = element identifier {
-   (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
- | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
-}
-
-# ~~~~~~ identifier.ean
-identifier.ean = element identifier {
-   attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
-}
-
-# ~~~~~~ identifier.uri
-identifier.uri = element identifier {
-   attribute type { "uri" }, for.attribute?, xsd:anyURI
-}
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-copyright = element copyright { copyright.content }
-
-copyright.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-collection = element collection { collection.content }
-
-collection.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ contributors
-contributors = element contributors { contributors.content }
-
-contributors.content =
-   contributor+
-
-# ~~~~~~ contributor
-contributor = element contributor { contributor.content }
-
-contributor.content =
-   identifier.uri?,
-   (((firstname, secondname?)?, lastname) | label),
-   address?,
-   link?,
-   role+
-
-# ~~~~~~ firstname, secondname, lastname, label
-firstname = element firstname { firstname.content }
-secondname = element secondname { secondname.content }
-lastname = element lastname { lastname.content }
-label = element label { label.content }
-
-firstname.content = simple.inlines
-secondname.content = simple.inlines
-lastname.content = simple.inlines
-label.content = simple.inlines
-
-# ~~~~~~ address
-address = element address { address.content }
-
-address.content = simple.inlines
-
-# ~~~~~~ role
-role = element role { role.content }
-
-role.content = "author" | "illustrator" | "publisher" | "packager"
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-place = element place { place.content }
-
-place.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-source = element source {
-   (  (attribute type { "book" }, bibliography.entry.content)
-    | (attribute type { "file" }, source.content.file)),
-   source.content
-}
-
-source.content.file =
-   identifier.uri
-source.content =
-   annotation*
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ keywordset
-keywordset = element keywordset { keywordset.content }
-
-keywordset.content = keyword+
-
-# ~~~~~~ keyword
-keyword = element keyword { keyword.content }
-
-keyword.content = simple.inlines
-
-# ~~~~~~ subjectset
-subjectset = element subjectset { subjectset.content }
-
-subjectset.content = subject+
-
-# ~~~~~~ subject
-subject = element subject { subject.content }
-
-subject.content = simple.inlines
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ index
-index = element index { index.content }
-head.index = element index { head.index.content }
-
-index.content =
-   (index.w, index.entry?)
- | (index.entry, (index.w | index.entry)?)
-head.index.content =
-   index.entry, index.entry?
-
-# ~~~~~~ index.w
-index.w = element w { simple.inlines }
-
-# ~~~~~~ index.entry
-index.entry = element entry { simple.inlines }
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-abstract = element abstract { abstract.content }
-
-abstract.content =
-   p+
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-cover = element cover { cover.content }
-
-cover.content =
-   cover.image
-
-cover.image = element image { cover.image.attributes }
-
-cover.image.attributes =
-   media.id.attribute
-   
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-annotation = element annotation { annotation.content }
-
-annotation.content = inlines
-
-
-# =============================================================================
 #                                 INLINE LEVEL
 # =============================================================================