Skip to content

Commit

Permalink
Allow content outside divisions in divided peripheral books
Browse files Browse the repository at this point in the history
  • Loading branch information
klassenjm committed Mar 22, 2019
1 parent 721ca17 commit 8223ce2
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 58 deletions.
54 changes: 33 additions & 21 deletions schema/usx.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Peripheral = (
attribute version { xsd:string { minLength = "3" pattern = "\d+\.\d+(\.\d+)?"} },
attribute xsi:noNamespaceSchemaLocation { text }?,

(PeripheralBook | PeripheralBookSection)
(PeripheralBook | PeripheralDividedBook)
}
)

Expand All @@ -45,23 +45,11 @@ PeripheralBook = (
PeripheralContent+
)

PeripheralBookSection = (
PeripheralBookSectionIdentification,
element periph {
attribute id {
Peripheral.FRT.periph.id.enum
| Peripheral.INT.periph.id.enum
| Peripheral.BAK.periph.id.enum
| Peripheral.OTH.periph.id.enum
| xsd:string { pattern = "x\-[\w_\-\.:]+" } },
attribute alt { text }?,

BookHeaders*,
BookTitles+,
BookIntroduction*,
BookIntroductionEndTitles*,
PeripheralContent+
}
PeripheralDividedBook = (
PeripheralDividedBookIdentification,

(PeripheralDivision | PeripheralOther)

)

BookIdentification =
Expand Down Expand Up @@ -187,13 +175,13 @@ PeripheralBookIdentification.book.code.enum = (
| "NDX" # Names Index
)

PeripheralBookSectionIdentification =
PeripheralDividedBookIdentification =
element book {
attribute code { PeripheralBookSectionIdentification.book.code.enum }, # e.g. code="FRT"
attribute code { PeripheralDividedBookIdentification.book.code.enum }, # e.g. code="FRT"
attribute style { "id" },
text? # Brief description of the project (optional)
}
PeripheralBookSectionIdentification.book.code.enum = (
PeripheralDividedBookIdentification.book.code.enum = (
"XXA" # Extra A, e.g. a hymnal
| "XXB" # Extra B
| "XXC" # Extra C
Expand All @@ -206,6 +194,22 @@ PeripheralBookSectionIdentification.book.code.enum = (
| "OTH" # Other Matter
| "INT" # Introduction
)

PeripheralDivision =
element periph {
attribute id {
Peripheral.FRT.periph.id.enum
| Peripheral.INT.periph.id.enum
| Peripheral.BAK.periph.id.enum
| Peripheral.OTH.periph.id.enum
| xsd:string { pattern = "x\-[\w_\-\.:]+" } },
attribute alt { text }?,
BookHeaders*,
BookTitles+,
BookIntroduction*,
BookIntroductionEndTitles*,
PeripheralContent+
}
Peripheral.FRT.periph.id.enum = (
"title"
| "halftitle"
Expand Down Expand Up @@ -242,6 +246,14 @@ Peripheral.OTH.periph.id.enum = (
| "spine"
)

PeripheralOther = (
BookHeaders*,
BookTitles*,
BookIntroduction*,
BookIntroductionEndTitles*,
PeripheralContent*
)

BookHeaders =
element para {
attribute style { BookHeaders.para.style.enum }, text?
Expand Down
97 changes: 60 additions & 37 deletions schema/usx.rng
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</optional>
<choice>
<ref name="PeripheralBook"/>
<ref name="PeripheralBookSection"/>
<ref name="PeripheralDividedBook"/>
</choice>
</element>
</define>
Expand All @@ -85,39 +85,12 @@
<ref name="PeripheralContent"/>
</oneOrMore>
</define>
<define name="PeripheralBookSection">
<ref name="PeripheralBookSectionIdentification"/>
<element name="periph">
<attribute name="id">
<choice>
<ref name="Peripheral.FRT.periph.id.enum"/>
<ref name="Peripheral.INT.periph.id.enum"/>
<ref name="Peripheral.BAK.periph.id.enum"/>
<ref name="Peripheral.OTH.periph.id.enum"/>
<data type="string">
<param name="pattern">x\-[\w_\-\.:]+</param>
</data>
</choice>
</attribute>
<optional>
<attribute name="alt"/>
</optional>
<zeroOrMore>
<ref name="BookHeaders"/>
</zeroOrMore>
<oneOrMore>
<ref name="BookTitles"/>
</oneOrMore>
<zeroOrMore>
<ref name="BookIntroduction"/>
</zeroOrMore>
<zeroOrMore>
<ref name="BookIntroductionEndTitles"/>
</zeroOrMore>
<oneOrMore>
<ref name="PeripheralContent"/>
</oneOrMore>
</element>
<define name="PeripheralDividedBook">
<ref name="PeripheralDividedBookIdentification"/>
<choice>
<ref name="PeripheralDivision"/>
<ref name="PeripheralOther"/>
</choice>
</define>
<define name="BookIdentification">
<element name="book">
Expand Down Expand Up @@ -371,11 +344,11 @@
</choice>
<!-- Names Index -->
</define>
<define name="PeripheralBookSectionIdentification">
<define name="PeripheralDividedBookIdentification">
<element name="book">
<group>
<attribute name="code">
<ref name="PeripheralBookSectionIdentification.book.code.enum"/>
<ref name="PeripheralDividedBookIdentification.book.code.enum"/>
</attribute>
<!-- e.g. code="FRT" -->
<attribute name="style">
Expand All @@ -388,7 +361,7 @@
<!-- Brief description of the project (optional) -->
</element>
</define>
<define name="PeripheralBookSectionIdentification.book.code.enum">
<define name="PeripheralDividedBookIdentification.book.code.enum">
<choice>
<value>XXA</value>
<!-- Extra A, e.g. a hymnal -->
Expand All @@ -414,6 +387,39 @@
</choice>
<!-- Introduction -->
</define>
<define name="PeripheralDivision">
<element name="periph">
<attribute name="id">
<choice>
<ref name="Peripheral.FRT.periph.id.enum"/>
<ref name="Peripheral.INT.periph.id.enum"/>
<ref name="Peripheral.BAK.periph.id.enum"/>
<ref name="Peripheral.OTH.periph.id.enum"/>
<data type="string">
<param name="pattern">x\-[\w_\-\.:]+</param>
</data>
</choice>
</attribute>
<optional>
<attribute name="alt"/>
</optional>
<zeroOrMore>
<ref name="BookHeaders"/>
</zeroOrMore>
<oneOrMore>
<ref name="BookTitles"/>
</oneOrMore>
<zeroOrMore>
<ref name="BookIntroduction"/>
</zeroOrMore>
<zeroOrMore>
<ref name="BookIntroductionEndTitles"/>
</zeroOrMore>
<oneOrMore>
<ref name="PeripheralContent"/>
</oneOrMore>
</element>
</define>
<define name="Peripheral.FRT.periph.id.enum">
<choice>
<value>title</value>
Expand Down Expand Up @@ -457,6 +463,23 @@
<value>spine</value>
</choice>
</define>
<define name="PeripheralOther">
<zeroOrMore>
<ref name="BookHeaders"/>
</zeroOrMore>
<zeroOrMore>
<ref name="BookTitles"/>
</zeroOrMore>
<zeroOrMore>
<ref name="BookIntroduction"/>
</zeroOrMore>
<zeroOrMore>
<ref name="BookIntroductionEndTitles"/>
</zeroOrMore>
<zeroOrMore>
<ref name="PeripheralContent"/>
</zeroOrMore>
</define>
<define name="BookHeaders">
<element name="para">
<attribute name="style">
Expand Down

0 comments on commit 8223ce2

Please sign in to comment.