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

 


 


OUTPUT end it "processes section names" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"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 Annex Bibliography Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

Abstract


Foreword

This is a preamble


Introduction

Introduction Subsection

1.  Scope

Text

2.  Normative references

3.  Terms, definitions, symbols and abbreviated terms

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

A.1.2.  Annex Bibliography


Bibliography

Bibliography Subsection

OUTPUT end it "processes section names (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"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

3.  Terms, definitions, symbols and abbreviated terms

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(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"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

Terms, definitions, symbols and abbreviated terms

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(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Terms, Definitions, Symbols and Abbreviated Terms Term2 INPUT #{HTML_HDR}

1.  Terms and definitions

1.1.

Term2

OUTPUT end it "processes inline section headers" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"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(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"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(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Intro INPUT #{HTML_HDR}

Introduction

Intro

1. 

1.1. 

1.2. 
OUTPUT end end