require "spec_helper"
RSpec.describe Asciidoctor::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 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
2021
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;ISO 124
: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
2021
International Organization for Standardization
ISO
--
ABC 1
--
ABC 2
--
ABC 3
--
ABC 3a
--
ABC 4
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
urn:iso:std:iso:123:stage-90.93:ed-3:en,fr
123
International Organization for Standardization
ISO
www.iso.org
3
en
fr
90
93
2001
ISO
ISO 123:1985
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
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
Geneva
amends
Latex, rubber
Determination of total solids content
Latex, rubber — Determination of total solids content
Latex de caoutchouc
Détermination des matières solides totales
Latex de caoutchouc — Détermination des
matières solides totales
https://www.iso.org/standard/61884.html
https://www.iso.org/obp/ui/#!iso:std:61884:en
https://www.iso.org/contents/data/standard/06/18/61884.detail.rss
ISO 124
urn:iso:std:iso:124:stage-90.93:ed-7:en,fr
124
International Organization for Standardization
ISO
www.iso.org
7
en
fr
90
93
2014
ISO
ISO 124:2011
Latex, rubber
Determination of total solids content
Latex, rubber — Determination of total solids content
Latex de caoutchouc
Détermination des matières solides totales
Latex de caoutchouc — Détermination des
matières solides totales
https://www.iso.org/standard/61884.html
https://www.iso.org/obp/ui/#!iso:std:61884:en
https://www.iso.org/contents/data/standard/06/18/61884.detail.rss
ISO 124:2014
urn:iso:std:iso:124:stage-90.93:ed-7:en,fr
124
2014-03
International Organization for Standardization
ISO
www.iso.org
7
en
fr
ISO 124:2014 specifies methods for the determination of the total
solids content of natural rubber field and concentrated latices
and synthetic rubber latex. These methods are not necessarily
suitable for latex from natural sources other than the Hevea
brasiliensis, for vulcanized latex, for compounded latex, or for
artificial dispersions of rubber.
L’ISO 124:2014 spécifie des méthodes pour la
détermination des matières solides totales dans le latex
de plantation, le latex de concentré de caoutchouc naturel et
le latex de caoutchouc synthétique. Ces méthodes ne
conviennent pas nécessairement au latex d’origine
naturelle autre que celui de l’Hevea brasiliensis, au latex
vulcanisé, aux mélanges de latex, ou aux dispersions
artificielles de caoutchouc.
90
93
2014
ISO
ISO 124: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{