require "spec_helper" require "relaton_iso" require "relaton_ietf" RSpec.describe Metanorma::ISO do it "processes draft ISO reference" do mock_fdis input = <<~INPUT #{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 output = <<~OUTPUT #{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: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: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 expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes all-parts ISO reference" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} == Clause <> [bibliography] == Normative References * [[[iso123,ISO 123:1066 (all parts)]]] _Standard_ INPUT output = <<~OUTPUT #{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 expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes non-ISO reference in Normative References" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References * [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_ INPUT output = <<~OUTPUT #{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 expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "processes non-ISO reference in Bibliography" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} [bibliography] == Bibliography * [[[iso123,1]]] _Standard_ INPUT output = <<~OUTPUT #{BLANK_HDR} Bibliography Standard [1] OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "sort ISO references in Bibliography" do input = <<~INPUT #{ASCIIDOC_BLANK_HDR} [bibliography] == Bibliography * [[[iso1,ISO 8000-110]]] * [[[iso2,ISO 8000-61]]] * [[[iso3,ISO 8000-8]]] * [[[iso4,ISO 9]]] INPUT output = <<~OUTPUT #{BLANK_HDR} Bibliography ISO 9 9 International Organization for Standardization ISO ISO 8000-8 8000-8 International Organization for Standardization ISO ISO 8000-61 8000-61 International Organization for Standardization ISO ISO 8000-110 8000-110 International Organization for Standardization ISO OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "renders withdrawn and cancelled ISO references" do VCR.use_cassette "withdrawn_iso", match_requests_on: %i[method uri body] do input = <<~INPUT #{ISOBIB_BLANK_HDR} <> <> [bibliography] == Bibliography * [[[iso1,ISO 683-3:2019]]] * [[[iso2,ISO 31-0]]] INPUT output = <<~OUTPUT #{BLANK_HDR} Foreword

1

Cancelled and replaced by ISO 683-3:2022.

1

Withdrawn.

Bibliography Title missing Legacy paper document Title missing — Legacy paper document https://www.iso.org/standard/2405.html https://www.iso.org/contents/data/standard/00/24/2405.detail.rss ISO 31-0 urn:iso:std:iso:31:-0:ed-1 31 International Organization for Standardization ISO www.iso.org 1

Withdrawn.

en 95 99 1974 ISO Title missing Legacy paper document Title missing — Legacy paper document https://www.iso.org/standard/2405.html https://www.iso.org/contents/data/standard/00/24/2405.detail.rss ISO 31-0:1974 urn:iso:std:iso:31:-0:ed-1 31 1974-01 International Organization for Standardization ISO www.iso.org 1

Withdrawn.

en 95 99 1974 ISO Geneva
Geneva
Heat-treatable steels, alloy steels and free-cutting steels Part 3: Case-hardening steels Heat-treatable steels, alloy steels and free-cutting steels — Part 3: Case-hardening steels https://www.iso.org/standard/76389.html https://www.iso.org/contents/data/standard/07/63/76389.detail.rss ISO 683-3:2019 urn:iso:std:iso:683:-3:ed-3 683 2019-01 International Organization for Standardization ISO www.iso.org 3

Cancelled and replaced by ISO 683-3:2022.

en This document specifies the technical delivery requirements for — semi-finished products, hot formed, e.g. blooms, billets, slabs (see NOTE 1), — bars (see NOTE 1), — wire rod, — finished flat products, and — hammer or drop forgings (see NOTE 1) manufactured from the case-hardening non-alloy or alloy steels listed in Table 3 and supplied in one of the heat-treatment conditions given for the different types of products in Table 1 and in one of the surface conditions given in Table 2. The steels are, in general, intended for the manufacture of case-hardened machine parts. NOTE 1 Hammer-forged semi-finished products (blooms, billets, slabs, etc.), seamless rolled rings and hammer-forged bars are covered under semi-finished products or bars and not under the term “hammer and drop forgings”. NOTE 2 For International Standards relating to steels complying with the requirements for the chemical composition in Table 3, however, supplied in other product forms or treatment conditions than given above or intended for special applications, and for other related International Standards, see the Bibliography. In special cases, variations in these technical delivery requirements or additions to them can form the subject of an agreement at the time of enquiry and order (see 5.2 and Annex A). In addition to this document, the general technical delivery requirements of ISO 404 are applicable. 95 99 2019 ISO ISO 683-3:2016 ISO 683-3:2016 ISO 683-3:2022 ISO 683-3:2022 2022-01-21 Geneva
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end end private def mock_fdis expect(RelatonIso::IsoBibliography).to receive(:get) .with("ISO/FDIS 17664-1", nil, anything) 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: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: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