require "spec_helper" RSpec.describe IsoDoc do it "processes English" do expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" en Foreword

This is a preamble

Introduction Introduction Subsection

This is patent boilerplate

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 An Appendix Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

FOREWORD


0  INTRODUCTION

0.1 Introduction Subsection

This is patent boilerplate

#{IEC_TITLE}

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


Annex A

(normative)

Annex

A.1 Annex A.1

A.1.1 Annex A.1a

Appendix 1 An Appendix


Bibliography

Bibliography Subsection

OUTPUT end it "defaults to English" do expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" tlh Foreword

This is a preamble

Introduction Introduction Subsection

This is patent boilerplate

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 An Appendix Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR.gsub(/"en"/, '"tlh"')}

FOREWORD


0  INTRODUCTION

0.1 Introduction Subsection

This is patent boilerplate

#{IEC_TITLE}

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


Annex A

(normative)

Annex

A.1 Annex A.1

A.1.1 Annex A.1a

Appendix 1 An Appendix


Bibliography

Bibliography Subsection

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

This is a preamble

Introduction Introduction Subsection

This is patent boilerplate

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 An Appendix Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "COMMISSION ELECTROTECHNIQUE INTERNATIONALE"). gsub(/"en"/, '"fr"')}

AVANT-PROPOS


0  INTRODUCTION

0.1 Introduction Subsection

This is patent boilerplate

#{IEC_TITLE.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "COMMISSION ELECTROTECHNIQUE INTERNATIONALE")}

1  Domaine d'application

Text

2  Références normatives

3  Terms, définitions, symboles et termes abrégés

3.1 Normal Terms

3.1.1

Term2

3.2 Symboles et termes abrégés

Symbol

Definition

4  Symboles et termes abrégés

Symbol

Definition

5  Clause 4

5.1 Introduction

5.2 Clause 4.2


Annexe A

(normative)

Annex

A.1 Annex A.1

A.1.1 Annex A.1a

Appendice 1 An Appendix


Bibliographie

Bibliography Subsection

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

This is a preamble

Introduction Introduction Subsection

This is patent boilerplate

Scope

11

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 An Appendix Normative References Cereals and cereal products ISO 712 ISO Bibliography Bibliography Subsection
INPUT #{HTML_HDR.gsub(/"en"/, '"zh"').sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "国际电工委员会")}

前言


0  引言

0.1 Introduction Subsection

This is patent boilerplate

#{IEC_TITLE.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "国际电工委员会")}

1  范围

ISO 712、第1–1

2  规范性引用文件

ISO 712, Cereals and cereal products

3  术语、定义、符号、代号和缩略语

3.1 Normal Terms

3.1.1

Term2

3.2 符号、代号和缩略语

Symbol

Definition

4  符号、代号和缩略语

Symbol

Definition

5  Clause 4

5.1 Introduction

5.2 Clause 4.2


附件A

(规范性附录)

Annex

A.1 Annex A.1

A.1.1 Annex A.1a

附录1 An Appendix


参考文献

Bibliography Subsection

OUTPUT end end