#{word.gsub(/_Toc\d\d+/, '_Toc')}"))
.to be_equivalent_to xmlpp(<<~'OUTPUT')
-
OUTPUT
end
@@ -1042,88 +988,14 @@
expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")
.gsub(/
<\/o:p>/, "")))
.to be_equivalent_to xmlpp(<<~'OUTPUT')
-
+
OUTPUT
end
end
diff --git a/spec/isodoc/section_spec.rb b/spec/isodoc/section_spec.rb
index 6c39eacb..6ddef576 100644
--- a/spec/isodoc/section_spec.rb
+++ b/spec/isodoc/section_spec.rb
@@ -1104,9 +1104,6 @@
-
-
-
Index
@@ -1167,9 +1164,9 @@
word = File.read("test.doc", encoding: "UTF-8")
.sub(/^.*.*$}m, "")
wordxml = Nokogiri::XML(word)
- wordxml.at("//div[@class = 'WordSection1']").remove
- wordxml.at("//div[@class = 'WordSection2']").remove
- wordxml.at("//div[@class = 'WordSection3']").remove
+ wordxml.xpath("//div[@class = 'WordSection1' or @class = 'WordSection2']")
+ .each(&:remove)
+ wordxml.at("//div[@class = 'WordSection3']")&.remove
expect(xmlpp(wordxml.to_xml))
.to be_equivalent_to xmlpp(doc)
end
diff --git a/spec/metanorma/base_spec.rb b/spec/metanorma/base_spec.rb
index 40a76a3f..4de13b9f 100644
--- a/spec/metanorma/base_spec.rb
+++ b/spec/metanorma/base_spec.rb
@@ -1988,9 +1988,73 @@
OUTPUT
- expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(input,
- *OPTIONS))
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
.at("//xmlns:metanorma-extension").to_xml)))
.to be_equivalent_to xmlpp(output)
+
+ input.sub!(":document-scheme: DOCUMENT-SCHEME",
+ ":copyright-year: 1960")
+ output.sub!("DOCUMENT-SCHEME", "1951")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 1960", ":copyright-year: 1973")
+ output.sub!("1951", "1972")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 1973", ":copyright-year: 1980")
+ output.sub!("1972", "1979")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 1980", ":copyright-year: 1988")
+ output.sub!("1979", "1987")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 1988", ":copyright-year: 1990")
+ output.sub!("1987", "1989")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 1990", ":copyright-year: 2012")
+ output.sub!("1989", "2012")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 2012", ":copyright-year: 2014")
+ output.sub!("2012", "2013")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 2014", ":copyright-year: 2025")
+ output.sub!("2013", "2024")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
+ input.sub!(":copyright-year: 2014", "")
+ expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor
+ .convert(input, *OPTIONS))
+ .at("//xmlns:metanorma-extension").to_xml)))
+ .to be_equivalent_to xmlpp(output)
+
end
end
diff --git a/spec/metanorma/section_spec.rb b/spec/metanorma/section_spec.rb
index 6d7fbc50..ad6b8992 100644
--- a/spec/metanorma/section_spec.rb
+++ b/spec/metanorma/section_spec.rb
@@ -1,7 +1,6 @@
require "spec_helper"
RSpec.describe Metanorma::ISO do
-=begin
it "processes sections" do
input = <<~INPUT
#{ASCIIDOC_BLANK_HDR}
@@ -244,7 +243,7 @@
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
.to be_equivalent_to xmlpp(output)
end
-=end
+
it "processes terms & definitions with external source" do
input = <<~INPUT
#{ASCIIDOC_BLANK_HDR}
diff --git a/spec/metanorma/validate_section_spec.rb b/spec/metanorma/validate_section_spec.rb
new file mode 100644
index 00000000..97d1e3b2
--- /dev/null
+++ b/spec/metanorma/validate_section_spec.rb
@@ -0,0 +1,929 @@
+require "spec_helper"
+require "fileutils"
+
+RSpec.describe Metanorma::ISO do
+ context "Warns of missing scope" do
+ it "Scope clause missing" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ text
+ INPUT
+
+ expect(File.read("test.err.html")).to include "Scope clause missing"
+ end
+
+ it "Scope clause not missing if supplied" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ == Scope
+ INPUT
+ expect(File.read("test.err.html")).not_to include "Scope clause missing"
+ end
+
+ it "Scope clause not missing in amendments" do
+ FileUtils.rm_f "test.err.html"
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ text
+ INPUT
+ expect(File.read("test.err.html")).not_to include "Scope clause missing"
+ end
+ end
+
+ context "Warns of missing normative references" do
+ it "Normative references missing" do
+ FileUtils.rm_f "test.err.html"
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ text
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Normative references missing"
+ end
+
+ it "Normative references not missing if supplied" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ [bibliography]
+ == Normative references
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Normative references missing"
+ end
+
+ it "Normative references not missing in amendments" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ text
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Normative references missing"
+ end
+ end
+
+ context "Warns of missing terms & definitions" do
+ it "Terms & definitions missing" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ text
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Terms & definitions missing"
+ end
+
+ it "Terms & definitions not missing if supplied" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: pizza
+
+ == Terms and definitions
+ === Term 1
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Terms & definitions missing"
+ end
+
+ it "Terms & definitions not missing in amendment" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ text
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Terms & definitions missing"
+ end
+ end
+
+ it "warns that Scope contains subclauses" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Scope
+
+ === Scope subclause
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Scope contains subclauses: should be succinct"
+ end
+
+ # can't test: our asciidoc template won't allow this to be generated
+ # it "Style warning if foreword contains subclauses" do
+ # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
+ # .to output(%r{non-standard unit}).to_stderr
+ # #{VALIDATING_BLANK_HDR}
+ #
+ # INPUT
+ # end
+
+ # can't test: we strip out any such content from Normative references preemptively
+ # it "Style warning if Normative References contains subclauses" do
+ # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
+ # .to output(%r{normative references contains subclauses}).to_stderr
+ # #{VALIDATING_BLANK_HDR}
+ #
+ # [bibliography]
+ #== Normative References
+ #
+ #=== Subsection
+ # INPUT
+ # end
+
+ it "Style warning if two Symbols and Abbreviated Terms sections" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Terms and Abbreviations
+
+ === Symbols and Abbreviated Terms
+
+ == Symbols and Abbreviated Terms
+ INPUT
+ 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
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Symbols and Abbreviated Terms can only contain " \
+ "a definition list"
+
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Symbols and Abbreviated Terms
+
+ A:: B
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Symbols and Abbreviated Terms can only contain " \
+ "a definition list"
+ end
+
+ it "Warning if missing foreword" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Initial section must be (content) Foreword"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Initial section must be (content) Foreword"
+ end
+
+ it "Warning if do not start with scope or introduction" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+ Foreword
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Prefatory material must be followed by (clause) Scope"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ Foreword
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Prefatory material must be followed by (clause) Scope"
+ end
+
+ it "Warning if introduction not followed by scope" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Introduction
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Prefatory material must be followed by (clause) Scope"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Introduction
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Prefatory material must be followed by (clause) Scope"
+ end
+
+ it "Warning if normative references not followed by terms and definitions" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Normative References must be followed by " \
+ "Terms and Definitions"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Symbols and Abbreviated Terms
+
+ Paragraph
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Normative References must be followed by " \
+ "Terms and Definitions"
+ end
+
+ it "Warning if there are no clauses in the document" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Symbols and Abbreviated Terms
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Document must contain at least one clause"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Symbols and Abbreviated Terms
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Document must contain at least one clause"
+ end
+
+ it "Warning if scope occurs after Terms and Definitions" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ == Scope
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Scope must occur before Terms and Definitions"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ == Scope
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_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
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ == Symbols and Abbreviated Terms
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Only annexes and references can follow clauses"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ == Symbols and Abbreviated Terms
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Only annexes and references can follow clauses"
+ end
+
+ it "Warning if no normative references" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ [appendix]
+ == Appendix C
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Document must include (references) Normative References"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ [appendix]
+ == Appendix C
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Document must include (references) Normative References"
+ end
+
+ it "Warning if there are two Terms sections" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Scope
+
+ == Terms and definitions
+
+ == A Clause
+
+ [heading=terms and definitions]
+ == Terms related to clinical psychology
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Only annexes and references can follow clauses"
+ end
+
+ it "No warning if there are two Terms sections in a Vocabulary document" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :docsubtype: vocabulary
+
+ == Scope
+
+ == Terms and definitions
+
+ == A Clause
+
+ [heading=terms and definitions]
+ == Terms related to clinical psychology
+
+ [heading=symbols and abbreviated terms]
+ == Symbols related to clinical psychology
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Only annexes and references can follow clauses"
+ expect(File.read("test.err.html"))
+ .not_to include "Scope must occur before Terms and Definitions"
+ expect(File.read("test.err.html"))
+ .to include "Only annexes and references can follow terms and clauses"
+ end
+
+ it "No warning if there are two Symbols sections in a Vocabulary document" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :docsubtype: vocabulary
+
+ == Scope
+
+ == Terms and definitions
+
+ == A Clause
+
+ [heading=symbols and abbreviated terms]
+ == Terms related to clinical psychology
+
+ [heading=symbols and abbreviated terms]
+ == Symbols related to clinical psychology
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Only one Symbols and Abbreviated Terms section " \
+ "in the standard"
+ end
+
+ it "Warn if single terms section in vocabulary document not named properly" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :docsubtype: vocabulary
+
+ == Scope
+ [heading=terms and definitions]
+ == Terms and redefinitions
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Single terms clause in vocabulary document should have " \
+ "normal Terms and definitions heading"
+ expect(File.read("test.err.html"))
+ .not_to include "Multiple terms clauses in vocabulary document should " \
+ "have 'Terms related to' heading"
+ end
+
+ it "Warn if vocabulary document contains Symbols section outside annex" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :docsubtype: vocabulary
+
+ == Scope
+
+ == Terms and definitions
+
+ == A Clause
+
+ [heading=symbols and abbreviated terms]
+ == Terms related to clinical psychology
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "In vocabulary documents, Symbols and Abbreviated Terms are " \
+ "only permitted in annexes"
+ end
+
+ it "Warning if multiple terms section in vocabulary document not named " \
+ "properly" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :docsubtype: vocabulary
+
+ == Terms and definitions
+
+ [heading=terms and definitions]
+ == Terms related to fish
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Single terms clause in vocabulary document should have " \
+ "normal Terms and definitions heading"
+ expect(File.read("test.err.html"))
+ .to include "Multiple terms clauses in vocabulary document should " \
+ "have 'Terms related to' heading"
+ end
+
+ it "Warning if final section is not named Bibliography" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ [bibliography]
+ == Bibliography
+
+ [bibliography]
+ == Appendix C
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "There are sections after the final Bibliography"
+
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ [bibliography]
+ == Bibliography
+
+ [bibliography]
+ == Appendix C
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "There are sections after the final Bibliography"
+ end
+
+ it "Warning if final section is not styled Bibliography" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ == Bibliography
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Section not marked up as [bibliography]"
+ end
+
+ it "Warning if final section is not styled Bibliography false" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :no-isobib:
+ :doctype: amendment
+
+ .Foreword
+ Foreword
+
+ == Scope
+
+ [bibliography]
+ == Normative References
+
+ == Terms and Definitions
+
+ == Clause
+
+ [appendix]
+ == Appendix A
+
+ [appendix]
+ == Appendix B
+
+ == Bibliography
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "Section not marked up as [bibliography]"
+ end
+
+ it "Each first-level subclause must have a title" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+ == Clause
+
+ === {blank}
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "each first-level subclause must have a title"
+ end
+
+ it "All subclauses must have a title, or none" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+ == Clause
+
+ === Subclause
+
+ ==== {blank}
+
+ ==== Subsubclause
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "all subclauses must have a title, or none"
+ end
+
+ it "Warning if subclause is only child of its parent, or none" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+ == Clause
+
+ === Subclause
+
+ INPUT
+ expect(File.read("test.err.html")).to include "subclause is only child"
+ end
+
+ it "Warn if more than 7 levels of subclause" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Clause
+
+ === Clause
+
+ ==== Clause
+
+ ===== Clause
+
+ ====== Clause
+
+ [level=6]
+ ====== Clause
+
+ [level=7]
+ ====== Clause
+
+ [level=8]
+ ====== Clause
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .to include "Exceeds the maximum clause depth of 7"
+ end
+
+ it "Do not warn if not more than 7 levels of subclause" do
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
+ #{VALIDATING_BLANK_HDR}
+
+ == Clause
+
+ === Clause
+
+ ==== Clause
+
+ ===== Clause
+
+ ====== Clause
+
+ [level=6]
+ ====== Clause
+
+ [level=7]
+ ====== Clause
+
+ INPUT
+ expect(File.read("test.err.html"))
+ .not_to include "exceeds the maximum clause depth of 7"
+ end
+end
diff --git a/spec/metanorma/validate_spec.rb b/spec/metanorma/validate_spec.rb
index 2d48944a..1bfed99e 100644
--- a/spec/metanorma/validate_spec.rb
+++ b/spec/metanorma/validate_spec.rb
@@ -137,149 +137,6 @@
"to have suffix _e"
end
- context "Warns of missing scope" do
- it "Scope clause missing" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- text
- INPUT
-
- expect(File.read("test.err.html")).to include "Scope clause missing"
- end
-
- it "Scope clause not missing if supplied" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- == Scope
- INPUT
- expect(File.read("test.err.html")).not_to include "Scope clause missing"
- end
-
- it "Scope clause not missing in amendments" do
- FileUtils.rm_f "test.err.html"
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- text
- INPUT
- expect(File.read("test.err.html")).not_to include "Scope clause missing"
- end
- end
-
- context "Warns of missing normative references" do
- it "Normative references missing" do
- FileUtils.rm_f "test.err.html"
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- text
- INPUT
- expect(File.read("test.err.html"))
- .to include "Normative references missing"
- end
-
- it "Normative references not missing if supplied" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- [bibliography]
- == Normative references
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Normative references missing"
- end
-
- it "Normative references not missing in amendments" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- text
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Normative references missing"
- end
- end
-
- context "Warns of missing terms & definitions" do
- it "Terms & definitions missing" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- text
- INPUT
- expect(File.read("test.err.html"))
- .to include "Terms & definitions missing"
- end
-
- it "Terms & definitions not missing if supplied" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: pizza
-
- == Terms and definitions
- === Term 1
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Terms & definitions missing"
- end
-
- it "Terms & definitions not missing in amendment" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- text
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Terms & definitions missing"
- end
- end
-
it "Warns of illegal doctype" do
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
@@ -664,18 +521,6 @@
.to include "non-ISO/IEC reference not expected as normative"
end
- it "warns that Scope contains subclauses" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Scope
-
- === Scope subclause
- INPUT
- expect(File.read("test.err.html"))
- .to include "Scope contains subclauses: should be succinct"
- end
-
it "warns that Table should have title" do
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
#{VALIDATING_BLANK_HDR}
@@ -943,891 +788,174 @@
.not_to include "No full stop at end of title or caption: Other Figure."
end
- # can't test: our asciidoc template won't allow this to be generated
- # it "Style warning if foreword contains subclauses" do
- # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
- # .to output(%r{non-standard unit}).to_stderr
- # #{VALIDATING_BLANK_HDR}
- #
- # INPUT
- # end
-
- # can't test: we strip out any such content from Normative references preemptively
- # it "Style warning if Normative References contains subclauses" do
- # expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }
- # .to output(%r{normative references contains subclauses}).to_stderr
- # #{VALIDATING_BLANK_HDR}
- #
- # [bibliography]
- #== Normative References
- #
- #=== Subsection
- # INPUT
- # end
-
- it "Style warning if two Symbols and Abbreviated Terms sections" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Terms and Abbreviations
-
- === Symbols and Abbreviated Terms
+ it "Warning if English title intro and no French title intro" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-intro-en: Title
+ :no-isobib:
- == Symbols and Abbreviated Terms
INPUT
- expect(File.read("test.err.html"))
- .to include "Only one Symbols and Abbreviated Terms section " \
- "in the standard"
+ expect(File.read("test.err.html")).to include "No French Title Intro"
end
- it "Style warning if Symbols and Abbreviated Terms contains " \
- "extraneous matter" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Symbols and Abbreviated Terms
+ it "Warning if French title intro and no English title intro" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-intro-fr: Title
+ :no-isobib:
- Paragraph
INPUT
- expect(File.read("test.err.html"))
- .to include "Symbols and Abbreviated Terms can only contain " \
- "a definition list"
-
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
+ expect(File.read("test.err.html")).to include "No English Title Intro"
+ end
- == Symbols and Abbreviated Terms
+ it "Warning if English title and no French title" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-main-en: Title
+ :no-isobib:
- A:: B
INPUT
- expect(File.read("test.err.html"))
- .not_to include "Symbols and Abbreviated Terms can only contain " \
- "a definition list"
+ expect(File.read("test.err.html")).to include "No French Title"
+ expect(File.read("test.err.html")).not_to include "No French Intro"
end
- it "Warning if missing foreword" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Symbols and Abbreviated Terms
+ it "Warning if French title and no English title" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-main-fr: Title
+ :no-isobib:
- Paragraph
INPUT
- expect(File.read("test.err.html"))
- .to include "Initial section must be (content) Foreword"
+ expect(File.read("test.err.html")).to include "No English Title"
+ end
+ it "Warning if English title part and no French title part" do
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
+ :title-part-en: Title
:no-isobib:
- :doctype: amendment
-
- == Symbols and Abbreviated Terms
- Paragraph
INPUT
- expect(File.read("test.err.html"))
- .not_to include "Initial section must be (content) Foreword"
+ expect(File.read("test.err.html")).to include "No French Title Part"
end
- it "Warning if do not start with scope or introduction" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
- Foreword
-
- == Symbols and Abbreviated Terms
+ it "Warning if French title part and no English title part" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-part-fr: Title
+ :no-isobib:
- Paragraph
INPUT
- expect(File.read("test.err.html"))
- .to include "Prefatory material must be followed by (clause) Scope"
+ expect(File.read("test.err.html")).to include "No English Title Part"
+ end
+ it "No warning if French main title and English main title" do
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
+ :title-part-fr: Title
+ :title-part-en: Title
:no-isobib:
- :doctype: amendment
- Foreword
+ INPUT
+ expect(File.read("test.err.html")).not_to include "No French Title Intro"
+ expect(File.read("test.err.html")).not_to include "No French Title Part"
+ end
- == Symbols and Abbreviated Terms
+ it "Warning if non-IEC document with subpart" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :docnumber: 10
+ :partnumber: 1-1
+ :publisher: ISO
+ :no-isobib:
- Paragraph
INPUT
expect(File.read("test.err.html"))
- .not_to include "Prefatory material must be followed by (clause) Scope"
+ .to include "Subpart defined on non-IEC document"
end
- it "Warning if introduction not followed by scope" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Introduction
-
- == Symbols and Abbreviated Terms
+ it "No warning if joint IEC/non-IEC document with subpart" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :docnumber: 10
+ :partnumber: 1-1
+ :publisher: ISO;IEC
+ :no-isobib:
- Paragraph
INPUT
expect(File.read("test.err.html"))
- .to include "Prefatory material must be followed by (clause) Scope"
+ .not_to include "Subpart defined on non-IEC document"
+ end
+ it "Warning if main title contains document type" do
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
+ :title-main-en: A Technical Specification on Widgets
:no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Introduction
-
- == Symbols and Abbreviated Terms
- Paragraph
INPUT
expect(File.read("test.err.html"))
- .not_to include "Prefatory material must be followed by (clause) Scope"
+ .to include "Main Title may name document type"
end
- it "Warning if normative references not followed by terms and definitions" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Symbols and Abbreviated Terms
+ it "Warning if intro title contains document type" do
+ Asciidoctor.convert(<<~INPUT, *OPTIONS)
+ = Document title
+ Author
+ :docfile: test.adoc
+ :nodoc:
+ :title-intro-en: A Technical Specification on Widgets
+ :no-isobib:
- Paragraph
INPUT
expect(File.read("test.err.html"))
- .to include "Normative References must be followed by " \
- "Terms and Definitions"
+ .to include "Title Intro may name document type"
+ end
+ it "Warning if invalid technical committee type" do
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
+ :technical-committee: A
+ :technical-committee-type: X
+ :technical-committee-number: X
:no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
- == Scope
-
- [bibliography]
- == Normative References
-
- == Symbols and Abbreviated Terms
-
- Paragraph
INPUT
expect(File.read("test.err.html"))
- .not_to include "Normative References must be followed by " \
- "Terms and Definitions"
- end
-
- it "Warning if there are no clauses in the document" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Symbols and Abbreviated Terms
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Document must contain at least one clause"
-
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Symbols and Abbreviated Terms
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Document must contain at least one clause"
- end
-
- it "Warning if scope occurs after Terms and Definitions" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- == Scope
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Scope must occur before Terms and Definitions"
-
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- == Scope
-
- INPUT
- expect(File.read("test.err.html"))
- .not_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
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- == Symbols and Abbreviated Terms
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Only annexes and references can follow clauses"
-
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- == Symbols and Abbreviated Terms
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Only annexes and references can follow clauses"
- end
-
- it "Warning if no normative references" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- [appendix]
- == Appendix C
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Document must include (references) Normative References"
-
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Scope
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- [appendix]
- == Appendix C
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Document must include (references) Normative References"
- end
-
- it "Warning if there are two Terms sections" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Scope
-
- == Terms and definitions
-
- == A Clause
-
- [heading=terms and definitions]
- == Terms related to clinical psychology
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Only annexes and references can follow clauses"
- end
-
- it "No warning if there are two Terms sections in a Vocabulary document" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :docsubtype: vocabulary
-
- == Scope
-
- == Terms and definitions
-
- == A Clause
-
- [heading=terms and definitions]
- == Terms related to clinical psychology
-
- [heading=symbols and abbreviated terms]
- == Symbols related to clinical psychology
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Only annexes and references can follow clauses"
- expect(File.read("test.err.html"))
- .not_to include "Scope must occur before Terms and Definitions"
- expect(File.read("test.err.html"))
- .to include "Only annexes and references can follow terms and clauses"
- end
-
- it "No warning if there are two Symbols sections in a Vocabulary document" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :docsubtype: vocabulary
-
- == Scope
-
- == Terms and definitions
-
- == A Clause
-
- [heading=symbols and abbreviated terms]
- == Terms related to clinical psychology
-
- [heading=symbols and abbreviated terms]
- == Symbols related to clinical psychology
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Only one Symbols and Abbreviated Terms section " \
- "in the standard"
- end
-
- it "Warn if single terms section in vocabulary document not named properly" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :docsubtype: vocabulary
-
- == Scope
- [heading=terms and definitions]
- == Terms and redefinitions
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Single terms clause in vocabulary document should have " \
- "normal Terms and definitions heading"
- expect(File.read("test.err.html"))
- .not_to include "Multiple terms clauses in vocabulary document should " \
- "have 'Terms related to' heading"
- end
-
- it "Warn if vocabulary document contains Symbols section outside annex" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :docsubtype: vocabulary
-
- == Scope
-
- == Terms and definitions
-
- == A Clause
-
- [heading=symbols and abbreviated terms]
- == Terms related to clinical psychology
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "In vocabulary documents, Symbols and Abbreviated Terms are " \
- "only permitted in annexes"
- end
-
- it "Warning if multiple terms section in vocabulary document not named " \
- "properly" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :docsubtype: vocabulary
-
- == Terms and definitions
-
- [heading=terms and definitions]
- == Terms related to fish
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Single terms clause in vocabulary document should have " \
- "normal Terms and definitions heading"
- expect(File.read("test.err.html"))
- .to include "Multiple terms clauses in vocabulary document should " \
- "have 'Terms related to' heading"
- end
-
- it "Warning if final section is not named Bibliography" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- [bibliography]
- == Bibliography
-
- [bibliography]
- == Appendix C
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "There are sections after the final Bibliography"
-
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- [bibliography]
- == Bibliography
-
- [bibliography]
- == Appendix C
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "There are sections after the final Bibliography"
- end
-
- it "Warning if final section is not styled Bibliography" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- == Bibliography
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Section not marked up as [bibliography]"
- end
-
- it "Warning if final section is not styled Bibliography false" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :no-isobib:
- :doctype: amendment
-
- .Foreword
- Foreword
-
- == Scope
-
- [bibliography]
- == Normative References
-
- == Terms and Definitions
-
- == Clause
-
- [appendix]
- == Appendix A
-
- [appendix]
- == Appendix B
-
- == Bibliography
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Section not marked up as [bibliography]"
- end
-
- it "Warning if English title intro and no French title intro" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-intro-en: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No French Title Intro"
- end
-
- it "Warning if French title intro and no English title intro" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-intro-fr: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No English Title Intro"
- end
-
- it "Warning if English title and no French title" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-main-en: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No French Title"
- expect(File.read("test.err.html")).not_to include "No French Intro"
- end
-
- it "Warning if French title and no English title" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-main-fr: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No English Title"
- end
-
- it "Warning if English title part and no French title part" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-part-en: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No French Title Part"
- end
-
- it "Warning if French title part and no English title part" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-part-fr: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).to include "No English Title Part"
- end
-
- it "No warning if French main title and English main title" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-part-fr: Title
- :title-part-en: Title
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html")).not_to include "No French Title Intro"
- expect(File.read("test.err.html")).not_to include "No French Title Part"
- end
-
- it "Warning if non-IEC document with subpart" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :docnumber: 10
- :partnumber: 1-1
- :publisher: ISO
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Subpart defined on non-IEC document"
- end
-
- it "No warning if joint IEC/non-IEC document with subpart" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :docnumber: 10
- :partnumber: 1-1
- :publisher: ISO;IEC
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "Subpart defined on non-IEC document"
- end
-
- it "Warning if main title contains document type" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-main-en: A Technical Specification on Widgets
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Main Title may name document type"
- end
-
- it "Warning if intro title contains document type" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :title-intro-en: A Technical Specification on Widgets
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Title Intro may name document type"
- end
-
- it "Each first-level subclause must have a title" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
- == Clause
-
- === {blank}
- INPUT
- expect(File.read("test.err.html"))
- .to include "each first-level subclause must have a title"
- end
-
- it "All subclauses must have a title, or none" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
- == Clause
-
- === Subclause
-
- ==== {blank}
-
- ==== Subsubclause
- INPUT
- expect(File.read("test.err.html"))
- .to include "all subclauses must have a title, or none"
- end
-
- it "Warning if subclause is only child of its parent, or none" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
- == Clause
-
- === Subclause
-
- INPUT
- expect(File.read("test.err.html")).to include "subclause is only child"
- end
-
- it "Warning if invalid technical committee type" do
- Asciidoctor.convert(<<~INPUT, *OPTIONS)
- = Document title
- Author
- :docfile: test.adoc
- :nodoc:
- :technical-committee: A
- :technical-committee-type: X
- :technical-committee-number: X
- :no-isobib:
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "invalid technical committee type"
+ .to include "invalid technical committee type"
end
it "Warning if invalid subcommittee type" do
@@ -1909,59 +1037,6 @@
.to include 'value of attribute "align" is invalid; must be equal to'
end
- it "Warn if more than 7 levels of subclause" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Clause
-
- === Clause
-
- ==== Clause
-
- ===== Clause
-
- ====== Clause
-
- [level=6]
- ====== Clause
-
- [level=7]
- ====== Clause
-
- [level=8]
- ====== Clause
-
- INPUT
- expect(File.read("test.err.html"))
- .to include "Exceeds the maximum clause depth of 7"
- end
-
- it "Do not warn if not more than 7 levels of subclause" do
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
- #{VALIDATING_BLANK_HDR}
-
- == Clause
-
- === Clause
-
- ==== Clause
-
- ===== Clause
-
- ====== Clause
-
- [level=6]
- ====== Clause
-
- [level=7]
- ====== Clause
-
- INPUT
- expect(File.read("test.err.html"))
- .not_to include "exceeds the maximum clause depth of 7"
- end
-
it "Warn if an undated reference has no associated footnote" do
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
#{VALIDATING_BLANK_HDR}