require "spec_helper" RSpec.describe IsoDoc do it "processes inline formatting" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

A B C D E F G


INPUT #{HTML_HDR}

Foreword

A B C D E F G



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

example mailto:fred@example.com

INPUT #{HTML_HDR}

Foreword

http://example.com example fred@example.com mailto:fred@example.com

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

example

INPUT #{HTML_HDR}

Foreword

<barry fred="http://example.com">example</barry>

OUTPUT end it "processes AsciiMath and MathML" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true).sub(/

A X Latex?

INPUT #{HTML_HDR.sub(/

Foreword

(#(A)#) X Latex?

OUTPUT end it "overrides AsciiMath delimiters" do expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

A (#((Hello))#)

INPUT #{HTML_HDR}

Foreword

(#(((A)#))) (#((Hello))#)

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

A A

1<tab/>Normative references Cereals and cereal products ISO 712 ISO INPUT #{HTML_HDR}

Foreword

A A

1  Normative references

ISO 712, Cereals and cereal products

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

1-2-3 1 11 11 1a 1 1.5 1A 7 A

Normative References Cereals and cereal products ISO 712 ISO
INPUT

1-2-3 IEV, 1-2-3 ISO 712 ISO 712 1 ISO 712, Table 1 1 1 ISO 712, Table 1–1 1 1 ISO 712, Clause 1, Table 1 1 a ISO 712, Clause 1 a) 1 ISO 712, Clause 1 1.5 ISO 712, 1.5 1 A ISO 712, Whole of text 7 ISO 712, Prelude 7 A

1 <tab/> Normative References Cereals and cereal products ISO 712 ISO
OUTPUT end end