require "spec_helper" RSpec.describe Asciidoctor::ISO do it "processes the Asciidoctor::ISO inline macros" do expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} alt:[term1] deprecated:[term1] domain:[term1] INPUT #{BLANK_HDR} term1 term1 term1 OUTPUT end describe 'term inline macros' do subject(:convert) do xmlpp( strip_guid( Asciidoctor.convert( input, backend: :iso, header_footer: true))) end let(:input) do <<~XML #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === name2 == Main term:[name,name2] is a term XML end let(:output) do <<~XML #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

name2
Main

name ( ) is a term

XML end it 'converts macro into the correct xml' do expect(convert).to(be_equivalent_to(xmlpp(output))) end context 'default params' do let(:input) do <<~XML #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === name == Main term:[name] is a term XML end let(:output) do <<~XML #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

name
Main

name ( ) is a term

XML end it 'uses `name` as termref name' do expect(convert).to(be_equivalent_to(xmlpp(output))) end end context 'multiply exising ids in document' do let(:input) do <<~XML #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === name === name2 [[term-name]] == Main paragraph [[term-name2]] == Second term:[name] is a term term:[name2] is a term XML end let(:output) do <<~XML #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

name name2
Main

paragraph

Second

name ( ) is a term name2 ( ) is a term

XML end it 'generates unique ids which dont match existing ids' do expect(convert).to(be_equivalent_to(xmlpp(output))) end end context 'when missing actual ref' do let(:input) do <<~XML #{ASCIIDOC_BLANK_HDR} == Terms and Definitions === name identity [[name-check]] === name check paragraph term:[name check] is a term term:[name identity] is a term Moreover, term:[missing] is a term XML end let(:output) do <<~XML #{BLANK_HDR} Terms and definitions

For the purposes of this document, the following terms and definitions apply.

ISO and IEC maintain terminological databases for use in standardization at the following addresses:

name identity name check

paragraph

name check ( ) is a term

name identity ( ) is a term

Moreover, (term “missing” not resolved) is a term

XML end it 'generates unique ids which dont match existing ids' do expect(convert).to(be_equivalent_to(xmlpp(output))) end end end end