require "spec_helper"
RSpec.describe Asciidoctor::ISO do
it "has a version number" do
expect(Asciidoctor::ISO::VERSION).not_to be nil
end
it "generates output for the Rice document" do
system "cd spec/examples; rm -f rice.doc; rm -f rice.html; asciidoctor --trace -b iso -r 'asciidoctor-iso' rice.adoc; cd ../.."
expect(File.exist?("spec/examples/rice.doc")).to be true
expect(File.exist?("spec/examples/rice.html")).to be true
end
it "processes a blank document" do
expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
INPUT
#{BLANK_HDR}
OUTPUT
end
it "converts a blank document" do
system "rm -f test.doc"
expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~"OUTPUT"
= Document title
Author
:docfile: test.adoc
:novalid:
INPUT
#{BLANK_HDR}
OUTPUT
expect(File.exist?("test.doc")).to be true
end
it "processes default metadata" do
expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:docnumber: 1000
:partnumber: 1
:edition: 2
:revdate: 2000-01-01
:draft: 3.4
:technical-committee: TC
:technical-committee-number: 1
:technical-committee-type: A
:subcommittee: SC
:subcommittee-number: 2
:subcommittee-type: B
:workgroup: WG
:workgroup-number: 3
:workgroup-type: C
:secretariat: SECRETARIAT
:copyright-year: 2001
:docstage: 10
:docsubstage: 20
:language: en
:title-intro-en: Introduction
:title-main-en: Main Title
:title-part-en: Title Part
:title-intro-fr: Introduction Française
:title-main-fr: Titre Principal
:title-part-fr: Part du Titre
INPUT
Introduction
Main Title
Title Part
Introduction Française
Titre Principal
Part du Titre
1000
ISO
ISO
en
10
20
2001
ISO
TC
SC
WG
SECRETARIAT
2
2000-01-01
3.4
OUTPUT
end
it "processes complex metadata" do
expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:docnumber: 1000
:partnumber: 1-1
:tc-docnumber: 2000
:language: el
:script: Grek
INPUT
1000
2000
ISO
ISO
el
60
60
2018
ISO
OUTPUT
end
end