Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 22, 2022
1 parent 11eba2d commit b66781e
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 234 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "grammars/relaton-model-iso"]
path = grammars/relaton-model-iso
url = /~https://github.com/relaton/relaton-model-iso
[submodule "grammars/relaton-model-iec"]
path = grammars/relaton-model-iec
url = /~https://github.com/relaton/relaton-model-iec
19 changes: 1 addition & 18 deletions grammars/bsi.rnc
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
#default namespace = "https://www.metanorma.com/ns/bsi"

include "relaton-bsi.rnc" { }
include "isostandard.rnc" {

start = bsi-standard

DocumentType =
"british-standard" | "draft-for-development" | "published-document" |
"privately-subscribed-standard" | "publicly-available-specification" |
"flex-standard" | "international-standard" | "technical-specification" |
"technical-report" | "guide" | "international-workshop-agreement" |
"industry-technical-agreement" | "standard" | "european-workshop-agreement" |
"fast-track-standard"

DocumentSubtype = "specification" | "method-of-test" | "method-of-specifying" |
"vocabulary" | "code-of-practice"

BibDataExtensionType =
attribute schema-version { text }?,
doctype, docsubtype?, editorialgroup, ics*, structuredidentifier,
stagename?, coverimages*

admonition =
element admonition {
attribute type { AdmonitionType },
Expand Down Expand Up @@ -95,8 +80,6 @@ floating-section-title =

AdmonitionType |= "commentary"

coverimages = element coverimages { image+ }

# We display the Normative References between scope and terms; but to keep the
# grammar simple, we keep the references together
bsi-standard =
Expand Down
56 changes: 1 addition & 55 deletions grammars/bsi.rng
Original file line number Diff line number Diff line change
@@ -1,58 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- default namespace = "https://www.metanorma.com/ns/bsi" -->
<include href="relaton-bsi.rng"/>
<include href="isostandard.rng">
<start>
<ref name="bsi-standard"/>
</start>
<define name="DocumentType">
<choice>
<value>british-standard</value>
<value>draft-for-development</value>
<value>published-document</value>
<value>privately-subscribed-standard</value>
<value>publicly-available-specification</value>
<value>flex-standard</value>
<value>international-standard</value>
<value>technical-specification</value>
<value>technical-report</value>
<value>guide</value>
<value>international-workshop-agreement</value>
<value>industry-technical-agreement</value>
<value>standard</value>
<value>european-workshop-agreement</value>
<value>fast-track-standard</value>
</choice>
</define>
<define name="DocumentSubtype">
<choice>
<value>specification</value>
<value>method-of-test</value>
<value>method-of-specifying</value>
<value>vocabulary</value>
<value>code-of-practice</value>
</choice>
</define>
<define name="BibDataExtensionType">
<optional>
<attribute name="schema-version"/>
</optional>
<ref name="doctype"/>
<optional>
<ref name="docsubtype"/>
</optional>
<ref name="editorialgroup"/>
<zeroOrMore>
<ref name="ics"/>
</zeroOrMore>
<ref name="structuredidentifier"/>
<optional>
<ref name="stagename"/>
</optional>
<zeroOrMore>
<ref name="coverimages"/>
</zeroOrMore>
</define>
<define name="admonition">
<element name="admonition">
<attribute name="type">
Expand Down Expand Up @@ -300,13 +253,6 @@
<define name="AdmonitionType" combine="choice">
<value>commentary</value>
</define>
<define name="coverimages">
<element name="coverimages">
<oneOrMore>
<ref name="image"/>
</oneOrMore>
</element>
</define>
<!--
We display the Normative References between scope and terms; but to keep the
grammar simple, we keep the references together
Expand Down
5 changes: 4 additions & 1 deletion grammars/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ cp basicdoc.rng reqt.rng biblio.rng biblio-standoc.rng ../../metanorma-standoc/l
cat isodoc.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/standoc" }) '> ../../metanorma-standoc/lib/metanorma/standoc/isodoc.rng
cp basicdoc.rng reqt.rng biblio.rng biblio-standoc.rng isodoc.rng ../../metanorma-iso/lib/metanorma/iso
cp relaton-iso.rng ../../metanorma-iso/lib/metanorma/iso
cat isostandard.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/iso" }) '> ../../metanorma-iso/lib/metanorma/iso/isostandard.rng
cp isostandard.rng ../../metanorma-iso/lib/metanorma/iso
cat isostandard-compile.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/iso" }) '> ../../metanorma-iso/lib/metanorma/iso/isostandard-compile.rng
cat isostandard-amd.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/iso" }) '> ../../metanorma-iso/lib/metanorma/iso/isostandard-amd.rng
cp basicdoc.rng reqt.rng biblio.rng biblio-standoc.rng isodoc.rng ../../metanorma-iec/lib/metanorma/iec
cp relaton-iec.rng ../../metanorma-iec/lib/metanorma/iec
cp isostandard.rng ../../metanorma-iec/lib/metanorma/iec/isostandard.rng
cat iec.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/iec" }) '> ../../metanorma-iec/lib/metanorma/iec/iec.rng
cp basicdoc.rng reqt.rng biblio.rng biblio-standoc.rng isodoc.rng ../../metanorma-bsi/lib/metanorma/bsi
cp relaton-bsi.rng ../../metanorma-bsi/lib/metanorma/bsi
cp isostandard.rng ../../metanorma-bsi/lib/metanorma/bsi/isostandard.rng
cat bsi.rng | ruby -pe '$_.gsub!(/<grammar /, %{<grammar ns="https://www.metanorma.org/ns/bsi" }) '> ../../metanorma-bsi/lib/metanorma/bsi/bsi.rng
cp basicdoc.rng reqt.rng biblio.rng biblio-standoc.rng isodoc.rng ../../metanorma-csd/lib/metanorma/cc
Expand Down
22 changes: 1 addition & 21 deletions grammars/iec.rnc
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
#default namespace = "https://www.metanorma.com/ns/iec"

include "relaton-iec.rnc" { }
include "isostandard.rnc" {

start = iec-standard

DocumentType =
"international-standard" | "technical-specification" |
"technical-report" | "publicly-available-specification" |
"international-workshop-agreement" | "guide" | "industry-technical-agreement" |
"system-reference-delivrabble"

BibDataExtensionType =
attribute schema-version { text }?,
doctype, docsubtype?, horizontal?, function?, editorialgroup, ics*, structuredidentifier,
stagename?, updates_document_type?, accessibility-color-inside?, price-code?,
cen-processing?, secretary?, interest-to-committees?, tc-sc-officers-note?

term =
element term {
attribute id { xsd:ID }?,
Expand All @@ -31,14 +20,6 @@ term =

# end overrides

function = element function { "emc" | "safety" | "environment" | "quality-assurance" }
accessibility-color-inside = element accessibility-color-inside { xsd:boolean }
price-code = element price-code { text }
cen-processing = element cen-processing { xsd:boolean }
secretary = element secretary { text }
interest-to-committees = element interest-to-committees { text }
tc-sc-officers-note = element tc-sc-officers-note { BasicBlock* }

# We display the Normative References between scope and terms; but to keep the
# grammar simple, we keep the references together
iec-standard =
Expand All @@ -48,4 +29,3 @@ attribute version { text },
bibdata, termdocsource*, misccontainer?, boilerplate?, preface, sections+, annex*, bibliography, indexsect*
}

updates_document_type = element updates-document-type { DocumentType }
104 changes: 1 addition & 103 deletions grammars/iec.rng
Original file line number Diff line number Diff line change
@@ -1,66 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- default namespace = "https://www.metanorma.com/ns/iec" -->
<include href="relaton-iec.rng"/>
<include href="isostandard.rng">
<start>
<ref name="iec-standard"/>
</start>
<define name="DocumentType">
<choice>
<value>international-standard</value>
<value>technical-specification</value>
<value>technical-report</value>
<value>publicly-available-specification</value>
<value>international-workshop-agreement</value>
<value>guide</value>
<value>industry-technical-agreement</value>
<value>system-reference-delivrabble</value>
</choice>
</define>
<define name="BibDataExtensionType">
<optional>
<attribute name="schema-version"/>
</optional>
<ref name="doctype"/>
<optional>
<ref name="docsubtype"/>
</optional>
<optional>
<ref name="horizontal"/>
</optional>
<optional>
<ref name="function"/>
</optional>
<ref name="editorialgroup"/>
<zeroOrMore>
<ref name="ics"/>
</zeroOrMore>
<ref name="structuredidentifier"/>
<optional>
<ref name="stagename"/>
</optional>
<optional>
<ref name="updates_document_type"/>
</optional>
<optional>
<ref name="accessibility-color-inside"/>
</optional>
<optional>
<ref name="price-code"/>
</optional>
<optional>
<ref name="cen-processing"/>
</optional>
<optional>
<ref name="secretary"/>
</optional>
<optional>
<ref name="interest-to-committees"/>
</optional>
<optional>
<ref name="tc-sc-officers-note"/>
</optional>
</define>
<define name="term">
<element name="term">
<optional>
Expand Down Expand Up @@ -111,48 +56,6 @@
</define>
</include>
<!-- end overrides -->
<define name="function">
<element name="function">
<choice>
<value>emc</value>
<value>safety</value>
<value>environment</value>
<value>quality-assurance</value>
</choice>
</element>
</define>
<define name="accessibility-color-inside">
<element name="accessibility-color-inside">
<data type="boolean"/>
</element>
</define>
<define name="price-code">
<element name="price-code">
<text/>
</element>
</define>
<define name="cen-processing">
<element name="cen-processing">
<data type="boolean"/>
</element>
</define>
<define name="secretary">
<element name="secretary">
<text/>
</element>
</define>
<define name="interest-to-committees">
<element name="interest-to-committees">
<text/>
</element>
</define>
<define name="tc-sc-officers-note">
<element name="tc-sc-officers-note">
<zeroOrMore>
<ref name="BasicBlock"/>
</zeroOrMore>
</element>
</define>
<!--
We display the Normative References between scope and terms; but to keep the
grammar simple, we keep the references together
Expand Down Expand Up @@ -189,9 +92,4 @@
</zeroOrMore>
</element>
</define>
<define name="updates_document_type">
<element name="updates-document-type">
<ref name="DocumentType"/>
</element>
</define>
</grammar>
1 change: 1 addition & 0 deletions grammars/isostandard-amd.rnc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#default namespace isostandard = "https://www.metanorma.com/ns/iso"

include "relaton-iso.rnc" { }
include "isostandard.rnc" {

start = iso-standard
Expand Down
1 change: 1 addition & 0 deletions grammars/isostandard-amd.rng
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
<include href="relaton-iso.rng"/>
<include href="isostandard.rng">
<start>
<ref name="iso-standard"/>
Expand Down
10 changes: 10 additions & 0 deletions grammars/isostandard-compile.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#default namespace isostandard = "https://www.metanorma.com/ns/iso"

include "relaton-iso.rnc" { }
include "isostandard.rnc" {

}

# end overrides


7 changes: 7 additions & 0 deletions grammars/isostandard-compile.rng
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
<include href="relaton-iso.rng"/>
<include href="isostandard.rng"/>
</grammar>
<!-- end overrides -->
1 change: 0 additions & 1 deletion grammars/isostandard.rnc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#default namespace isostandard = "https://www.metanorma.com/ns/iso"

include "relaton-iso.rnc" { }
include "isodoc.rnc" {

start = iso-standard
Expand Down
1 change: 0 additions & 1 deletion grammars/isostandard.rng
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
<include href="relaton-iso.rng"/>
<include href="isodoc.rng">
<start>
<ref name="iso-standard"/>
Expand Down
Loading

0 comments on commit b66781e

Please sign in to comment.