require "spec_helper" require "relaton_iec" require "fileutils" RSpec.describe Asciidoctor::Standoc do it "appends any initial user-supplied text to boilerplate in terms and definitions" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Terms and Definitions I am boilerplate * So am I === Time This paragraph is extraneous INPUT #{BLANK_HDR} Terms and definitions

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

I am boilerplate

Time

This paragraph is extraneous

OUTPUT end it "removes initial extraneous material from Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References This is extraneous information * [[[iso216,ISO 216]]], _Reference_ This is also extraneous information INPUT #{BLANK_HDR} Normative references #{NORM_REF_BOILERPLATE} Reference ISO 216 216 ISO

This is also extraneous information

OUTPUT end it "preserves user-supplied boilerplate in Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References [NOTE,type=boilerplate] -- This is extraneous information -- * [[[iso216,ISO 216]]], _Reference_ This is also extraneous information INPUT #{BLANK_HDR} Normative references

This is extraneous information

Reference ISO 216 216 ISO

This is also extraneous information

OUTPUT end it "sorts references with their notes in Bibliography" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Bibliography This is extraneous information * [[[iso216,ISO 216]]], _Reference_ NOTE: ABC NOTE: DEF This is further extraneous information NOTE: GHI * [[[iso216,ISO 215]]], _Reference_ NOTE: JKL This is also extraneous information INPUT #{BLANK_HDR} Bibliography

This is extraneous information

Reference ISO 216 216 ISO

ABC

DEF

Reference ISO 215 215 ISO

JKL

This is further extraneous information

GHI

This is also extraneous information

OUTPUT end it "defaults section obligations" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause Text [appendix] == Clause Text INPUT #{BLANK_HDR} Clause

Text

Clause

Text

OUTPUT end it "extends clause levels past 5" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause1 === Clause2 ==== Clause3 ===== Clause4 ====== Clause 5 [level=6] ====== Clause 6 [level=7] ====== Clause 7A [level=7] ====== Clause 7B [level=6] ====== Clause 6B ====== Clause 5B INPUT #{BLANK_HDR} Clause1 Clause2 Clause3 Clause4 Clause 5 Clause 6 Clause 7A Clause 7B Clause 6B Clause 5B OUTPUT end it "inserts boilerplate before empty Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References INPUT #{BLANK_HDR} Normative references

There are no normative references in this document.

OUTPUT end it "inserts boilerplate before non-empty Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References * [[[a,b]]] A INPUT #{BLANK_HDR} Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

A b
OUTPUT end it "inserts boilerplate before empty Normative References in French" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :language: fr [bibliography] == Normative References INPUT #{BLANK_HDR.sub(/en/, "fr")} Références normatives

Le présent document ne contient aucune référence normative.

OUTPUT end it "processes section names, with footnotes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} .Foreword.footnote:[A] Text [abstract] == Abstract.footnote:[A] Text [heading=introduction] == Introduction.footnote:[A] === Introduction Subsection [heading=acknowledgements] == Acknowledgements.footnote:[A] [.preface] == Dedication [heading=scope] == Scope.footnote:[A] Text [bibliography,heading=normative references] == Normative References.footnote:[A] [bibliography,normative=true] == Normative References 2.footnote:[A] [heading=terms and definitions] == Terms and Definitions.footnote:[A] === Term1 [heading="terms and definitions"] == Terms, Definitions, Symbols and Abbreviated Terms.footnote:[A] [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 [heading=symbols and abbreviated terms] === Symbols and Abbreviated Terms.footnote:[A] [.nonterm] ==== General [heading=symbols] ==== Symbols 1.footnote:[A] [heading=abbreviated terms] == Abbreviated Terms.footnote:[A] == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex.footnote:[A] === Annex A.1 [bibliography,heading=bibliography] == Bibliography.footnote:[A] [bibliography,normative=false] == Bibliography 2.footnote:[A] === Bibliography Subsection INPUT Document title en

Text

published #{Time.now.year} article
Abstract

Text

Foreword <fn reference='1'> <p id='_'>A</p> </fn>

Text

Introduction Introduction Subsection Dedication Acknowledgements <fn reference='1'> <p id='_'>A</p> </fn>
Scope <fn reference='1'> <p id='_'>A</p> </fn>

Text

Terms and definitions <fn reference='1'> <p id='_'>A</p> </fn>

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

Term1
Terms, Definitions, Symbols and Abbreviated Terms. <fn reference='1'> <p id='_'>A</p> </fn> Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symbols and abbreviated terms <fn reference='1'> <p id='_'>A</p> </fn> General Symbols <fn reference='1'> <p id='_'>A</p> </fn> Abbreviated terms <fn reference='1'> <p id='_'>A</p> </fn> Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex. <fn reference='1'> <p id='_'>A</p> </fn> Annex A.1 Normative references <fn reference='1'> <p id='_'>A</p> </fn>

There are no normative references in this document.

Normative References 2. <fn reference='1'> <p id='_'>A</p> </fn> Bibliography <fn reference='1'> <p id='_'>A</p> </fn> Bibliography 2. <fn reference='1'> <p id='_'>A</p> </fn> Bibliography Subsection
OUTPUT end it "processes section names, default to English" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")} .Foreword Text [abstract] == Abstract Text [heading=introduction] == Introduction === Introduction Subsection [heading=acknowledgements] == Acknowledgements [.preface] == Dedication [heading=scope] == Scope Text [bibliography,heading=normative references] == Normative References [bibliography,normative=true] == Normative References 2 [heading=terms and definitions] == Terms and Definitions === Term1 [heading="terms and definitions"] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 [heading=symbols and abbreviated terms] === Symbols and Abbreviated Terms [.nonterm] ==== General [heading=symbols] ==== Symbols 1 [heading=abbreviated terms] == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 [bibliography,heading=bibliography] == Bibliography [bibliography,normative=false] == Bibliography 2 === Bibliography Subsection INPUT Document title tlh

Text

published #{Time.now.year} article
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 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.

Normative References 2 Bibliography Bibliography 2 Bibliography Subsection
OUTPUT end it "processes section names, French" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")} .Foreword Text [abstract] == Abstract Text [heading=introduction] == Introduction === Introduction Subsection [heading=acknowledgements] == Acknowledgements [.preface] == Dedication [heading=scope] == Scope Text [bibliography,heading=normative references] == Normative References [bibliography,normative=true] == Normative References 2 [heading=terms and definitions] == Terms and Definitions === Term1 [heading="terms and definitions"] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 [heading=symbols and abbreviated terms] === Symbols and Abbreviated Terms [.nonterm] ==== General [heading=symbols] ==== Symbols 1 [heading=abbreviated terms] == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 [bibliography,heading=bibliography] == Bibliography [bibliography,normative=false] == Bibliography 2 === Bibliography Subsection INPUT Document title fr

Text

published #{Time.now.year} article
Résumé

Text

Avant-propos

Text

Introduction Introduction Subsection Dedication Remerciements
Domaine d’application

Text

Terms et définitions

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

Term1
Terms, Definitions, Symbols and Abbreviated Terms Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 Symboles et termes abrégés General Symboles Termes abrégés Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 Références normatives

Le présent document ne contient aucune référence normative.

Normative References 2 Bibliographie Bibliography 2 Bibliography Subsection
OUTPUT end it "processes section names, Simplified Chinese" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")} .Foreword Text [abstract] == Abstract Text [heading=introduction] == Introduction === Introduction Subsection [heading=acknowledgements] == Acknowledgements [.preface] == Dedication [heading=scope] == Scope Text [bibliography,heading=normative references] == Normative References [bibliography,normative=true] == Normative References 2 [heading=terms and definitions] == Terms and Definitions === Term1 [heading="terms and definitions"] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 [heading=symbols and abbreviated terms] === Symbols and Abbreviated Terms [.nonterm] ==== General [heading=symbols] ==== Symbols 1 [heading=abbreviated terms] == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 [bibliography,heading=bibliography] == Bibliography [bibliography,normative=false] == Bibliography 2 === Bibliography Subsection INPUT Document title zh

Text

published #{Time.now.year} article
摘要

Text

前言

Text

引言 Introduction Subsection Dedication 致謝
范围

Text

术语和定义

下列术语和定义适用于本文件。

Term1
Terms, Definitions, Symbols and Abbreviated Terms Introduction Intro 1 Intro 2 Intro 3 Intro 4 Intro 5 Term1 Normal Terms Term2 符号、代号和缩略语 General 符号 代号和缩略语 Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 规范性引用文件

本文件并没有规范性引用文件。

Normative References 2 参考文献 Bibliography 2 Bibliography Subsection
OUTPUT end it "processes section names, internationalisation file" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")} .Foreword Text [abstract] == Abstract Text [heading=introduction] == Introduction === Introduction Subsection [heading=acknowledgements] == Acknowledgements [.preface] == Dedication [heading=scope] == Scope Text [bibliography,heading=normative references] == Normative References [bibliography,normative=true] == Normative References 2 [heading=terms and definitions] == Terms and Definitions === Term1 [heading="terms and definitions"] == Terms, Definitions, Symbols and Abbreviated Terms [.nonterm] === Introduction ==== Intro 1 === Intro 2 [.nonterm] ==== Intro 3 === Intro 4 ==== Intro 5 ===== Term1 === Normal Terms ==== Term2 [heading=symbols and abbreviated terms] === Symbols and Abbreviated Terms [.nonterm] ==== General [heading=symbols] ==== Symbols 1 [heading=abbreviated terms] == Abbreviated Terms == Clause 4 === Introduction === Clause 4.2 == Terms and Definitions [appendix] == Annex === Annex A.1 [bibliography,heading=bibliography] == Bibliography [bibliography,normative=false] == Bibliography 2 === Bibliography Subsection INPUT Document title en

Text

published #{Time.now.year} article
Abstract

Text

Antaŭparolo

Text

Enkonduko Introduction Subsection Dedication Acknowledgements
Amplekso

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 Simboloj kai mallongigitaj terminoj Abbreviated terms Clause 4 Introduction Clause 4.2 Terms and Definitions
Annex Annex A.1 Normaj citaĵoj

There are no normative references in this document.

Normative References 2 Bibliografio Bibliography 2 Bibliography Subsection
OUTPUT end end