require "spec_helper" RSpec.describe Asciidoctor::ISO do it "processes sections" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} == Foreword Text == Introduction === Introduction Subsection == Scope Text == Acknowledgements == 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 == Terms and Definitions [appendix] == Annex === Annex A.1 [%appendix] === Appendix 1 ==== Appendix subclause == Bibliography === Bibliography Subsection INPUT output = <<~OUTPUT #{BLANK_HDR} Foreword

Text

Introduction Introduction Subsection Acknowledgements
Scope

Text

Terms and definitions

For the purposes of this document, the following terms and definitions apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

Term1
Terms, definitions, symbols and abbreviated terms Normal Terms Term2 Symbols and abbreviated terms Symbols and abbreviated terms Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 Appendix 1 Appendix subclause Normative references

There are no normative references in this document.

Bibliography Bibliography Subsection
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes section obligations" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} [obligation=informative] == Clause 1 === Clause 1a [obligation=normative] == Clause 2 [appendix,obligation=informative] == Annex INPUT output = <<~OUTPUT #{BLANK_HDR} Clause 1 Clause 1a Clause 2 Annex OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes inline headers" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} == Clause 1 [%inline-header] === Clause 1a [appendix] == Annex A [%inline-header] === Clause Aa INPUT output = <<~OUTPUT #{BLANK_HDR} Clause 1 Clause 1a Annex A Clause Aa OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes blank headers" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} == Clause 1 === {blank} INPUT output = <<~OUTPUT #{BLANK_HDR} Clause 1 OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes terms & definitions with external source" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} Foreword [source="iso1234,iso5678"] == Terms and Definitions === Term1 INPUT output = <<~OUTPUT #{BLANK_HDR.sub(//, '')} Foreword

Foreword

Terms and definitions

For the purposes of this document, the terms and definitions given in and and the following apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

  • ISO Online browsing platform: available at

  • IEC Electropedia: available at

Term1
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes empty terms & definitions" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} Foreword == Terms and Definitions INPUT output = <<~OUTPUT #{BLANK_HDR} Foreword

Foreword

Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

  • ISO Online browsing platform: available at

  • IEC Electropedia: available at

OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes empty terms & definitions with external source" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} Foreword [source="iso1234,iso5678"] == Terms and Definitions INPUT output = <<~OUTPUT #{BLANK_HDR.sub(//, '')} Foreword

Foreword

Terms and definitions

For the purposes of this document, the terms and definitions given in and apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

  • ISO Online browsing platform: available at

  • IEC Electropedia: available at

OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "ignores multiple terms & definitions in default documents" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} == Terms and Definitions == Clause [heading=terms and definitions] == More terms INPUT output = <<~OUTPUT #{BLANK_HDR} Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

  • ISO Online browsing platform: available at

  • IEC Electropedia: available at

Clause More terms
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "permits multiple terms & definitions in vocabulary documents" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":nodoc:\n:docsubtype: vocabulary")} == Terms and Definitions == Clause [heading=terms and definitions] == More terms INPUT output = <<~OUTPUT #{BLANK_HDR.sub(%r{article}, "articlevocabulary")} Terms and definitions

No terms and definitions are listed in this document.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

  • ISO Online browsing platform: available at

  • IEC Electropedia: available at

Clause More terms
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end end