require "spec_helper" RSpec.describe IsoDoc do it "processes introductions under IEV" do input = <<~INPUT IEC/PWI 60050-871 ED 2 60050 Foreword

This is a preamble

Introduction Introduction Subsection
INPUT presxml = <<~OUTPUT IEC/PWI 60050-871 ED 2 60050 IEC/PWI 60050-871 ED 2 60050 Foreword

This is a preamble

Introduction Introduction Subsection
OUTPUT html = <<~OUTPUT #{HTML_HDR}

FOREWORD


Introduction

Introduction Subsection

#{IEC_TITLE1}
OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html) end it "processes bibliographies under IEV" do input = <<~INPUT IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 2020 International Electrotechnical Commission IEC article IEC 60050 Normative References

There are no normative references in this document.

TITLE B
Bibliography

There are no normative references in this document.

TITLE B
INPUT presxml = <<~OUTPUT IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 2020 International Electrotechnical Commission IEC article IEC 60050 IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 2020 International Electrotechnical Commission IEC article IEC 60050 1<tab/>Normative References

There are no normative references in this document.

TITLE B
Bibliography

There are no normative references in this document.

TITLE B
OUTPUT html = <<~OUTPUT #{HTML_HDR}

FOREWORD

#{IEC_TITLE1}

1  Normative References

There are no normative references in this document.

OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html) end it "processes IEV terms" do input = <<~INPUT IEC 60050-192 ED 1 60050 Terms and definitions General paddy

rice retaining its husk after threshing

Foreign seeds, husks, bran, sand, dust.

  • A
  • A
3.1ISO 7301:2011, 3.1

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

paddypaddy rice rough rice cargo rice rice

rice retaining its husk after threshing

  • A

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

  • A

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

3.1ISO 7301:2011, 3.1
INPUT presxml = <<~INPUT IEC 60050-192 ED 1 60050 IEC 60050-192 ED 1 60050 1<tab/>Terms and definitions 192-01 General 192-01-01 paddy

rice retaining its husk after threshing

EXAMPLE 1

Foreign seeds, husks, bran, sand, dust.

  • A
EXAMPLE 2
  • A
3.1ISO 7301:2011, 3.1

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

192-01-02 paddypaddy rice rough rice cargo rice rice

rice retaining its husk after threshing

EXAMPLE
  • A
Note 1 to entry

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

Note 2 to entry
  • A

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

3.1ISO 7301:2011, 3.1
INPUT html = <<~OUTPUT #{HTML_HDR}

FOREWORD

#{IEC_TITLE1}

1  Terms and definitions


192-01 General

192-01-01

paddy

rice retaining its husk after threshing

EXAMPLE 1   Foreign seeds, husks, bran, sand, dust.

  • A

EXAMPLE 2  

  • A

[TERMREF] ISO 7301:2011, 3.1 [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here [/TERMREF]

192-01-02

paddy, <rice>

paddy rice, <rice>

rough rice, <rice>

DEPRECATED: cargo rice, <rice>

rice retaining its husk after threshing

EXAMPLE  

  • A

Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

Note 2 to entry:

  • A

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

[TERMREF] ISO 7301:2011, 3.1 [/TERMREF]

OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html) end it "populates Word template with terms reference labels" do FileUtils.rm_f "test.doc" FileUtils.rm_f "test.html" input = <<~INPUT IEC 60050-192 ED 1 60050 Terms and definitions General paddy

rice retaining its husk after threshing

3.1ISO 7301:2011, 3.1

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

INPUT presxml = <<~OUTPUT IEC 60050-192 ED 1 60050 IEC 60050-192 ED 1 60050 1<tab/>Terms and definitions 192-01 General 192-01-01 paddy

rice retaining its husk after threshing

3.1 ISO 7301:2011, 3.1

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml) IsoDoc::Iec::WordConvert.new({}).convert("test", presxml, false) word = File.read("test.doc").sub(/^.*
/m, '
'). sub(%r{
.*$}m, "") expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")

 

1   Terms and definitions


192-01 General

192-01-01

paddy

rice retaining its husk after threshing

SOURCE: ISO 7301:2011, 3.1 , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

OUTPUT end end