Skip to content

Commit

Permalink
simplification for Shale: #56
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jul 23, 2024
1 parent 92e00b8 commit 807d8be
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 102 deletions.
41 changes: 23 additions & 18 deletions grammars/biblio.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -65,41 +65,44 @@ LocalizedStringAttrs =
attribute locale { text }?,
attribute script { text }?

LocalizedString1 =
#LocalizedString1 =
LocalizedString =
# multiple languages and scripts possible: comma delimit them if so
LocalizedStringAttrs,
text

LocalizedString =
LocalizedString1 |
element variant { LocalizedString1 }+
#LocalizedString =
# LocalizedString1 |
# element variant { LocalizedString1 }+

LocalizedMarkedUpString1 =
#LocalizedMarkedUpString1 =
LocalizedMarkedUpString =
# multiple languages and scripts possible: comma delimit them if so
LocalizedStringAttrs,
TextElement+

LocalizedMarkedUpString =
LocalizedMarkedUpString1 |
element variant { LocalizedMarkedUpString1 }+
#LocalizedMarkedUpString =
# LocalizedMarkedUpString1 |
# element variant { LocalizedMarkedUpString1 }+

# Unlike UML, change type to format: type is overloaded
# Would be need if plain were default value and could omit the attribute
# Added LocalizedStringOrXsAny
FormattedString =
#FormattedString =
# attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?,
attribute format { ( "text/plain" | "text/html" | "application/docbook+xml" |
"application/tei+xml" | "text/x-asciidoc" | "text/markdown" | "application/x-metanorma+xml" | text ) }?,
LocalizedStringOrXsAny
# attribute format { ( "text/plain" | "text/html" | "application/docbook+xml" |
# "application/tei+xml" | "text/x-asciidoc" | "text/markdown" | "application/x-metanorma+xml" | text ) }?,
# LocalizedStringOrXsAny

LocalizedStringOrXsAny1 =
#LocalizedStringOrXsAny1 =
LocalizedStringOrXsAny =
# multiple languages and scripts possible: comma delimit them if so
LocalizedStringAttrs,
( text | AnyElement )+

LocalizedStringOrXsAny =
LocalizedStringOrXsAny1 |
element variant { LocalizedStringOrXsAny1 }+
#LocalizedStringOrXsAny =
# LocalizedStringOrXsAny1 |
# element variant { LocalizedStringOrXsAny1 }+

contributor =
element contributor {
Expand Down Expand Up @@ -130,7 +133,8 @@ credential = element credential { text }

FullNameType =
name_abbreviation?,
(( prefix*, forename*, formatted-initials?, surname, addition* ) | completeName ),
# (( prefix*, forename*, formatted-initials?, surname, addition* ) | completeName ),
prefix*, forename*, formatted-initials?, surname?, addition*, completeName?,
biblionote*, variantname*

name_abbreviation = element abbreviation { LocalizedString }
Expand Down Expand Up @@ -204,7 +208,8 @@ email = element email { text }
address =
element address {
# iso191606 TODO
(street*, city, state?, country, postcode? ) | formattedAddress
# (street*, city, state?, country, postcode? ) | formattedAddress
street*, city?, state?, country?, postcode?, formattedAddress?
}

street = element street { text }
Expand Down
149 changes: 65 additions & 84 deletions grammars/biblio.rng
Original file line number Diff line number Diff line change
Expand Up @@ -107,62 +107,42 @@
<attribute name="script"/>
</optional>
</define>
<define name="LocalizedString1">
<!-- LocalizedString1 = -->
<define name="LocalizedString">
<!-- multiple languages and scripts possible: comma delimit them if so -->
<ref name="LocalizedStringAttrs"/>
<text/>
</define>
<define name="LocalizedString">
<choice>
<ref name="LocalizedString1"/>
<oneOrMore>
<element name="variant">
<ref name="LocalizedString1"/>
</element>
</oneOrMore>
</choice>
</define>
<define name="LocalizedMarkedUpString1">
<!--
LocalizedString =
LocalizedString1 |
element variant { LocalizedString1 }+
-->
<!-- LocalizedMarkedUpString1 = -->
<define name="LocalizedMarkedUpString">
<!-- multiple languages and scripts possible: comma delimit them if so -->
<ref name="LocalizedStringAttrs"/>
<oneOrMore>
<ref name="TextElement"/>
</oneOrMore>
</define>
<define name="LocalizedMarkedUpString">
<choice>
<ref name="LocalizedMarkedUpString1"/>
<oneOrMore>
<element name="variant">
<ref name="LocalizedMarkedUpString1"/>
</element>
</oneOrMore>
</choice>
</define>
<!--
LocalizedMarkedUpString =
LocalizedMarkedUpString1 |
element variant { LocalizedMarkedUpString1 }+
-->
<!--
Unlike UML, change type to format: type is overloaded
Would be need if plain were default value and could omit the attribute
Added LocalizedStringOrXsAny
FormattedString =
attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?,
attribute format { ( "text/plain" | "text/html" | "application/docbook+xml" |
"application/tei+xml" | "text/x-asciidoc" | "text/markdown" | "application/x-metanorma+xml" | text ) }?,
LocalizedStringOrXsAny
-->
<define name="FormattedString">
<optional>
<!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
<attribute name="format">
<choice>
<value>text/plain</value>
<value>text/html</value>
<value>application/docbook+xml</value>
<value>application/tei+xml</value>
<value>text/x-asciidoc</value>
<value>text/markdown</value>
<value>application/x-metanorma+xml</value>
<text/>
</choice>
</attribute>
</optional>
<ref name="LocalizedStringOrXsAny"/>
</define>
<define name="LocalizedStringOrXsAny1">
<!-- LocalizedStringOrXsAny1 = -->
<define name="LocalizedStringOrXsAny">
<!-- multiple languages and scripts possible: comma delimit them if so -->
<ref name="LocalizedStringAttrs"/>
<oneOrMore>
Expand All @@ -172,16 +152,11 @@
</choice>
</oneOrMore>
</define>
<define name="LocalizedStringOrXsAny">
<choice>
<ref name="LocalizedStringOrXsAny1"/>
<oneOrMore>
<element name="variant">
<ref name="LocalizedStringOrXsAny1"/>
</element>
</oneOrMore>
</choice>
</define>
<!--
LocalizedStringOrXsAny =
LocalizedStringOrXsAny1 |
element variant { LocalizedStringOrXsAny1 }+
-->
<define name="contributor">
<element name="contributor">
<oneOrMore>
Expand Down Expand Up @@ -257,24 +232,25 @@
<optional>
<ref name="name_abbreviation"/>
</optional>
<choice>
<group>
<zeroOrMore>
<ref name="prefix"/>
</zeroOrMore>
<zeroOrMore>
<ref name="forename"/>
</zeroOrMore>
<optional>
<ref name="formatted-initials"/>
</optional>
<ref name="surname"/>
<zeroOrMore>
<ref name="addition"/>
</zeroOrMore>
</group>
<zeroOrMore>
<!-- (( prefix*, forename*, formatted-initials?, surname, addition* ) | completeName ), -->
<ref name="prefix"/>
</zeroOrMore>
<zeroOrMore>
<ref name="forename"/>
</zeroOrMore>
<optional>
<ref name="formatted-initials"/>
</optional>
<optional>
<ref name="surname"/>
</optional>
<zeroOrMore>
<ref name="addition"/>
</zeroOrMore>
<optional>
<ref name="completeName"/>
</choice>
</optional>
<zeroOrMore>
<ref name="biblionote"/>
</zeroOrMore>
Expand Down Expand Up @@ -466,23 +442,28 @@
</define>
<define name="address">
<element name="address">
<choice>
<!-- iso191606 TODO -->
<group>
<zeroOrMore>
<ref name="street"/>
</zeroOrMore>
<ref name="city"/>
<optional>
<ref name="state"/>
</optional>
<ref name="country"/>
<optional>
<ref name="postcode"/>
</optional>
</group>
<zeroOrMore>
<!--
iso191606 TODO
(street*, city, state?, country, postcode? ) | formattedAddress
-->
<ref name="street"/>
</zeroOrMore>
<optional>
<ref name="city"/>
</optional>
<optional>
<ref name="state"/>
</optional>
<optional>
<ref name="country"/>
</optional>
<optional>
<ref name="postcode"/>
</optional>
<optional>
<ref name="formattedAddress"/>
</choice>
</optional>
</element>
</define>
<define name="street">
Expand Down

0 comments on commit 807d8be

Please sign in to comment.