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

A B C D E F G I


INPUT #{HTML_HDR}

Foreword

A B C D E F G I




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

A B C D E F G I


INPUT #{WORD_HDR}

A B C D E F G I




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

INPUT #{HTML_HDR}

Foreword

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

Clause 1 Normative References

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Cereals or cereal products Cereals and cereal products ISO 712 International Organization for Standardization
INPUT #{HTML_HDR}

Foreword

1.  Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

ISO 712, Cereals and cereal products

2.  Clause 1

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

< Requirement /req/core/http Requirement /req/core/http 3.1

INPUT #{HTML_HDR}

Foreword

< B Requirement /req/core/http Requirement /req/core/http ISO 712, Section 3.1

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

alttext

INPUT #{HTML_HDR}

Foreword

alttext

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

example example mailto:fred@example.com

INPUT #{HTML_HDR}

Foreword

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

OUTPUT end it "processes unrecognised markup" do expect(xmlpp(IsoDoc::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::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::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::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

A A

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::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")

1 11 11 1 1.5 1A 7 A

Normative References Cereals and cereal products ISO 712 ISO
INPUT #{HTML_HDR}

Foreword

ISO 712 ISO 712 ISO 712, Table 1 ISO 712, Table 1–1 ISO 712, Clause 1, Table 1 ISO 712, Clause 1 ISO 712, Clause 1.5 A ISO 712, ISO 712, Prelude 7 A

1.  Normative references

ISO 712, Cereals and cereal products

OUTPUT end end