require "spec_helper"
RSpec.describe Metanorma::ISO do
it "has a version number" do
expect(Metanorma::ISO::VERSION).not_to be nil
end
it "processes default metadata" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:partnumber: 1
:edition: 2
:revdate: 2000-01-01
:draft: 0.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
:technical-committee_2: TC1
:technical-committee-number_2: 11
:technical-committee-type_2: A1
:subcommittee_2: SC1
:subcommittee-number_2: 21
:subcommittee-type_2: B1
:workgroup_2: WG1
:workgroup-number_2: 31
:workgroup-type_2: C1
:secretariat: SECRETARIAT
:docstage: 20
:docsubstage: 20
:iteration: 3
:language: en
:title-intro-en: Introduction
:title-main-en: Main Title -- Title
:title-part-en: Title Part
:title-intro-fr: Introduction Française
:title-main-fr: Titre Principal
:title-part-fr: Part du Titre
:library-ics: 1,2,3
:copyright-year: 2000
:horizontal: true
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
Introduction — Main Title — Title — Title Part
Introduction
Main Title — Title
Title Part
Introduction Française — Titre Principal — Part du Titre
Introduction Française
Titre Principal
Part du Titre
ISO/PreWD3 1000-1
ISO/PreWD3 1000-1(E)
ISO/PreWD3 1000-1:2000(E)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
2
2000-01-01
0.3.4
en
20
20
3
2000
International Organization for Standardization
ISO
article
true
TC
TC1
SC
SC1
WG
WG1
SECRETARIAT
1
2
3
ISO 1000
Third working draft
OUTPUT
end
it "processes complex metadata" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:partnumber: 1-1
:tc-docnumber: 2000, 2003
:language: el
:script: Grek
:publisher: IEC;IETF;ISO
:copyright-holder: ISO;IETF
:copyright-year: 2001
:doctype: technical-report
:pub-address: 1 Infinity Loop + \
California
:pub-phone: 3333333
:pub-fax: 4444444
:pub-email: x@example.com
:pub-uri: http://www.example.com
:docstage:
:docsubstage:
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
ISO/IEC/IETF/TR 1000-1-1:2001
ISO/IEC/IETF/TR 1000-1-1:2001(X)
ISO/IEC/IETF/TR 1000-1-1:2001(X)
2000
2003
1000
International Electrotechnical Commission
IEC
IETF
International Organization for Standardization
ISO
International Electrotechnical Commission
IEC
1 Infinity Loop + California
3333333
4444444
x@example.com
http://www.example.com
IETF
1 Infinity Loop + California
3333333
4444444
x@example.com
http://www.example.com
International Organization for Standardization
ISO
1 Infinity Loop + California
3333333
4444444
x@example.com
http://www.example.com
el
60
60
2001
International Organization for Standardization
ISO
1 Infinity Loop + California
3333333
4444444
x@example.com
http://www.example.com
2001
IETF
1 Infinity Loop + California
3333333
4444444
x@example.com
http://www.example.com
technical-report
ISO/IEC/IETF 1000
International standard
OUTPUT
end
it "processes Russian titles" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:partnumber: 1
:edition: 2
:revdate: 2000-01-01
:draft: 0.3.4
:language: ru
:title-intro-en: Introduction
:title-main-en: Main Title -- Title
:title-part-en: Title Part
:title-intro-fr: Introduction Française
:title-main-fr: Titre Principal
:title-part-fr: Part du Titre
:title-intro-ru: Introdukcija Russkaja
:title-main-ru: Titel Principalnyj
:title-part-ru: Partija Titel
:copyright-year: 2000
:horizontal: true
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
Introduction — Main
Title — Title — Title Part
Introduction
Main Title — Title
Title Part
Introdukcija Russkaja — Titel
Principalnyj — Partija Titel
Introdukcija Russkaja
Titel Principalnyj
Partija Titel
Introduction Française — Titre
Principal — Part du Titre
Introduction Française
Titre Principal
Part du Titre
ISO 1000-1:2000
ISO 1000-1:2000(R)
ISO 1000-1:2000(R)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
2
2000-01-01
0.3.4
ru
60
60
2000
International Organization for Standardization
ISO
article
true
ISO 1000
International standard
OUTPUT
end
it "processes subdivisions" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:revdate: 2000-01
:published-date: 1000-01
:docnumber: 1000
:partnumber: 1-1
:tc-docnumber: 2000
:language: el
:script: Grek
:subdivision: Subdivision
:subdivision-abbr: SD
:doctype: This is a DocType
:pub-address: 1 Infinity Loop + \\
California
:pub-phone: 3333333
:pub-fax: 4444444
:pub-email: x@example.com
:pub-uri: http://www.example.com
INPUT
expect(xmlpp(strip_guid(output
.sub(%r{.*}m, ""))))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
SD 1000-1-1
SD 1000-1-1(X)
SD 1000-1-1(X)
2000
1000
1000-01
International Organization for Standardization
Subdivision
SD
International Organization for Standardization
Subdivision
SD
1 Infinity Loop
California
3333333
4444444
x@example.com
http://www.example.com
2000-01
el
60
60
#{Time.now.year}
International Organization for Standardization
Subdivision
SD
1 Infinity Loop
California
3333333
4444444
x@example.com
http://www.example.com
this-is-a-doctype
SD 1000
International standard
OUTPUT
end
it "defaults substage, defines iteration on stage 50" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:docstage: 50
:language: fr
:doctype: international-standard
:iteration: 2
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
ISO/FDIS 1000.2
ISO/FDIS 1000.2(F)
ISO/FDIS 1000.2(F)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
fr
50
00
2
#{Date.today.year}
International Organization for Standardization
ISO
international-standard
ISO 1000
Final draft
OUTPUT
end
it "defaults substage for stage 60" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:docstage: 60
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
ISO 1000
ISO 1000(E)
ISO 1000(E)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
en
60
60
#{Date.today.year}
International Organization for Standardization
ISO
article
ISO 1000
International standard
OUTPUT
end
it "populates metadata for PRF" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:docstage: 60
:docsubstage: 00
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
ISO 1000
ISO 1000(E)
ISO 1000(E)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
en
60
00
#{Date.today.year}
International Organization for Standardization
ISO
article
ISO 1000
Proof
OUTPUT
end
it "defaults metadata for DIR" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:no-isobib:
:docnumber: 1000
:doctype: directive
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
ISO DIR 1000
ISO DIR 1000(E)
ISO DIR 1000(E)
1000
International Organization for Standardization
ISO
International Organization for Standardization
ISO
en
60
60
#{Time.new.year}
International Organization for Standardization
ISO
directive
ISO 1000
International standard
OUTPUT
end
it "processes document relations" do
VCR.use_cassette "docrels" do
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:nodoc:
:novalid:
:amends: ISO 123:2001;ISO 125
:obsoletes: ABC 1
:successor-of: ABC 2
:manifestation-of: ABC 3
:annotation-of: ABC 3a
:related: ABC 4
:replaces: ABC 5
:supersedes: ABC 6
:corrects: ABC 7
:informatively-cited-in: ABC 8
:informatively-cites: ABC 9
:normatively-cited-in: ABC 10
:normatively-cites: ABC 11
:identical-adopted-from: ABC 12
:modified-adopted-from: ABC 13
:related-directive: ABC 14
:related-mandate: ABC 15
INPUT
expect(xmlpp(output.sub(%r{.*}m, "")))
.to be_equivalent_to xmlpp(<<~"OUTPUT")
International Organization for Standardization
ISO
International Organization for Standardization
ISO
en
60
60
#{Time.new.year}
International Organization for Standardization
ISO
--
ABC 1
--
ABC 2
--
ABC 3
--
ABC 4
--
ABC 3a
amends
Rubber latex
Sampling
Rubber latex — Sampling
Latex de caoutchouc
Échantillonnage
Latex de caoutchouc — Échantillonnage
https://www.iso.org/standard/23281.html
https://www.iso.org/obp/ui/#!iso:std:23281:en
https://www.iso.org/contents/data/standard/02/32/23281.detail.rss
ISO 123:2001
urn:iso:std:iso:123:stage-90.93:ed-3:en,fr
123
2001-05
International Organization for Standardization
ISO
www.iso.org
3
Withdrawn.
en
fr
This International Standard specifies procedures for sampling natural
rubber latex concentrate and for sampling synthetic rubber latices and
artificial latices. It is also suitable for sampling rubber latex
contained in drums, tank cars or tanks. The procedures may also be
used for sampling plastics dispersions.
La présente Norme internationale spécifie des méthodes
d’échantillonnage pour des concentrés de latex de
caoutchouc naturel et pour échantillonner des latex de caoutchouc
synthétique et des latex artificiels. Elle s’applique
également à l’échantillonnage de latex de
caoutchouc contenus dans des fûts, citernes routières ou de
stockage. Le mode opératoire peut aussi être utilisé
pour l’échantillonnage de dispersions de plastiques.
90
93
2001
ISO
ISO 123:1985
Geneva
amends
Natural rubber latex concentrate
Determination of alkalinity
Natural rubber latex concentrate — Determination of
alkalinity
Latex concentré de caoutchouc naturel
Détermination de l’alcalinité
Latex concentré de caoutchouc
naturel — Détermination de
l’alcalinité
https://www.iso.org/standard/72849.html
https://www.iso.org/obp/ui/#!iso:std:72849:en
https://www.iso.org/contents/data/standard/07/28/72849.detail.rss
ISO 125
urn:iso:std:iso:125:stage-60.60:ed-7:en,fr
125
International Organization for Standardization
ISO
www.iso.org
7
en
fr
60
60
2020
ISO
ISO 125:2011
Natural rubber latex concentrate
Determination of alkalinity
Natural rubber latex concentrate — Determination
of alkalinity
Latex concentré de caoutchouc naturel
Détermination de l’alcalinité
Latex concentré de caoutchouc
naturel — Détermination de
l’alcalinité
https://www.iso.org/standard/72849.html
https://www.iso.org/obp/ui/#!iso:std:72849:en
https://www.iso.org/contents/data/standard/07/28/72849.detail.rss
ISO 125:2020
urn:iso:std:iso:125:stage-60.60:ed-7:en,fr
125
2020-02
International Organization for Standardization
ISO
www.iso.org
7
en
fr
This document specifies a method for the determination of the
alkalinity of natural rubber latex concentrate. The method is not
necessarily suitable for latices from natural sources other than
Hevea brasiliensis or for synthetic rubber latices, compounded
latex, vulcanized latex or artificial dispersions of rubber. NOTE
A method for the determination of the alkalinity of
polychloroprene latex is specified in ISO 13773.
Le présent document spécifie une méthode de
détermination de l’alcalinité du latex
concentré de caoutchouc naturel. La méthode ne convient
pas nécessairement aux latex d’origine naturelle autres
que l’Hevea brasiliensis ou aux latex de caoutchouc de
synthèse, aux latex formulés, aux latex vulcanisés
ou aux dispersions artificielles de caoutchouc. NOTE Une
méthode de détermination de l’alcalinité du
latex de polychloroprène est spécifiée dans
l’ISO 13773.
60
60
2020
ISO
ISO 125:2011
Geneva
Geneva
replaces
--
ABC 5
supersedes
--
ABC 6
corrects
--
ABC 7
informatively cited in
--
ABC 8
informatively cites
--
ABC 9
normatively cites
--
ABC 11
identical adopted from
--
ABC 12
modified adopted from
--
ABC 13
related directive
--
ABC 14
related mandate
--
ABC 15
article
International standard
OUTPUT
end
end
it "reads scripts into blank HTML document" do
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
= Document title
Author
:docfile: test.adoc
:novalid:
:no-isobib:
:no-pdf:
INPUT
html = File.read("test.html", encoding: "utf-8")
expect(html).to match(%r{