Skip to content

Commit

Permalink
rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 9, 2023
1 parent d1a0a6e commit 258912b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 19 deletions.
20 changes: 18 additions & 2 deletions lib/metanorma/cc/basicdoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@
<ref name="keyword"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</oneOrMore>
</element>
Expand Down Expand Up @@ -623,6 +625,8 @@
<ref name="eref"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -636,6 +640,8 @@
<ref name="eref"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -648,14 +654,20 @@
<ref name="eref"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="keyword">
<element name="keyword">
<zeroOrMore>
<ref name="PureTextElement"/>
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
</define>
Expand All @@ -676,7 +688,11 @@
<define name="strike">
<element name="strike">
<zeroOrMore>
<ref name="PureTextElement"/>
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
</define>
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/cc/biblio.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@
<value>mergedInto</value>
<value>splits</value>
<value>splitInto</value>
<value>instance</value>
<value>instanceOf</value>
<value>hasInstance</value>
<value>exemplarOf</value>
<value>hasExemplar</value>
Expand Down
19 changes: 18 additions & 1 deletion lib/metanorma/cc/isodoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
these elements; we just want one namespace for any child grammars
of this.
-->
<!-- VERSION v1.2.4 -->
<!-- VERSION v1.2.5 -->
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="reqt.rng"/>
<include href="basicdoc.rng">
Expand Down Expand Up @@ -485,6 +485,8 @@
<choice>
<text/>
<ref name="callout"/>
<ref name="xref"/>
<ref name="eref"/>
</choice>
</oneOrMore>
<zeroOrMore>
Expand Down Expand Up @@ -865,6 +867,7 @@
<ref name="PureTextElement"/>
<ref name="stem"/>
<ref name="index"/>
<ref name="index-xref"/>
<ref name="eref"/>
<ref name="erefstack"/>
<ref name="xref"/>
Expand All @@ -880,6 +883,7 @@
<ref name="PureTextElement"/>
<ref name="stem"/>
<ref name="index"/>
<ref name="index-xref"/>
<ref name="eref"/>
<ref name="erefstack"/>
<ref name="xref"/>
Expand All @@ -894,6 +898,7 @@
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
<ref name="eref"/>
<ref name="erefstack"/>
<ref name="xref"/>
Expand All @@ -908,6 +913,7 @@
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -918,6 +924,7 @@
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -928,6 +935,7 @@
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -938,6 +946,7 @@
<choice>
<ref name="PureTextElement"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand Down Expand Up @@ -1047,6 +1056,8 @@
<ref name="keyword"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</element>
</define>
Expand All @@ -1060,6 +1071,8 @@
<ref name="keyword"/>
<ref name="xref"/>
<ref name="hyperlink"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</element>
</define>
Expand Down Expand Up @@ -1126,6 +1139,8 @@
<choice>
<ref name="PureTextElement"/>
<ref name="stem"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand All @@ -1136,6 +1151,8 @@
<choice>
<ref name="PureTextElement"/>
<ref name="stem"/>
<ref name="index"/>
<ref name="index-xref"/>
</choice>
</zeroOrMore>
</element>
Expand Down
30 changes: 15 additions & 15 deletions spec/metanorma/validate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Metanorma::Compile
.new
.compile("xref_error.adoc", type: "cc", no_install_fonts: true)
end.to(change { File.exist?("xref_error.err") }
end.to(change { File.exist?("xref_error.err.html") }
.from(false).to(true))
end
end
Expand All @@ -34,7 +34,7 @@
text
INPUT
expect(File.read("test.err")).to include "pizza is not a legal document type"
expect(File.read("test.err.html")).to include "pizza is not a legal document type"
end

it "Warns of illegal status" do
Expand All @@ -48,7 +48,7 @@
text
INPUT
expect(File.read("test.err")).to include "pizza is not a recognised status"
expect(File.read("test.err.html")).to include "pizza is not a recognised status"
end

it "does not validate section ordering if the docuemnt is advisory" do
Expand All @@ -66,7 +66,7 @@
== Symbols and Abbreviated Terms
INPUT
expect(File.read("test.err")).not_to include "only one Symbols and Abbreviated Terms section in the standard"
expect(File.read("test.err.html")).not_to include "only one Symbols and Abbreviated Terms section in the standard"
end

it "Style warning if two Symbols and Abbreviated Terms sections" do
Expand All @@ -79,7 +79,7 @@
== Symbols and Abbreviated Terms
INPUT
expect(File.read("test.err")).to include "Only one Symbols and Abbreviated Terms section in the standard"
expect(File.read("test.err.html")).to include "Only one Symbols and Abbreviated Terms section in the standard"
end

it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
Expand All @@ -90,7 +90,7 @@
Paragraph
INPUT
expect(File.read("test.err")).to include "Symbols and Abbreviated Terms can only contain a definition list"
expect(File.read("test.err.html")).to include "Symbols and Abbreviated Terms can only contain a definition list"
end

it "Warning if do not start with scope or introduction" do
Expand All @@ -103,7 +103,7 @@
Paragraph
INPUT
expect(File.read("test.err")).to include "Prefatory material must be followed by (clause) Scope"
expect(File.read("test.err.html")).to include "Prefatory material must be followed by (clause) Scope"
end

it "Warning if introduction not followed by scope" do
Expand All @@ -119,7 +119,7 @@
Paragraph
INPUT
expect(File.read("test.err")).to include "Prefatory material must be followed by (clause) Scope"
expect(File.read("test.err.html")).to include "Prefatory material must be followed by (clause) Scope"
end

it "Warning if normative references not followed by terms and definitions" do
Expand All @@ -138,7 +138,7 @@
Paragraph
INPUT
expect(File.read("test.err")).to include "Normative References must be followed by Terms and Definitions"
expect(File.read("test.err.html")).to include "Normative References must be followed by Terms and Definitions"
end

it "Warning if there are no clauses in the document" do
Expand All @@ -158,7 +158,7 @@
== Symbols and Abbreviated Terms
INPUT
expect(File.read("test.err")).to include "Document must contain clause after Terms and Definitions"
expect(File.read("test.err.html")).to include "Document must contain clause after Terms and Definitions"
end

it "Warning if scope occurs after Terms and Definitions" do
Expand All @@ -178,7 +178,7 @@
== Scope
INPUT
expect(File.read("test.err")).to include "Scope must occur before Terms and Definitions"
expect(File.read("test.err.html")).to include "Scope must occur before Terms and Definitions"
end

it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
Expand All @@ -200,7 +200,7 @@
== Symbols and Abbreviated Terms
INPUT
expect(File.read("test.err")).to include "Only annexes and references can follow clauses"
expect(File.read("test.err.html")).to include "Only annexes and references can follow clauses"
end

it "Warning if no normative references" do
Expand All @@ -226,7 +226,7 @@
== Appendix C
INPUT
expect(File.read("test.err")).to include "Document must include (references) Normative References"
expect(File.read("test.err.html")).to include "Document must include (references) Normative References"
end

it "Warning if final section is not named Bibliography" do
Expand Down Expand Up @@ -258,7 +258,7 @@
== Appendix C
INPUT
expect(File.read("test.err")).to include "There are sections after the final Bibliography"
expect(File.read("test.err.html")).to include "There are sections after the final Bibliography"
end

it "Warning if final section is not styled Bibliography" do
Expand Down Expand Up @@ -286,6 +286,6 @@
== Bibliography
INPUT
expect(File.read("test.err")).to include "Section not marked up as [bibliography]!"
expect(File.read("test.err.html")).to include "Section not marked up as [bibliography]!"
end
end

0 comments on commit 258912b

Please sign in to comment.