require "spec_helper" require "metanorma" require "fileutils" # RSpec.describe Asciidoctor::Gb do RSpec.describe Metanorma::Iso::Processor do registry = Metanorma::Registry.instance registry.register(Metanorma::Iso::Processor) processor = registry.find_processor(:iso) it "registers against metanorma" do expect(processor).not_to be nil end it "registers output formats against metanorma" do expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT" [[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:isosts, "iso.sts.xml"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]] OUTPUT end it "registers version against metanorma" do expect(processor.version.to_s).to match(%r{^Metanorma::ISO }) end it "generates IsoDoc XML from a blank document" do expect(xmlpp(processor.input_to_isodoc(<<~"INPUT", nil))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} INPUT #{BLANK_HDR} OUTPUT end it "generates HTML from IsoDoc XML" do FileUtils.rm_f "test.xml" processor.output(<<~"INPUT", "test.xml", "test.html", :html) 1  Terms, Definitions, Symbols and Abbreviated Terms 1.1 Term2 INPUT expect(xmlpp(File.read("test.html", encoding: "utf-8") .gsub(%r{^.*.*}m, ""))) .to be_equivalent_to xmlpp(<<~"OUTPUT")

1  Terms, Definitions, Symbols and Abbreviated Terms

1.1

Term2

OUTPUT end end