require "spec_helper" RSpec.describe Asciidoctor::Standoc do it "processes sections" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} .Foreword Text [abstract] == Abstract Text == Introduction === Introduction Subsection == Scope Text == Normative References == Terms and Definitions === Term1 == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 === Symbols and Abbreviated Terms [.nonterm] ==== General ==== Symbols 1 == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 == Bibliography === Bibliography Subsection INPUT #{BLANK_HDR.sub(//, "

Text

")}

Text

Foreword

Text

Introduction Introduction Subsection
Scope

Text

Terms and definitions

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

Term1
Terms, definitions, symbols and abbreviated terms Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symbols and Abbreviated Terms General Symbols 1 Abbreviated Terms Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 Normative References

There are no normative references in this document.

Bibliography Bibliography Subsection
OUTPUT end it "processes sections with language and script attributes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} .Foreword Text [abstract,language=en,script=Latn] == Abstract Text [language=en,script=Latn] == Introduction [language=en,script=Latn] === Introduction Subsection [language=en,script=Latn] == Scope Text [language=en,script=Latn] == Normative References [language=en,script=Latn] == Terms and Definitions [language=en,script=Latn] === Term1 [language=en,script=Latn] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] [language=en,script=Latn] === Introduction ==== Intro 1 [language=en,script=Latn] === Intro 2 [.nonterm] [language=en,script=Latn] ==== Intro 3 [language=en,script=Latn] === Intro 4 [language=en,script=Latn] ==== Intro 5 ===== Term1 [language=en,script=Latn] === Normal Terms ==== Term2 [language=en,script=Latn] === Symbols and Abbreviated Terms [.nonterm] [language=en,script=Latn] ==== General ==== Symbols 1 [language=en,script=Latn] == Abbreviated Terms [language=en,script=Latn] == Clause 4 [language=en,script=Latn] === Introduction [language=en,script=Latn] === Clause 4.2 [language=en,script=Latn] == Terms and Definitions [appendix,language=en,script=Latn] == Annex [language=en,script=Latn] === Annex A.1 [language=en,script=Latn] == Bibliography [language=en,script=Latn] === Bibliography Subsection INPUT #{BLANK_HDR.sub(//, "

Text

")}

Text

Foreword

Text

Introduction Introduction Subsection
Scope

Text

Terms and definitions

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

Term1
Terms, definitions, symbols and abbreviated terms Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symbols and Abbreviated Terms General Symbols 1 Abbreviated Terms Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 Normative References

There are no normative references in this document.

Bibliography Bibliography Subsection
OUTPUT end it "processes sections with title attributes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} .Foreword Text [abstract] == Περίληψη Text [heading=introduction] == Εισαγωγή === Introduction Subsection [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 [heading=bibliography] == Βιβλιογραφία === Bibliography Subsection INPUT #{BLANK_HDR.sub(//, "

Text

")}

Text

Foreword

Text

Introduction Introduction Subsection
Terms and definitions

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

Term1
Terms and definitions Normal Terms Term2 Σύμβολα και Συντομογραφίες Σύμβολα και Συντομογραφίες Clause 4 Introduction Clause 4.2
Annex Annex A.1 Normative References

There are no normative references in this document.

Bibliography Bibliography Subsection
OUTPUT end it "processes section obligations" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"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(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause 1 === {blank} INPUT #{BLANK_HDR} Clause 1 OUTPUT end it "processes terms & definitions with external source" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Foreword [source="iso1234,iso5678"] == Terms and Definitions === Term1 INPUT #{BLANK_HDR} Foreword

Foreword

Terms and definitions

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

Term1
OUTPUT end it "processes empty terms & definitions" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Foreword == Terms and Definitions INPUT #{BLANK_HDR} Foreword

Foreword

Terms and definitions

No terms and definitions are listed in this document.

OUTPUT end it "processes empty terms & definitions with external source" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Foreword [source="iso1234,iso5678"] == Terms and Definitions INPUT #{BLANK_HDR} Foreword

Foreword

Terms and definitions

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

OUTPUT end it "processes term document sources in French" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :language: fr Foreword [source="iso1234,iso5678"] == Terms and Definitions INPUT #{BLANK_HDR.sub(%r{en}, "fr")} Foreword

Foreword

Terms and definitions

Pour les besoins du présent document, les termes et définitions de et s’appliquent.

OUTPUT end it "processes term document sources in Chinese" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :language: zh :script: Hans Foreword [source="iso1234,iso5678"] == Terms and Definitions INPUT #{BLANK_HDR.sub(%r{en}, "zh").sub(%r{}, "")} Foreword

Foreword

Terms and definitions

界定的术语和定义适用于本文件。

OUTPUT end it "warn about external source for terms & definitions that does not point anywhere" do expect{Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)}.to output(/not referenced/).to_stderr #{ASCIIDOC_BLANK_HDR} [source="iso712"] == Terms and Definitions === Term2 INPUT end end