require "spec_helper" require "fileutils" RSpec.describe IsoDoc::BSI do FileUtils.rm_f "test.html" it "processes isodoc as ISO: HTML output" do IsoDoc::BSI::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: "Tahoma", sans-serif;]m) expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Tahoma", sans-serif;]m) end it "processes isodoc as ISO: Chinese HTML output" do FileUtils.rm_f "test.html" IsoDoc::BSI::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 FileUtils.rm_f "test.html" IsoDoc::BSI::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 examples" do expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") EXAMPLE

Hello

INPUT #{HTML_HDR}

FOREWORD

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

Hello

EXAMPLE 2

Hello

INPUT #{HTML_HDR}

FOREWORD

#{IEC_TITLE1}
OUTPUT end end