require "spec_helper"
RSpec.describe Asciidoctor::ISO do
it "processes simple ISO reference" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,ISO 123]]] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
ISO 123
International Organization for Standardization
ISO
OUTPUT
end
it "processes simple IEC reference" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,IEC 123]]] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
IEC 123
IEC
OUTPUT
end
it "processes dated ISO reference and joint ISO/IEC references" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,ISO/IEC 123:1066]]] _Standard_
* [[[iso124,ISO 124:1066-1067]]] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
ISO/IEC 123
1066
International Organization for Standardization
ISO
IEC
Standard
ISO 124
1066
1067
International Organization for Standardization
ISO
OUTPUT
end
it "processes draft ISO reference" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
ISO 123
--
International Organization for Standardization
ISO
ISO DATE: The standard is in press
OUTPUT
end
it "processes all-parts ISO reference" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
ISO 123:All Parts
1066
International Organization for Standardization
ISO
OUTPUT
end
it "processes non-ISO reference in Normative References" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Normative References
* [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
INPUT
#{BLANK_HDR}
Normative References
Standard
XYZ 123:1066 (all parts)
OUTPUT
end
it "processes non-ISO reference in Bibliography" do
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
#{ASCIIDOC_BLANK_HDR}
[bibliography]
== Bibliography
* [[[iso123,1]]] _Standard_
INPUT
#{BLANK_HDR}
Bibliography
Standard
[1]
OUTPUT
end
end