require "spec_helper" require "fileutils" RSpec.describe IsoDoc::Iso do it "processes isodoc as ISO: HTML output" do IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", false)

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

INPUT html = File.read("test.html", encoding: "utf-8") expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m) expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m) end it "processes isodoc as ISO: alt HTML output" do IsoDoc::Iso::HtmlConvert.new(alt: true).convert("test", <<~"INPUT", false)

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

INPUT html = File.read("test.html", encoding: "utf-8") expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m) expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m) end it "processes isodoc as ISO: Chinese HTML output" do IsoDoc::Iso::HtmlConvert.new(script: "Hans").convert("test", <<~"INPUT", false)

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

INPUT html = File.read("test.html", encoding: "utf-8") expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m) expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m) end it "processes isodoc as ISO: user nominated fonts" do IsoDoc::Iso::HtmlConvert.new(bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono") .convert("test", <<~"INPUT", false)

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

INPUT html = File.read("test.html", encoding: "utf-8") expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m) expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m) end it "processes isodoc as ISO: Word output" do IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", false)

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

INPUT html = File.read("test.doc", encoding: "utf-8") expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m) expect(html).to match(%r[Quote[^{]+\{[^{]+font-family: "Cambria", serif;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m) end it "does not include IEV in references" do output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)

IEV ISO 20483

1<tab/> Normative References Electropedia: The World's Online Electrotechnical Vocabulary http://www.electropedia.org IEV International Electrotechnical Commission IEC www.iec.ch en fr International Electrotechnical Commission IEC www.iec.ch IEC 60050 Cereals and pulses ISO 20483 2013 2014 International Organization for Standardization
INPUT expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT") #{HTML_HDR}

Foreword

IEV ISO 20483

1  Normative References

ISO 20483, Cereals and pulses

OUTPUT end it "processes examples (Presentation XML)" do output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true) Title

Hello

INPUT expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT") EXAMPLE — Title

Hello

OUTPUT end it "processes examples (HTML)" do output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true) EXAMPLE — Title

Hello

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

Foreword

EXAMPLE — Title  Hello

OUTPUT end it "processes sequences of examples (Presentation XML)" do output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true) Hello Title

Hello

INPUT expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT") EXAMPLE 1 Hello EXAMPLE 2 — Title

Hello

OUTPUT end it "processes sequences of examples (HTML)" do output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true) EXAMPLE 1 Hello EXAMPLE 2 — Title

Hello

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

Foreword

EXAMPLE 1 

Hello

EXAMPLE 2 — Title  Hello

OUTPUT end it "processes examples (Word)" do output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true) EXAMPLE — Title

Hello

INPUT expect(xmlpp(output.sub(/^.*.*$}m, ""))) .to be_equivalent_to xmlpp(<<~"OUTPUT")

 



Foreword

EXAMPLE — Title  Hello

 



OUTPUT end it "processes sequences of examples (Word)" do output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true) EXAMPLE 1 Hello EXAMPLE 2 — Title

Hello

INPUT expect(xmlpp(output.sub(/^.*.*$}m, ""))) .to be_equivalent_to xmlpp(<<~"OUTPUT")

 



Foreword

EXAMPLE 1 

Hello

EXAMPLE 2 — Title  Hello

 



OUTPUT end end