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 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) .sub(%r{.*}m, ""))) .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 international-standard 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 Norme internationale International Standard 60 2020 International Electrotechnical Commission IEC international-standard Norme internationale International Standard IEC 60050 1<tab/>Normative References

There are no normative references in this document.

TITLE [B] B
Bibliography

There are no normative references in this document.

TITLE [B] [1] 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) .sub(%r{.*}m, ""))) .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

paddy paddy 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 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
SOURCE: 3.1ISO 7301:2011, 3.1, modified – 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.

SOURCE: 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

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

192-01-02

paddy

paddy rice

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

SOURCE: ISO 7301:2011, 3.1

OUTPUT expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) .convert("test", input, true) .sub(%r{.*}m, ""))) .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 1<tab/>Terms and definitions 192-01 General 192-01-01 paddy

rice retaining its husk after threshing

SOURCE: 3.1 ISO 7301:2011, 3.1, modified – 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) .sub(%r{.*}m, ""))) .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") OUTPUT end it "convert termbase references to the current document to xrefs" do input = <<~INPUT IEC 60050-192 ED 1 60050 international-standard false IEC 60050 International standard Terms and definitions General durabilityof an item

rice retaining its husk after threshing

Dependability includes availability (192-01-02192-01-02, 191-01-02191-01-02)

sub item

part of the subject being considered

INPUT presxml = <<~PRESXML IEC 60050-192 ED 1 60050 international-standard Norme internationale International Standard false IEC 60050 International standard 1<tab/>Terms and definitions 192-01 General 192-01-01 durability, <of an item>

rice retaining its husk after threshing

Note 1 to entry

Dependability includes availability (192-01-02 (192-01-02), 191-01-02 [term defined in ])

192-01-02 sub item

part of the subject being considered

PRESXML expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) .convert("test", input, true) .sub(%r{.*}m, ""))) .to be_equivalent_to xmlpp(presxml) end it "processes multilingual IEV terms" do input = <<~INPUT IEC 60050-192 ED 1 60050 Terms and definitions General systemin dependability Betrachtungseinheitfeminine アイテム Einheitfeminine 产品在可靠性方面 نظام،في الاعتمادیة paddy rice rough rice cargo rice Fifth Designation

set of interrelated items that collectively fulfil a requirement

A system is considered to have a defined real or abstract boundary.

External resources (from outside the system boundary) may be required for the system to operate.

External resources (from outside the system boundary) may be required for the system to operate.

3.1ISO 7301:2011, 3.1 modified by extension to suit the dependability context
entitémasculine en sûreté de fonctionnement Designation cinquième Designation sixième

ensemble d’entités reliées entre elles qui satisfont collectivement à une exigence

Un système est considéré comme ayant une frontière définie, réelle ou abstraite.

Des ressources externes (provenant d’au-delà de la frontière) peuvent être nécessaires au fonctionnement du système.

External resources (from outside the system boundary) may be required for the system to operate.

3.1ISO 7301:2011, 3.1 modifié pour adapter au contexte de la sûreté de fonctionnement
paddy

rice retaining its husk after threshing

INPUT presxml = <<~PRESXML IEC 60050-192 ED 1 60050 1 <tab/> Terms and definitions 192-01 General 192-01-01 system , <in dependability> paddy rice rough rice cargo rice

set of interrelated items that collectively fulfil a requirement

CONTRAST: Fifth Designation ( 192-01-02 )

EXAMPLE

External resources (from outside the system boundary) may be required for the system to operate.

Note 1 to entry

A system is considered to have a defined real or abstract boundary.

Note 2 to entry

External resources (from outside the system boundary) may be required for the system to operate.

SOURCE: 3.1 ISO 7301:2011, 3.1 , modified – modified by extension to suit the dependability context entité , <en sûreté de fonctionnement>, m

ensemble d’entités reliées entre elles qui satisfont collectivement à une exigence

CONTRASTEZ: Designation cinquième ( 192-01-02 )

VOIR: Designation sixième ( 192-01-02 )

EXEMPLE

External resources (from outside the system boundary) may be required for the system to operate.

Note 1 à l’article

Un système est considéré comme ayant une frontière définie, réelle ou abstraite.

Note 2 à l’article

Des ressources externes (provenant d’au-delà de la frontière) peuvent être nécessaires au fonctionnement du système.

SOURCE: 3.1 ISO 7301:2011, 3.1 , modifié – modifié pour adapter au contexte de la sûreté de fonctionnement
ar
؜نظام،؜ ؜, <في الاعتمادیة>؜
de
Betrachtungseinheit , f Einheit , f
ja
アイテム
zh
产品 , <在可靠性方面>
192-01-02 paddy

rice retaining its husk after threshing

PRESXML expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}) .convert("test", input, true) .sub(%r{.*}m, ""))) .to be_equivalent_to xmlpp(presxml) end end