require "spec_helper"
RSpec.describe Asciidoctor::ISO do
it "processes sections" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
.Foreword
Text
== Introduction
=== Introduction Subsection
=== Patent Notice
== Scope
Text
== Normative References
== Terms and Definitions
=== Term1
== Terms, Definitions, Symbols and Abbreviated Terms
=== Normal Terms
==== Term2
=== Symbols and Abbreviated Terms
== Symbols and Abbreviated Terms
== Clause 4
=== Introduction
=== Clause 4.2
[appendix]
== Annex
=== Annex A.1
[%appendix]
=== Appendix 1
== Bibliography
=== Bibliography Subsection
INPUT
#{BLANK_HDR}
Foreword
Text
Introduction
Introduction Subsection
Scope
Text
Terms and Definitions
Term1
Terms, Definitions, Symbols and Abbreviated Terms
Normal Terms
Term2
Clause 4
Introduction
Clause 4.2
Annex
Annex A.1
Appendix 1
Normative References
Bibliography
Bibliography Subsection
OUTPUT
end
it "processes sections with title attributes" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
.Foreword
Text
[heading=introduction]
== Εισαγωγή
=== Introduction Subsection
=== Patent Notice
[heading=scope]
== Σκοπός
Text
[heading=normative references]
== Κανονιστικές Παραπομπές
[heading=terms and definitions]
== Όροι και Ορισμοί
=== Term1
[heading="terms, definitions, symbols and abbreviated terms"]
== Όροι, Ορισμοί, Σύμβολα και Συντομογραφίες
=== Normal Terms
==== Term2
[heading=symbols and abbreviated terms]
=== Σύμβολα και Συντομογραφίες
[heading=symbols and abbreviated terms]
== Σύμβολα και Συντομογραφίες
== Clause 4
=== Introduction
=== Clause 4.2
[appendix]
== Annex
=== Annex A.1
[%appendix]
=== Appendx 1
[heading=bibliography]
== Βιβλιογραφία
=== Bibliography Subsection
INPUT
#{BLANK_HDR}
Foreword
Text
Introduction
Introduction Subsection
Scope
Text
Terms and Definitions
Term1
Terms and Definitions
Normal Terms
Term2
Clause 4
Introduction
Clause 4.2
Annex
Annex A.1
Appendx 1
Normative References
Bibliography
Bibliography Subsection
OUTPUT
end
it "processes section obligations" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[obligation=informative]
== Clause 1
=== Clause 1a
[obligation=normative]
== Clause 2
[appendix,obligation=informative]
== Annex
INPUT
#{BLANK_HDR}
Clause 1
Clause 1a
Clause 2
Annex
OUTPUT
end
it "processes inline headers" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
== Clause 1
[%inline-header]
=== Clause 1a
[appendix]
== Annex A
[%inline-header]
=== Clause Aa
INPUT
#{BLANK_HDR}
Clause 1
Clause 1a
Annex A
Clause Aa
OUTPUT
end
it "processes blank headers" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
== Clause 1
=== {blank}
INPUT
#{BLANK_HDR}
Clause 1
OUTPUT
end
it "processes term document sources" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
Foreword
[source="iso1234,iso5678"]
== Terms and Definitions
INPUT
#{BLANK_HDR}
Foreword
Foreword
Terms and Definitions
OUTPUT
end
end