require "spec_helper" RSpec.describe IsoDoc do it "processes admonitions" do input = <<~INPUT CAUTION

Only use paddy or parboiled rice for the determination of husked rice yield.

Para 2.

INPUT presxml = <<~INPUT

CAUTION — Only use paddy or parboiled rice for the determination of husked rice yield.

Para 2.

INPUT output = <<~OUTPUT #{HTML_HDR}

Foreword

CAUTION — Only use paddy or parboiled rice for the determination of husked rice yield.

Para 2.

OUTPUT expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}) .convert("test", input, true))) .to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}) .convert("test", presxml, true))) .to be_equivalent_to xmlpp(output) end it "processes admonitions with titles" do input = <<~INPUT Title

Only use paddy or parboiled rice for the determination of husked rice yield.

INPUT presxml = <<~INPUT Title
  • List

Only use paddy or parboiled rice for the determination of husked rice yield.

INPUT output = <<~OUTPUT #{HTML_HDR}

Foreword

Title —

Only use paddy or parboiled rice for the determination of husked rice yield.

OUTPUT expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}) .convert("test", input, true))) .to be_equivalent_to xmlpp(presxml) expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}) .convert("test", input, true))) .to be_equivalent_to xmlpp(output) end it "renders figures" do input = <<~INPUT

Scope
Figure 1 — Split-it-right sample divider

Widgets
Figure 2 — Split-it-right sample divider
Figure 3 — Split-it-right sample divider

Figure A.1 — Split-it-right sample divider
Figure A.2 — Split-it-right sample divider
Figure A.3 — Split-it-right sample divider
INPUT html = <<~OUTPUT #{HTML_HDR}

Foreword

Scope

Figure 1 — Split-it-right sample divider

Widgets

Figure 2 — Split-it-right sample divider

Figure 3 — Split-it-right sample divider


Figure A.1 — Split-it-right sample divider

Figure A.2 — Split-it-right sample divider

Figure A.3 — Split-it-right sample divider

OUTPUT word = <<~OUTPUT

 



Foreword

 


Scope

Figure 1 — Split-it-right sample divider

Widgets

Figure 2 — Split-it-right sample divider

Figure 3 — Split-it-right sample divider


Figure A.1 — Split-it-right sample divider

Figure A.2 — Split-it-right sample divider

Figure A.3 — Split-it-right sample divider


OUTPUT output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", input, true) expect(xmlpp(output)).to be_equivalent_to xmlpp(html) output = IsoDoc::Iso::WordConvert.new({}).convert("test", input, true) expect(xmlpp(Nokogiri::XML(output).at("//body").to_xml)) .to be_equivalent_to xmlpp(word) end it "renders subfigures (HTML)" do output = IsoDoc::Iso::HtmlConvert.new({}) .convert("test", <<~"INPUT", true)

Scope Widgets
Figure 1
a) — Split-it-right sample divider
b) — Split-it-right sample divider

Figure A.1
a) — Split-it-right sample divider
b) — Split-it-right sample divider
INPUT expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")

 


 



Scope


a) — Split-it-right sample divider

b) — Split-it-right sample divider

Figure A.1

OUTPUT end it "processes formulae" do input = <<~INPUT r = 1 %
r

is the repeatability limit.

s_1

is the other repeatability limit.

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

r = 1 %
INPUT presxml = <<~OUTPUT r = 1 %
r

is the repeatability limit.

s_1

is the other 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.

1 r = 1 %
OUTPUT html = <<~OUTPUT #{HTML_HDR}

Foreword

(#(r = 1 %)#)

where

(#(r)#)

is the repeatability limit.

(#(s_1)#)

is the other 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 word = <<~OUTPUT

Foreword

(#(r = 1 %)#)  

where

(#(r)#)

is the repeatability limit.

(#(s_1)#)

is the other 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 output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true) expect(xmlpp(output)).to be_equivalent_to xmlpp(presxml) output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true) expect(xmlpp(output)).to be_equivalent_to xmlpp(html) output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true) expect(xmlpp(output .sub(%r{^.*
\s*

}m, '

') .sub(%r{

 

\s*

.*$}m, ""))).to be_equivalent_to xmlpp(word) end it "processes formulae with single definition list entry" do output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true) r = 1 %
r

is the repeatability limit.

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

1 r = 1 %
INPUT expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT") #{HTML_HDR}

Foreword

(#(r = 1 %)#)

where (#(r)#)

is the repeatability limit.

  [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 end