require "spec_helper" RSpec.describe IsoDoc do it "cross-references notes in amendments" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") amendment

Scope

These results are based on a study carried out on three different types of kernel.

Widgets

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

These results are based on a study carried out on three different types of kernel.

INPUT #{HTML_HDR}

Foreword

[N] [note1] [note2] A.1, Note A.2, Note 1 A.2, Note 2

Scope

NOTE  These results are based on a study carried out on three different types of kernel.

[n]

Widgets

NOTE  These results are based on a study carried out on three different types of kernel.

NOTE  These results are based on a study carried out on three different types of kernel.

[note1] [note2]


Annex A
(informative)

A.1 

NOTE  These results are based on a study carried out on three different types of kernel.

A.2 

NOTE 1  These results are based on a study carried out on three different types of kernel.

NOTE 2  These results are based on a study carried out on three different types of kernel.

OUTPUT end it "cross-references sections" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") amendment Foreword

This is a preamble

Introduction Introduction Subsection Text
Scope

Text

Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a An Appendix Normative References Bibliography Bibliography Subsection
INPUT #{HTML_HDR}

Foreword

This is a preamble [C] [C1] [D] [H] [I] [J] [K] [L] [M] [N] [O] Annex A A.1 A.1.1 Annex A, Appendix 1 [R]


Introduction

Introduction Subsection

Text

Scope

Text

Normative references

Clause 4

Introduction

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 section names" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") amendment Copyright License Legal Feedback Foreword Foreword

This is a preamble

Introduction Introduction Subsection Dedication Note to reader Acknowledgements
Scope

Text

Clause 4 Introduction Clause 4.2
Annex Annex A.1 Annex A.1a Annex Bibliography Normative References Bibliography Bibliography Subsection
INPUT

 


 


License

Feedback


Abstract


Foreword

This is a preamble


Introduction

Introduction Subsection


Dedication


Note to reader


Acknowledgements

Scope

Text

Normative references

Clause 4

Introduction

Clause 4.2


Annex A
(normative)

Annex

A.1  Annex A.1

A.1.1  Annex A.1a

A.1.2  Annex Bibliography


Annex B
(normative)


Bibliography

Bibliography Subsection

OUTPUT end it "processes IsoXML metadata" do c = IsoDoc::Iso::HtmlConvert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" Introduction — Main Title — Title — Title Part  — Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions Introduction Main Title — Title Title Part Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions Introduction Française — Titre Principal — Part du Titre — Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport Introduction Française Titre Principal Part du Titre Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport ISO/PreNWIP3 17301-1:2016/Amd.1 ISO/PreNWIP3 17301-1:2016/Amd.1(E) ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E) 17301 2016-05-01 International Organization for Standardization ISO International Organization for Standardization ISO 2 2000-01-01 0.3.4 en 10 20 3 2017 International Organization for Standardization ISO amendment TC TC1 SC SC1 WG WG1 SECRETARIAT 1 2 3 17301 New work item proposal international-standard INPUT {:agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2016-05-01", :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1", :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)", :docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)", :docnumeric=>"17301", :docsubtitle=>"Introduction Française — Titre Principal — Partie 1: Part du Titre", :docsubtitleamd=>"Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport", :docsubtitleamdlabel=>"AMENDMENT 1", :docsubtitlecorrlabel=>"RECTIFICATIF TECHNIQUE 2", :docsubtitleintro=>"Introduction Française", :docsubtitlemain=>"Titre Principal", :docsubtitlepart=>"Part du Titre", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Introduction — Main Title — Title — Part 1: Title Part", :doctitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions", :doctitleamdlabel=>"AMENDMENT 1", :doctitlecorrlabel=>"TECHNICAL CORRIGENDUM 2", :doctitleintro=>"Introduction", :doctitlemain=>"Main Title — Title", :doctitlepart=>"Title Part", :doctitlepartlabel=>"Part 1", :doctype=>"Amendment", :docyear=>"2017", :draft=>"0.3.4", :draftinfo=>" (draft 0.3.4, 2000-01-01)", :edition=>"2", :editorialgroup=>["A 1", "B 2", "C 3"], :ics=>"1, 2, 3", :keywords=>[], :obsoletes=>nil, :obsoletes_part=>nil, :publisher=>"International Organization for Standardization", :revdate=>"2000-01-01", :revdate_monthyear=>"January 2000", :sc=>"B 2", :secretariat=>"SECRETARIAT", :stage=>"10", :stage_int=>10, :stageabbr=>"NWIP", :statusabbr=>"PreNWIP3", :tc=>"A 1", :tc_docnumber=>[], :unpublished=>true, :wg=>"C 3"} OUTPUT end it "processes middle title" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Introduction Main Title — Title Title Part Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions 17301 INPUT #{HTML_HDR}

Introduction — Main Title — Title —

Part 1:
Title Part

AMENDMENT 1: Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions

TECHNICAL CORRIGENDUM 2

OUTPUT end end