require "spec_helper" RSpec.describe IsoDoc do it "processes document with no content" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" INPUT

 


 


OUTPUT end it "processes section names" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Foreword Foreword

This is a preamble

Introduction Introduction Subsection
Scope

Text

Terms, Definitions, Symbols and Abbreviated Terms Normal Terms Term2 Definitions
Symbol
Definition
Symbol
Definition
Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

Abstract


Foreword

This is a preamble


Introduction

Introduction Subsection

1.  Scope

Text

2.  Normative references

There are no normative references in this document.

3.  Terms, definitions, symbols and abbreviated terms

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:

3.1. Normal Terms

3.1.1.

Term2

3.2. Definitions

Symbol

Definition

4.  Symbols and abbreviated terms

Symbol

Definition

5.  Clause 4

5.1. Introduction

5.2. Clause 4.2

5.3.


Annex A
(normative)

Annex

A.1. Annex A.1

A.1.1. Annex A.1a


Bibliography

Bibliography Subsection

OUTPUT end it "processes section names (Word)" do expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Foreword Foreword

This is a preamble

Introduction Introduction Subsection
Scope

Text

Terms, Definitions, Symbols and Abbreviated Terms Normal Terms Term2
Symbol
Definition
Symbol
Definition
Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a Normative References Bibliography Bibliography Subsection
INPUT

 



Abstract


Foreword

This is a preamble


Introduction

Introduction Subsection

 


1.  Scope

Text

2.  Normative references

There are no normative references in this document.

3.  Terms, definitions, symbols and abbreviated terms

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:

3.1. Normal Terms

3.1.1.

Term2

3.2. Symbols and abbreviated terms

Symbol

Definition

4.  Symbols and abbreviated terms

Symbol

Definition

5.  Clause 4

5.1. Introduction

5.2. Clause 4.2

5.3.


Annex A
(normative)

Annex

A.1. Annex A.1

A.1.1. Annex A.1a


Bibliography

Bibliography Subsection

OUTPUT end it "processes section names suppressing section numbering" do expect(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Foreword

This is a preamble

Introduction Introduction Subsection
Scope

Text

Terms, Definitions, Symbols and Abbreviated Terms Normal Terms Term2
Symbol
Definition
Symbol
Definition
Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

Foreword

This is a preamble


Introduction

Introduction Subsection

Scope

Text

Normative references

There are no normative references in this document.

Terms, definitions, symbols and abbreviated terms

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:

Normal Terms

3.1.1.

Term2

Symbols and abbreviated terms

Symbol

Definition

Symbols and abbreviated terms

Symbol

Definition

Clause 4

Introduction

Clause 4.2


Annex A
(normative)

Annex

Annex A.1

Annex A.1a


Bibliography

Bibliography Subsection

OUTPUT end it "processes simple terms & definitions" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Terms, Definitions, Symbols and Abbreviated Terms Term2 INPUT #{HTML_HDR}

1.  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:

1.1.

Term2

OUTPUT end it "warn about external source for terms & definitions that does not point anywhere" do expect{ IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true) }.to output(/not referenced/).to_stderr Terms, Definitions, Symbols and Abbreviated Terms Term2 INPUT end it "processes terms & definitions with external source" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Terms, Definitions, Symbols and Abbreviated Terms Term2 Normative References Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method ISO 712 International Organization for Standardization INPUT #{HTML_HDR}

1.  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.

ISO 712, Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method

2.  Terms and definitions

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

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

2.1.

Term2

OUTPUT end it "processes empty terms & definitions with external source" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Terms, Definitions, Symbols and Abbreviated Terms Normative References Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method ISO 712 ISO INPUT #{HTML_HDR}

1.  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.

ISO 712, Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method

2.  Terms and definitions

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

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

OUTPUT end it "processes empty terms & definitions" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Terms, Definitions, Symbols and Abbreviated Terms INPUT #{HTML_HDR}

1.  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:

OUTPUT end it "processes inline section headers" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Clause 4 Introduction Clause 4.2 INPUT #{HTML_HDR}

1.  Clause 4

1.1. Introduction

1.2. Clause 4.2
OUTPUT end it "processes inline section headers with suppressed heading numbering" do expect(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Clause 4 Introduction Clause 4.2 INPUT #{HTML_HDR}

Clause 4

Introduction

Clause 4.2
OUTPUT end it "processes sections without titles" do expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" Intro INPUT #{HTML_HDR}

Introduction

Intro

1. 

1.1.

1.2.
OUTPUT end end