require "spec_helper" require "relaton_iso" require "relaton_ietf" RSpec.describe Asciidoctor::ISO do it "processes draft ISO reference" do mock_fdis #mock_isobib_get_123 expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ISOBIB_BLANK_HDR} == Clause <> <> A.footnote:[a footnote] <> <> [bibliography] == Normative References * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_ * [[[fdis,ISO/FDIS 17664-1]]] Title INPUT #{BLANK_HDR} Clause

The standard is in press A.

a footnote

Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).

Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Standard ISO 123:— 123 International Organization for Standardization ISO The standard is in press #{Date.today} Traitement de produits de soins de santé Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif Partie 1: Titre manque Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque https://www.iso.org/standard/81720.html https://www.iso.org/contents/data/standard/08/17/81720.detail.rss ISO/FDIS 17664-1 urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr 17664 International Organization for Standardization ISO www.iso.org 1

Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).

en fr 50 00 unknown ISO/FDIS ISO 17664:2017 2020-11-03 Traitement de produits de soins de santé Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif Partie 1: Titre manque Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque https://www.iso.org/standard/81720.html https://www.iso.org/contents/data/standard/08/17/81720.detail.rss ISO/FDIS 17664-1 urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr 17664 International Organization for Standardization ISO www.iso.org 1

Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).

en fr 50 00 unknown ISO/FDIS ISO 17664:2017 Geneva
Geneva
OUTPUT end it "processes all-parts ISO reference" do #stub_fetch_ref(all_parts: true) expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} == Clause <> [bibliography] == Normative References * [[[iso123,ISO 123:1066 (all parts)]]] _Standard_ INPUT #{BLANK_HDR} Clause

Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Standard ISO 123:1066 (all parts) 123 1066 International Organization for Standardization ISO all
OUTPUT end it "processes non-ISO reference in Normative References" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References * [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_ INPUT #{BLANK_HDR} Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Standard XYZ 123:1066 (all parts) 123:1066 (all parts)
OUTPUT end it "processes non-ISO reference in Bibliography" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Bibliography * [[[iso123,1]]] _Standard_ INPUT #{BLANK_HDR} Bibliography Standard [1] OUTPUT end private def mock_isobib_get_123 expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT") \n #{Date.today}\nRubber latex -- Sampling\n Latex de caoutchouc -- ?chantillonnage\n https://www.iso.org/standard/23281.html\n https://www.iso.org/obp/ui/#!iso:std:23281:en\n https://www.iso.org/contents/data/standard/02/32/23281.detail.rss\n ISO 123:2001\n \n 2001\n \n \n \n \n International Organization for Standardization\n ISO\n www.iso.org\n \n \n 3\n en\n fr\n \n Published\n \n 2001\n \n \n ISO\n \n \n \n \n \n \n ISO 123:1985\n \n \n \n \n ISO 123:2001\n \n \n OUTPUT end end def mock_rfcbib_get_rfc8341 expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do IETFBib::XMLParser.from_xml(<<~"OUTPUT") #{Date.today} Network Configuration Access Control Model RFC 8341 2018 published OUTPUT end end def mock_fdis expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO/FDIS 17664-1", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT") #{Date.today} Traitement de produits de soins de santé Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif Partie 1: Titre manque Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque https://www.iso.org/standard/81720.html https://www.iso.org/contents/data/standard/08/17/81720.detail.rss ISO/FDIS 17664-1 urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr 17664 International Organization for Standardization ISO www.iso.org 1 en fr 50 00 unknown ISO/FDIS ISO 17664:2017 2020-11-03 Traitement de produits de soins de santé Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif Partie 1: Titre manque Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque https://www.iso.org/standard/81720.html https://www.iso.org/contents/data/standard/08/17/81720.detail.rss ISO/FDIS 17664-1 urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr 17664 International Organization for Standardization ISO www.iso.org 1 en fr 50 00 unknown ISO/FDIS ISO 17664:2017 Geneva Geneva OUTPUT end end end