require "spec_helper" RSpec.describe IsoDoc do it "processes amend blocks" do input = <<~INPUT Document title en published 2020 article Change Clause 2 7

This table contains information on polygon cells which are not included in ISO 10303-52. Remove table 2 completely and replace with:

Edges of triangle and quadrilateral cells
triangle quadrilateral
edge vertices edge vertices
1 1, 2 1 1, 2
2 2, 3 2 2, 3
3 3, 1 3 3, 4
4 4, 1
Figure

This is not generalised further.

INPUT presxml = <<~OUTPUT Document title en published 2020 article 1.<tab/>Change Clause

This table contains information on polygon cells which are not included in ISO 10303-52. Remove table 2 completely and replace with:

Table 2 — Edges of triangle and quadrilateral cells
triangle quadrilateral
edge vertices edge vertices
1 1, 2 1 1, 2
2 2, 3 2 2, 3
3 3, 1 3 3, 4
4 4, 1
Figure
EXAMPLE 7

This is not generalised further.

OUTPUT html = <<~OUTPUT

 


 


Document title

1.  Change Clause

This table contains information on polygon cells which are not included in ISO 10303-52. Remove table 2 completely and replace with:

Table 2 — Edges of triangle and quadrilateral cells

triangle quadrilateral
edge vertices edge vertices
1 1, 2 1 1, 2
2 2, 3 2 2, 3
3 3, 1 3 3, 4
4 4, 1

Figure

EXAMPLE 7

This is not generalised further.

OUTPUT expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{.*}m, "")).to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html) end it "processes unlabelled notes (Presentation XML)" do expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

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

INPUT NOTE

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

OUTPUT end it "processes unlabelled notes (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") NOTE

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

INPUT #{HTML_HDR}

Foreword

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

OUTPUT end it "processes unlabelled notes (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") NOTE

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

INPUT

 



Foreword

 


OUTPUT end context "disable inkscape" do it "converts SVG (Word) with inkscape disabled" do FileUtils.rm_rf "spec/assets/odf1.emf" allow(IsoDoc::WordFunction::Body).to receive(:inkscape_installed?).and_return(nil) allow_any_instance_of(IsoDoc::WordFunction::Body).to receive(:inkscape_installed?) expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).gsub(/['"][^'".]+(?
INPUT

 



Foreword

 


OUTPUT end end it "processes examples (Presentation XML)" do expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Title

Hello

Sample
INPUT EXAMPLE — Title

Hello

Sample
OUTPUT end it "processes examples (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") EXAMPLE — Title

Hello

Sample
INPUT #{HTML_HDR}

Foreword

EXAMPLE — Title

Hello

  

Sample

OUTPUT end it "processes examples (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") EXAMPLE — Title

Hello

Sample INPUT

 



Foreword

EXAMPLE — Title

Hello

Sample

 


OUTPUT end it "processes sequences of examples" do expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

Hello

Title

Hello

Hello

INPUT EXAMPLE 1

Hello

EXAMPLE 2 — Title

Hello

EXAMPLE

Hello

OUTPUT end it "processes sourcecode (Presentation XML)" do expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Ruby code puts x Que? INPUT Figure 1 — Ruby code puts x Que? OUTPUT end it "processes sourcecode (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Figure 1 — Ruby code puts x Que? INPUT #{HTML_HDR}

Foreword


       
  puts x

Figure 1 — Ruby code

  
Que?

OUTPUT end it "processes sourcecode (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") Figure 1 — Ruby code puts x Que? INPUT

 



Foreword

(#(r = 1 %)#)  

where

(#(r)#)

is the repeatability limit.

NOTE   [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.

(#(r = 1 %)#)   (1)

 


OUTPUT end it "processes paragraph attributes" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

Vache Equipment
Fictitious
World

Justify

INPUT #{HTML_HDR}

Foreword

Vache Equipment
Fictitious
World

Justify

OUTPUT end it "processes paragraph attributes (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

Vache Equipment
Fictitious
World

Justify

INPUT