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 == Acknowledgements [.preface] == Dedication == Scope Text == Normative References == Terms and Definitions === Term1 == Terms, Definitions, Symbols and Abbreviated Terms [.boilerplate] === Boilerplate Boilerplate text [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 === Symbols and Abbreviated Terms [.nonterm] ==== General ==== Symbols == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 == Bibliography === Bibliography Subsection INPUT #{BLANK_HDR.sub(//, "

Text

")} Abstract

Text

Foreword

Text

Introduction Introduction Subsection Dedication Acknowledgements
Scope

Text

Terms and definitions

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

Term1
Terms, definitions, symbols and abbreviated terms

Boilerplate text

Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symbols and abbreviated terms General Symbols
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 number attributes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [number=1bis] == Scope Text [number=2bis] == Normative References [number=3bis] == Terms and Definitions [number=4bis] === Term1 [number=5bis] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm,number=6bis] === Introduction [number=7bis] ==== Intro 1 [number=8bis] === Intro 2 [number=9bis] === Symbols and Abbreviated Terms [.nonterm,number=10bis] ==== General [number=11bis] ==== Symbols [number=12bis] == Abbreviated Terms [number=13bis] == Clause 4 [number=14bis] === Introduction [number=15bis] === Clause 4.2 [number=16bis] == Terms and Definitions [appendix,number=17bis] == Annex [number=18bis] === Annex A.1 [bibliography,number=19bis] == Bibliography [number=20bis] === Bibliography Subsection INPUT #{BLANK_HDR} Scope

Text

Terms and definitions

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

Term1
Terms, definitions, symbols and abbreviated terms

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

Introduction Intro 1 Intro 2 Symbols and abbreviated terms General Symbols
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} [language=en,script=Latn] == Foreword Text [abstract,language=en,script=Latn] == Abstract Text [language=en,script=Latn] == Introduction [language=en,script=Latn] === Introduction Subsection [language=en,script=Latn] == Acknowledgements [.preface] [language=en,script=Latn] == Dedication [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 [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

")} Abstract

Text

Foreword

Text

Introduction Introduction Subsection Dedication Acknowledgements
Scope

Text

Terms and definitions

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

Term1
Terms, definitions, symbols and abbreviated terms

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

Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symbols and abbreviated terms General Symbols
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 and type 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=acknowledgements] == Ευχαριστίες [heading=normative references] == Κανονιστικές Παραπομπές [heading=terms and definitions] == Όροι και Ορισμοί === Term1 [heading="terms, definitions, symbols and abbreviated terms"] == Όροι, Ορισμοί, Σύμβολα και Συντομογραφίες === Normal Terms ==== Term2 [heading=symbols] === Σύμβολα και Συντομογραφίες [heading=abbreviated terms] == Σύμβολα και Συντομογραφίες [type=ABC] == Clause 4 [type=DEF] === Introduction === Clause 4.2 [appendix] == Annex === Annex A.1 [heading=bibliography] == Βιβλιογραφία === Bibliography Subsection INPUT #{BLANK_HDR.sub(//, "

Text

")} Abstract

Text

Foreword

Text

Introduction Introduction Subsection Acknowledgements
Terms and definitions

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

Term1
Terms, definitions and symbols

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

Normal Terms Term2 Symbols
Abbreviated terms 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 "varies terms & symbols title" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [heading="terms, definitions, symbols and abbreviated terms"] == Terms, Definitions, Symbols Section === Term === Symbols INPUT #{BLANK_HDR} Terms, definitions and symbols

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

Term Symbols
OUTPUT end it "varies terms & abbreviated terms title" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [heading="terms, definitions, symbols and abbreviated terms"] == Terms, Definitions, Abbreviated Terms Section === Term [heading="abbreviated terms"] === Symbols INPUT #{BLANK_HDR} Terms, definitions and abbreviated terms

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

Term Abbreviated terms
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 terminal nodes in terms with term subsection names" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Terms, definitions, symbols and abbreviated terms === Terms and definitions === Symbols INPUT #{BLANK_HDR} Terms, definitions and symbols

No terms and definitions are listed in this document.

Terms and definitions Symbols
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")} Avant-propos

Foreword

Terms et définitions

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

术语和定义

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

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 it "treats terminal terms subclause named as terms clause as a normal clause" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [[tda]] == Terms, definitions, symbols and abbreviations [[terms]] === Terms and definitions === Symbols INPUT #{BLANK_HDR} Terms, definitions and symbols

No terms and definitions are listed in this document.

Terms and definitions Symbols
OUTPUT end it "treats non-terminal terms subclause named as terms clause as a terms clause" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Scope [[tda]] == Terms, definitions, symbols and abbreviations [[terms]] === Terms and definitions [[terms-concepts]] ==== Basic concepts [[term-date]] ===== date _time_ (<>) on the _calendar_ (<>) _time scale_ (<>) INPUT #{BLANK_HDR} Scope Terms and definitions

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

Terms and definitions Basic concepts date

time ( ) on the calendar ( ) time scale ( )

OUTPUT end it "leaves alone special titles in preface or appendix" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(strip_guid(<<~"OUTPUT")) #{ASCIIDOC_BLANK_HDR} [.preface] [[t1]] == Terms and definitions [[t2]] === Term1 [appendix,language=fr] [[sym]] == Symbols and abbreviated terms [.appendix] [[app]] [bibliography] == Normative Reference INPUT #{BLANK_HDR} Terms and definitions Term1 Symbols and abbreviated terms Bibliography OUTPUT end end