asciidoctor-iso 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/README.adoc +4 -0
- data/asciidoctor-iso.gemspec +2 -2
- data/lib/asciidoctor/iso/base.rb +4 -4
- data/lib/asciidoctor/iso/cleanup.rb +2 -1
- data/lib/asciidoctor/iso/ref.rb +21 -8
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/lib/metanorma/iso/processor.rb +4 -2
- data/spec/asciidoctor-iso/isobib_cache_spec.rb +209 -52
- data/spec/asciidoctor-iso/refs_spec.rb +179 -120
- data/spec/examples/rice.adoc +1 -1
- data/spec/examples/rice.preview.html +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb1e34c74de1fc1690bc277c1a0deaa90e165dec375664f043c1427b3a053c98
|
4
|
+
data.tar.gz: 164743809557dba029c72bc607fdbade46a0ca3e2c848db55ec037362251fa3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e418454bf54ba9af399448241afbe8cb0aad8c558f668a8535cdaeeffc86a37b9dc4ac50eec8160a174cbc7cb479cef7c19576a2878cd56250db39c255f573
|
7
|
+
data.tar.gz: b170a8f58c5507c2e71573371940f2f19c7c4379713984482db90afaffce6e76f4b476f193e998c135a00da23d153145e3d0ed286786fbdd489f0123e4c0eeaa
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
asciidoctor-iso (0.9.
|
4
|
+
asciidoctor-iso (0.9.2)
|
5
5
|
asciidoctor (~> 1.5.7)
|
6
6
|
iso-bib-item (~> 0.1.6)
|
7
|
-
isobib (~> 0.1.
|
7
|
+
isobib (~> 0.1.8)
|
8
8
|
isodoc (>= 0.8)
|
9
9
|
ruby-jing
|
10
10
|
|
@@ -106,11 +106,11 @@ GEM
|
|
106
106
|
htmlentities (4.3.4)
|
107
107
|
httpclient (2.8.3)
|
108
108
|
image_size (2.0.0)
|
109
|
-
iso-bib-item (0.1.
|
109
|
+
iso-bib-item (0.1.9)
|
110
110
|
duplicate
|
111
111
|
isoics (~> 0.1.6)
|
112
112
|
nokogiri
|
113
|
-
isobib (0.1.
|
113
|
+
isobib (0.1.8)
|
114
114
|
algoliasearch
|
115
115
|
iso-bib-item (~> 0.1.2)
|
116
116
|
isodoc (0.8)
|
@@ -135,11 +135,11 @@ GEM
|
|
135
135
|
rb-inotify (~> 0.9, >= 0.9.7)
|
136
136
|
ruby_dep (~> 1.2)
|
137
137
|
lumberjack (1.0.13)
|
138
|
-
metanorma (0.2.
|
138
|
+
metanorma (0.2.4)
|
139
139
|
asciidoctor-csand (>= 0.3.0)
|
140
140
|
asciidoctor-csd (>= 0.4.0)
|
141
141
|
asciidoctor-gb (>= 0.3.0)
|
142
|
-
asciidoctor-iso (>= 0.9.
|
142
|
+
asciidoctor-iso (>= 0.9.1)
|
143
143
|
asciidoctor-m3d (>= 0.3.1)
|
144
144
|
asciidoctor-rfc (>= 0.9.0)
|
145
145
|
asciidoctor-rsd (>= 0.3.0)
|
@@ -228,7 +228,7 @@ DEPENDENCIES
|
|
228
228
|
equivalent-xml (~> 0.6)
|
229
229
|
guard (~> 2.14)
|
230
230
|
guard-rspec (~> 4.7)
|
231
|
-
metanorma
|
231
|
+
metanorma (~> 0.2.4)
|
232
232
|
rake (~> 12.0)
|
233
233
|
rspec (~> 3.6)
|
234
234
|
rubocop (~> 0.50)
|
data/README.adoc
CHANGED
@@ -564,6 +564,10 @@ items are not looked up via `isobib`, and the `isobib` caches are not used.
|
|
564
564
|
If the document attribute `:no-isobib-cache:` is set, the reference details for
|
565
565
|
items are still looked up via `isobib`, but the `isobib` caches are not used.
|
566
566
|
|
567
|
+
Any entry in the cache that corresponds to an undated ISO reference fetches its details
|
568
|
+
from the latest available entry on the ISO web site. If the entry is more than 60
|
569
|
+
days old, it is refetched.
|
570
|
+
|
567
571
|
== Document Attributes
|
568
572
|
|
569
573
|
The gem relies on Asciidoctor document attributes to provide necessary
|
data/asciidoctor-iso.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "asciidoctor", "~> 1.5.7"
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
spec.add_dependency "isodoc", ">= 0.8"
|
33
|
-
spec.add_dependency "isobib", "~> 0.1.
|
33
|
+
spec.add_dependency "isobib", "~> 0.1.8"
|
34
34
|
spec.add_dependency "iso-bib-item", "~> 0.1.6"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 1.15"
|
@@ -43,5 +43,5 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "rubocop", "~> 0.50"
|
44
44
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
45
45
|
spec.add_development_dependency "timecop", "~> 0.9"
|
46
|
-
spec.add_development_dependency "metanorma"
|
46
|
+
spec.add_development_dependency "metanorma", "~> 0.2.4"
|
47
47
|
end
|
data/lib/asciidoctor/iso/base.rb
CHANGED
@@ -71,8 +71,8 @@ module Asciidoctor
|
|
71
71
|
@filename = node.attr("docfile") ?
|
72
72
|
node.attr("docfile").gsub(/\.adoc$/, "").gsub(%r{^.*/}, "") : ""
|
73
73
|
@no_isobib_cache = node.attr("no-isobib-cache")
|
74
|
-
@
|
75
|
-
@
|
74
|
+
@bibdb = open_cache_biblio(node, true)
|
75
|
+
@local_bibdb = node.attr("local-cache") ?
|
76
76
|
open_cache_biblio(node, false) : nil
|
77
77
|
end
|
78
78
|
|
@@ -106,8 +106,8 @@ module Asciidoctor
|
|
106
106
|
result << noko { |ixml| front node, ixml }
|
107
107
|
result << noko { |ixml| middle node, ixml }
|
108
108
|
result << "</iso-standard>"
|
109
|
-
save_cache_biblio(@
|
110
|
-
save_cache_biblio(@
|
109
|
+
save_cache_biblio(@bibdb, true)
|
110
|
+
save_cache_biblio(@local_bibdb, false)
|
111
111
|
textcleanup(result.flatten * "\n")
|
112
112
|
end
|
113
113
|
|
@@ -161,7 +161,8 @@ module Asciidoctor
|
|
161
161
|
|
162
162
|
def termdocsource_cleanup(xmldoc)
|
163
163
|
f = xmldoc.at("//preface | //sections")
|
164
|
-
xmldoc.xpath("//terms/termdocsource
|
164
|
+
xmldoc.xpath("//terms/termdocsource | "\
|
165
|
+
"//clause/termdocsource").each do |s|
|
165
166
|
f.previous = s.remove
|
166
167
|
end
|
167
168
|
end
|
data/lib/asciidoctor/iso/ref.rb
CHANGED
@@ -87,18 +87,31 @@ module Asciidoctor
|
|
87
87
|
ret
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
# => , because the hash is imported from JSON
|
91
|
+
def new_bibcache_entry(code, year, opts)
|
92
|
+
{ "fetched" => Date.today,
|
93
|
+
"bib" => Isobib::IsoBibliography.get(code, year, opts) }
|
94
|
+
end
|
95
|
+
|
96
|
+
# if cached reference is undated, expire it after 60 days
|
97
|
+
def is_valid_bibcache_entry?(x, year)
|
98
|
+
x && x.is_a?(Hash) && x&.has_key?("bib") && x&.has_key?("fetched") &&
|
99
|
+
(year || Date.today - Date.iso8601(x["fetched"]) < 60)
|
100
|
+
end
|
101
|
+
|
102
|
+
def check_bibliocache(code, year, opts)
|
91
103
|
id = iso_id(code, year, opts[:all_parts])
|
92
|
-
return nil if @
|
93
|
-
@
|
94
|
-
@
|
95
|
-
|
96
|
-
|
97
|
-
@
|
104
|
+
return nil if @bibdb.nil? # signals we will not be using isobib
|
105
|
+
@bibdb[id] = nil unless is_valid_bibcache_entry?(@bibdb[id], year)
|
106
|
+
@bibdb[id] ||= new_bibcache_entry(code, year, opts)
|
107
|
+
@local_bibdb[id] = @bibdb[id] if !@local_bibdb.nil? &&
|
108
|
+
!is_valid_bibcache_entry?(@local_bibdb[id], year)
|
109
|
+
return @local_bibdb[id]["bib"] unless @local_bibdb.nil?
|
110
|
+
@bibdb[id]["bib"]
|
98
111
|
end
|
99
112
|
|
100
113
|
def fetch_ref(xml, code, year, **opts)
|
101
|
-
hit =
|
114
|
+
hit = check_bibliocache(code, year, opts)
|
102
115
|
return nil if hit.nil?
|
103
116
|
xml.parent.add_child(hit)
|
104
117
|
xml
|
@@ -11,11 +11,11 @@ module Metanorma
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def output_formats
|
14
|
-
|
14
|
+
super.merge(
|
15
15
|
html: "html",
|
16
16
|
html_alt: "alt.html",
|
17
17
|
doc: "doc"
|
18
|
-
|
18
|
+
)
|
19
19
|
end
|
20
20
|
|
21
21
|
def version
|
@@ -34,6 +34,8 @@ module Metanorma
|
|
34
34
|
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(outname, isodoc_node)
|
35
35
|
when :doc
|
36
36
|
IsoDoc::Iso::WordConvert.new(options).convert(outname, isodoc_node)
|
37
|
+
else
|
38
|
+
super
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -2,6 +2,41 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::ISO do
|
4
4
|
|
5
|
+
ISO_123_SHORT = <<~EOS
|
6
|
+
<bibitem type="international-standard" id="ISO123">
|
7
|
+
<title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
|
8
|
+
<docidentifier>ISO 123</docidentifier>
|
9
|
+
</bibitem>
|
10
|
+
EOS
|
11
|
+
|
12
|
+
ISO_124_SHORT = <<~EOS
|
13
|
+
<bibitem type="international-standard" id="ISO124">
|
14
|
+
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
15
|
+
<docidentifier>ISO 124</docidentifier>
|
16
|
+
</bibitem>
|
17
|
+
EOS
|
18
|
+
|
19
|
+
ISO_124_SHORT_ALT = <<~EOS
|
20
|
+
<bibitem type="international-standard" id="ISO124">
|
21
|
+
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Replacement</title>
|
22
|
+
<docidentifier>ISO 124</docidentifier>
|
23
|
+
</bibitem>
|
24
|
+
EOS
|
25
|
+
|
26
|
+
ISOBIB_123_DATED = <<~EOS
|
27
|
+
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <source type="src">https://www.iso.org/standard/23281.html</source> <source type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</source> <source type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</source> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name> <abbreviation></abbreviation> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 123:1985</formattedref> <docidentifier>ISO 123:1985</docidentifier> </bibitem> </relation> <relation type="updates"> <bibitem> <formattedref>ISO 123:2001</formattedref> <docidentifier>ISO 123:2001</docidentifier> </bibitem> </relation></bibitem>
|
28
|
+
EOS
|
29
|
+
|
30
|
+
ISOBIB_123_UNDATED = <<~EOS
|
31
|
+
<bibitem type="international-standard" id="ISO123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title> <source type="src">https://www.iso.org/standard/23281.html</source> <source type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</source> <source type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</source> <docidentifier>ISO 123</docidentifier> <date type="published"> <on>2001</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>3</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status>Published</status> <copyright> <from>2001</from> <owner> <organization> <name>ISO</name> <abbreviation></abbreviation> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 123:1985</formattedref> <docidentifier>ISO 123:1985</docidentifier> </bibitem> </relation> <relation type="updates"> <bibitem> <formattedref>ISO 123:2001</formattedref> <docidentifier>ISO 123:2001</docidentifier> </bibitem> </relation></bibitem>
|
32
|
+
EOS
|
33
|
+
|
34
|
+
|
35
|
+
ISOBIB_124_DATED = <<~EOS
|
36
|
+
<bibitem type="international-standard" id="ISO124"> <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title> <source type="src">https://www.iso.org/standard/61884.html</source> <source type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</source> <source type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</source> <docidentifier>ISO 124</docidentifier> <date type="published"> <on>2014</on> </date> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>7</edition> <language>en</language> <language>fr</language> <script>Latn</script> <abstract format="plain" language="en" script="Latn">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.</abstract> <abstract format="plain" language="fr" script="Latn">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.</abstract> <status>Published</status> <copyright> <from>2014</from> <owner> <organization> <name>ISO</name> <abbreviation></abbreviation> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem> <formattedref>ISO 124:2011</formattedref> <docidentifier>ISO 124:2011</docidentifier> </bibitem> </relation></bibitem>
|
37
|
+
EOS
|
38
|
+
|
39
|
+
|
5
40
|
it "does not activate biblio caches if isobib disabled" do
|
6
41
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
7
42
|
system "rm -f test.relaton.json"
|
@@ -10,7 +45,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
10
45
|
[bibliography]
|
11
46
|
== Normative References
|
12
47
|
|
13
|
-
* [[[iso123,ISO 123]]] _Standard_
|
48
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
14
49
|
INPUT
|
15
50
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be false
|
16
51
|
expect(File.exist?("test.relaton.json")).to be false
|
@@ -23,12 +58,13 @@ RSpec.describe Asciidoctor::ISO do
|
|
23
58
|
it "does not activate biblio caches if isobib caching disabled" do
|
24
59
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
25
60
|
system "rm -f test.relaton.json"
|
61
|
+
mock_isobib_get_123
|
26
62
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
27
63
|
#{ISOBIB_BLANK_HDR}
|
28
64
|
[bibliography]
|
29
65
|
== Normative References
|
30
66
|
|
31
|
-
* [[[iso123,ISO 123]]] _Standard_
|
67
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
32
68
|
INPUT
|
33
69
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be false
|
34
70
|
expect(File.exist?("test.relaton.json")).to be false
|
@@ -39,19 +75,24 @@ RSpec.describe Asciidoctor::ISO do
|
|
39
75
|
|
40
76
|
it "flushes biblio caches" do
|
41
77
|
system "cp ~/.relaton-bib.json ~/.relaton-bib.json1"
|
42
|
-
|
78
|
+
|
79
|
+
File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
|
80
|
+
f.write "XXX"
|
81
|
+
end
|
82
|
+
|
83
|
+
mock_isobib_get_123
|
43
84
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
44
85
|
#{FLUSH_CACHE_ISOBIB_BLANK_HDR}
|
45
86
|
[bibliography]
|
46
87
|
== Normative References
|
47
88
|
|
48
|
-
* [[[iso123,ISO 123]]] _Standard_
|
89
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
49
90
|
INPUT
|
50
91
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
92
|
+
|
93
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
94
|
+
expect(json["ISO 123:2001"]["fetched"]).to eq(Date.today.to_s)
|
95
|
+
expect(json["ISO 123:2001"]["bib"]).to be_equivalent_to(ISOBIB_123_DATED)
|
55
96
|
|
56
97
|
system "rm ~/.relaton-bib.json"
|
57
98
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
@@ -61,104 +102,220 @@ RSpec.describe Asciidoctor::ISO do
|
|
61
102
|
it "activates global cache" do
|
62
103
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
63
104
|
system "rm -f test.relaton.json"
|
105
|
+
mock_isobib_get_123
|
64
106
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
65
107
|
#{CACHED_ISOBIB_BLANK_HDR}
|
66
108
|
[bibliography]
|
67
109
|
== Normative References
|
68
110
|
|
69
|
-
* [[[iso123,ISO 123]]] _Standard_
|
111
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
70
112
|
INPUT
|
71
113
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
72
114
|
expect(File.exist?("test.relaton.json")).to be false
|
73
115
|
|
74
|
-
json = File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8")
|
75
|
-
expect(json).to
|
116
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
117
|
+
expect(json).to have_key("ISO 123:2001")
|
76
118
|
|
77
119
|
system "rm ~/.relaton-bib.json"
|
78
120
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
79
121
|
end
|
80
122
|
|
81
|
-
|
123
|
+
it "activates local cache" do
|
82
124
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
83
125
|
system "rm -f test.relaton.json"
|
126
|
+
mock_isobib_get_123
|
84
127
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
85
128
|
#{LOCAL_CACHED_ISOBIB_BLANK_HDR}
|
86
129
|
[bibliography]
|
87
130
|
== Normative References
|
88
131
|
|
89
|
-
* [[[iso123,ISO 123]]] _Standard_
|
132
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
90
133
|
INPUT
|
91
134
|
expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
|
92
135
|
expect(File.exist?("test.relaton.json")).to be true
|
93
136
|
|
94
|
-
json = File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8")
|
95
|
-
expect(json).to
|
96
|
-
|
97
|
-
|
137
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
138
|
+
expect(json).to have_key("ISO 123:2001")
|
139
|
+
|
140
|
+
json = JSON.parse(File.read("test.relaton.json", encoding: "utf-8"))
|
141
|
+
expect(json).to have_key("ISO 123:2001")
|
98
142
|
|
99
143
|
system "rm ~/.relaton-bib.json"
|
100
144
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
101
145
|
end
|
102
146
|
|
147
|
+
|
103
148
|
it "fetches uncached references" do
|
104
149
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
105
|
-
|
150
|
+
|
151
|
+
File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
|
152
|
+
f.write({
|
153
|
+
"ISO 123:2001": {
|
154
|
+
"fetched": Date.today.to_s,
|
155
|
+
"bib": ISO_123_SHORT
|
156
|
+
}
|
157
|
+
}.to_json)
|
158
|
+
end
|
159
|
+
|
160
|
+
mock_isobib_get_124
|
106
161
|
|
107
162
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
108
163
|
#{CACHED_ISOBIB_BLANK_HDR}
|
109
164
|
[bibliography]
|
110
165
|
== Normative References
|
111
166
|
|
112
|
-
* [[[iso123,ISO 123]]] _Standard_
|
113
|
-
* [[[iso124,ISO 124]]] _Standard_
|
167
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
168
|
+
* [[[iso124,ISO 124:2014]]] _Standard_
|
114
169
|
INPUT
|
115
170
|
|
116
|
-
json = File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8")
|
117
|
-
expect(json).to
|
118
|
-
|
119
|
-
|
171
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
172
|
+
expect(json["ISO 123:2001"]["fetched"]).to eq(Date.today.to_s)
|
173
|
+
expect(json["ISO 124:2014"]["fetched"]).to eq(Date.today.to_s)
|
174
|
+
expect(json["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
175
|
+
expect(json["ISO 124:2014"]["bib"]).to be_equivalent_to(ISOBIB_124_DATED)
|
120
176
|
|
121
177
|
system "rm ~/.relaton-bib.json"
|
122
178
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
123
179
|
end
|
124
180
|
|
125
|
-
|
126
|
-
it "prioritises local over global cache values" do
|
181
|
+
it "expires stale undated references" do
|
127
182
|
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
128
|
-
system "rm test.relaton.json"
|
129
|
-
system %q(echo '{"ISO 123":"<bibitem type=\\"international-standard\\" id=\\"ISO123\\"> <title format=\\"text/plain\\" language=\\"en\\" script=\\"Latn\\">Rubber latex -- Sampling</title><docidentifier>ISO 123</docidentifier></bibitem>", "ISO 124":"<bibitem type=\\"international-standard\\" id=\\"ISO124\\"> <title format=\\"text/plain\\" language=\\"en\\" script=\\"Latn\\">Latex, rubber -- Determination of total solids content</docidentifier></bibitem>"}' > ~/.relaton-bib.json)
|
130
|
-
system %q(echo '{"ISO 124":"<bibitem type=\\"international-standard\\" id=\\"ISO124\\"> <title format=\\"text/plain\\" language=\\"fr\\" script=\\"Latn\\">Latex de caoutchouc -- Détermination des matières solides totales</title><docidentifier>ISO 124</docidentifier></bibitem>"}' > test.relaton.json)
|
131
183
|
|
132
|
-
|
133
|
-
|
184
|
+
File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
|
185
|
+
f.write({
|
186
|
+
"ISO 123": {
|
187
|
+
"fetched": (Date.today - 90).to_s,
|
188
|
+
"bib": ISO_123_SHORT
|
189
|
+
}
|
190
|
+
}.to_json)
|
191
|
+
end
|
192
|
+
|
193
|
+
mock_isobib_get_123_undated
|
194
|
+
|
195
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
196
|
+
#{CACHED_ISOBIB_BLANK_HDR}
|
134
197
|
[bibliography]
|
135
198
|
== Normative References
|
136
199
|
|
137
200
|
* [[[iso123,ISO 123]]] _Standard_
|
138
|
-
* [[[iso124,ISO 124]]] _Standard_
|
139
201
|
INPUT
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
<title>Normative References</title>
|
145
|
-
<bibitem type="international-standard" id="iso123"> <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title><docidentifier>ISO 123</docidentifier></bibitem>
|
146
|
-
<bibitem type="international-standard" id="iso124"> <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title><docidentifier>ISO 124</docidentifier></bibitem>
|
147
|
-
</references></bibliography>
|
148
|
-
</iso-standard>
|
149
|
-
OUTPUT
|
150
|
-
|
151
|
-
json = File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8")
|
152
|
-
expect(json).to be_equivalent_to <<~"OUTPUT"
|
153
|
-
{"ISO 123":"<bibitem type=\\"international-standard\\" id=\\"ISO123\\"> <title format=\\"text/plain\\" language=\\"en\\" script=\\"Latn\\">Rubber latex -- Sampling</title><docidentifier>ISO 123</docidentifier></bibitem>","ISO 124":"<bibitem type=\\"international-standard\\" id=\\"ISO124\\"> <title format=\\"text/plain\\" language=\\"en\\" script=\\"Latn\\">Latex, rubber -- Determination of total solids content</docidentifier></bibitem>"}
|
154
|
-
OUTPUT
|
155
|
-
json = File.read("test.relaton.json", encoding: "utf-8")
|
156
|
-
expect(json).to be_equivalent_to <<~"OUTPUT"
|
157
|
-
{"ISO 124":"<bibitem type=\\"international-standard\\" id=\\"ISO124\\"> <title format=\\"text/plain\\" language=\\"fr\\" script=\\"Latn\\">Latex de caoutchouc -- Détermination des matières solides totales</title><docidentifier>ISO 124</docidentifier></bibitem>","ISO 123":"<bibitem type=\\"international-standard\\" id=\\"ISO123\\"> <title format=\\"text/plain\\" language=\\"en\\" script=\\"Latn\\">Rubber latex -- Sampling</title><docidentifier>ISO 123</docidentifier></bibitem>"}
|
158
|
-
OUTPUT
|
202
|
+
|
203
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
204
|
+
expect(json["ISO 123"]["fetched"]).to eq(Date.today.to_s)
|
205
|
+
expect(json["ISO 123"]["bib"]).to be_equivalent_to(ISOBIB_123_UNDATED)
|
159
206
|
|
160
207
|
system "rm ~/.relaton-bib.json"
|
161
208
|
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
162
|
-
end
|
209
|
+
end
|
210
|
+
|
211
|
+
it "does not expire stale dated references" do
|
212
|
+
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
213
|
+
|
214
|
+
File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
|
215
|
+
f.write({
|
216
|
+
"ISO 123:2001": {
|
217
|
+
"fetched": (Date.today - 90).to_s,
|
218
|
+
"bib": ISO_123_SHORT
|
219
|
+
}
|
220
|
+
}.to_json)
|
221
|
+
end
|
222
|
+
|
223
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
224
|
+
#{CACHED_ISOBIB_BLANK_HDR}
|
225
|
+
[bibliography]
|
226
|
+
== Normative References
|
227
|
+
|
228
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
229
|
+
INPUT
|
230
|
+
|
231
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
232
|
+
expect(json["ISO 123:2001"]["fetched"]).to eq((Date.today - 90).to_s)
|
233
|
+
expect(json["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
234
|
+
|
235
|
+
system "rm ~/.relaton-bib.json"
|
236
|
+
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
237
|
+
end
|
238
|
+
|
239
|
+
it "prioritises local over global cache values" do
|
240
|
+
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
241
|
+
system "rm test.relaton.json"
|
242
|
+
|
243
|
+
File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
|
244
|
+
f.write({
|
245
|
+
"ISO 123:2001": {
|
246
|
+
"fetched": Date.today.to_s,
|
247
|
+
"bib": ISO_123_SHORT
|
248
|
+
},
|
249
|
+
"ISO 124": {
|
250
|
+
"fetched": Date.today.to_s,
|
251
|
+
"bib": ISO_124_SHORT
|
252
|
+
}
|
253
|
+
}.to_json)
|
254
|
+
end
|
255
|
+
|
256
|
+
File.open("test.relaton.json", "w") do |f|
|
257
|
+
f.write({
|
258
|
+
"ISO 124": {
|
259
|
+
"fetched": Date.today.to_s,
|
260
|
+
"bib": ISO_124_SHORT_ALT
|
261
|
+
}
|
262
|
+
}.to_json)
|
263
|
+
end
|
264
|
+
|
265
|
+
input = <<~EOS
|
266
|
+
#{LOCAL_CACHED_ISOBIB_BLANK_HDR}
|
267
|
+
[bibliography]
|
268
|
+
== Normative References
|
269
|
+
|
270
|
+
* [[[iso123,ISO 123:2001]]] _Standard_
|
271
|
+
* [[[iso124,ISO 124]]] _Standard_
|
272
|
+
EOS
|
273
|
+
|
274
|
+
output = <<~EOS
|
275
|
+
#{BLANK_HDR}
|
276
|
+
<sections>
|
277
|
+
</sections>
|
278
|
+
<bibliography>
|
279
|
+
<references id="_" obligation="informative">
|
280
|
+
<title>Normative References</title>
|
281
|
+
#{ISO_123_SHORT}
|
282
|
+
#{ISO_124_SHORT_ALT}
|
283
|
+
</references></bibliography>
|
284
|
+
</iso-standard>
|
285
|
+
EOS
|
286
|
+
|
287
|
+
expect(strip_guid(Asciidoctor.convert(input, backend: :iso, header_footer: true))).to be_equivalent_to(output)
|
288
|
+
|
289
|
+
json = JSON.parse(File.read("#{Dir.home}/.relaton-bib.json", encoding: "utf-8"))
|
290
|
+
|
291
|
+
expect(json["ISO 123:2001"]["fetched"]).to eq(Date.today.to_s)
|
292
|
+
expect(json["ISO 124"]["fetched"]).to eq(Date.today.to_s)
|
293
|
+
expect(json["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
294
|
+
expect(json["ISO 124"]["bib"]).to be_equivalent_to(ISO_124_SHORT)
|
295
|
+
|
296
|
+
json_local = JSON.parse(File.read("test.relaton.json", encoding: "utf-8"))
|
297
|
+
|
298
|
+
expect(json_local["ISO 123:2001"]["fetched"]).to eq(Date.today.to_s)
|
299
|
+
expect(json_local["ISO 124"]["fetched"]).to eq(Date.today.to_s)
|
300
|
+
expect(json_local["ISO 123:2001"]["bib"]).to be_equivalent_to(ISO_123_SHORT)
|
301
|
+
expect(json_local["ISO 124"]["bib"]).to be_equivalent_to(ISO_124_SHORT_ALT)
|
302
|
+
|
303
|
+
system "rm ~/.relaton-bib.json"
|
304
|
+
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
305
|
+
end
|
306
|
+
|
307
|
+
private
|
308
|
+
|
309
|
+
def mock_isobib_get_123
|
310
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", "2001", {}).and_return(ISOBIB_123_DATED)
|
311
|
+
end
|
312
|
+
|
313
|
+
def mock_isobib_get_123_undated
|
314
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}).and_return(ISOBIB_123_UNDATED)
|
315
|
+
end
|
316
|
+
|
317
|
+
def mock_isobib_get_124
|
318
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}).and_return(ISOBIB_124_DATED)
|
319
|
+
end
|
163
320
|
|
164
321
|
end
|
@@ -65,7 +65,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
65
65
|
|
66
66
|
|
67
67
|
it "fetches simple ISO reference" do
|
68
|
-
|
68
|
+
mock_isobib_get_123
|
69
69
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
70
70
|
#{ISOBIB_BLANK_HDR}
|
71
71
|
[bibliography]
|
@@ -75,125 +75,58 @@ RSpec.describe Asciidoctor::ISO do
|
|
75
75
|
INPUT
|
76
76
|
#{BLANK_HDR}
|
77
77
|
<sections>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
|
128
|
-
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Échantillonnage</title>
|
129
|
-
<source type="src">https://www.iso.org/standard/23281.html</source>
|
130
|
-
<source type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</source>
|
131
|
-
<source type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</source>
|
132
|
-
<docidentifier>ISO 123</docidentifier>
|
133
|
-
<date type="published">
|
134
|
-
<on>2001</on>
|
135
|
-
</date>
|
136
|
-
<contributor>
|
137
|
-
<role type="publisher"/>
|
138
|
-
<organization>
|
139
|
-
<name>International Organization for Standardization</name>
|
140
|
-
<abbreviation>ISO</abbreviation>
|
141
|
-
<uri>www.iso.org</uri>
|
142
|
-
</organization>
|
143
|
-
</contributor>
|
144
|
-
<edition>3</edition>
|
145
|
-
<language>en</language>
|
146
|
-
<language>fr</language>
|
147
|
-
<script>Latn</script>
|
148
|
-
<status>Published</status>
|
149
|
-
<copyright>
|
150
|
-
<from>2001</from>
|
151
|
-
<owner>
|
152
|
-
<organization>
|
153
|
-
<name>ISO</name>
|
154
|
-
<abbreviation/>
|
155
|
-
</organization>
|
156
|
-
</owner>
|
157
|
-
</copyright>
|
158
|
-
<relation type="obsoletes">
|
159
|
-
<bibitem>
|
160
|
-
<formattedref>ISO 123:1985</formattedref>
|
161
|
-
<docidentifier>ISO 123:1985</docidentifier>
|
162
|
-
</bibitem>
|
163
|
-
</relation>
|
164
|
-
<relation type="updates">
|
165
|
-
<bibitem>
|
166
|
-
<formattedref>ISO 123:2001</formattedref>
|
167
|
-
<docidentifier>ISO 123:2001</docidentifier>
|
168
|
-
</bibitem>
|
169
|
-
</relation>
|
170
|
-
<ics>
|
171
|
-
<code>83.040.10</code>
|
172
|
-
<text>Latex and raw rubber</text>
|
173
|
-
</ics>
|
174
|
-
</bibitem>
|
175
|
-
</relation>
|
176
|
-
</bibitem>
|
177
|
-
</references>
|
178
|
-
</bibliography>
|
179
|
-
</iso-standard>
|
78
|
+
</sections><bibliography><references id="_" obligation="informative">
|
79
|
+
<title>Normative References</title>
|
80
|
+
<bibitem type="international-standard" id="ISO123">
|
81
|
+
<title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
|
82
|
+
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title>
|
83
|
+
<source type="src">https://www.iso.org/standard/23281.html</source>
|
84
|
+
<source type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</source>
|
85
|
+
<source type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</source>
|
86
|
+
<docidentifier>ISO 123</docidentifier>
|
87
|
+
<date type="published">
|
88
|
+
<on>2001</on>
|
89
|
+
</date>
|
90
|
+
<contributor>
|
91
|
+
<role type="publisher"/>
|
92
|
+
<organization>
|
93
|
+
<name>International Organization for Standardization</name>
|
94
|
+
<abbreviation>ISO</abbreviation>
|
95
|
+
<uri>www.iso.org</uri>
|
96
|
+
</organization>
|
97
|
+
</contributor>
|
98
|
+
<edition>3</edition>
|
99
|
+
<language>en</language>
|
100
|
+
<language>fr</language>
|
101
|
+
<script>Latn</script>
|
102
|
+
<status>Published</status>
|
103
|
+
<copyright>
|
104
|
+
<from>2001</from>
|
105
|
+
<owner>
|
106
|
+
<organization>
|
107
|
+
<name>ISO</name>
|
108
|
+
<abbreviation/>
|
109
|
+
</organization>
|
110
|
+
</owner>
|
111
|
+
</copyright>
|
112
|
+
<relation type="obsoletes">
|
113
|
+
<bibitem>
|
114
|
+
<formattedref>ISO 123:1985</formattedref>
|
115
|
+
<docidentifier>ISO 123:1985</docidentifier>
|
116
|
+
</bibitem>
|
117
|
+
</relation>
|
118
|
+
<relation type="updates">
|
119
|
+
<bibitem>
|
120
|
+
<formattedref>ISO 123:2001</formattedref>
|
121
|
+
<docidentifier>ISO 123:2001</docidentifier>
|
122
|
+
</bibitem>
|
123
|
+
</relation>
|
124
|
+
</bibitem>
|
125
|
+
</references></bibliography>
|
126
|
+
</iso-standard>
|
180
127
|
OUTPUT
|
181
128
|
end
|
182
129
|
|
183
|
-
it "fetches simple ISO reference" do
|
184
|
-
system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
|
185
|
-
system "rm -f test.relation.json"
|
186
|
-
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
187
|
-
#{CACHED_ISOBIB_BLANK_HDR}
|
188
|
-
[bibliography]
|
189
|
-
== Normative References
|
190
|
-
|
191
|
-
* [[[iso123,ISO 123]]] _Standard_
|
192
|
-
INPUT
|
193
|
-
system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
|
194
|
-
end
|
195
|
-
|
196
|
-
|
197
130
|
it "processes simple IEC reference" do
|
198
131
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
199
132
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -224,8 +157,8 @@ RSpec.describe Asciidoctor::ISO do
|
|
224
157
|
end
|
225
158
|
|
226
159
|
it "processes dated ISO reference and joint ISO/IEC references" do
|
227
|
-
|
228
|
-
|
160
|
+
mock_isobib_get_iec12382
|
161
|
+
mock_isobib_get_124
|
229
162
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
230
163
|
#{ISOBIB_BLANK_HDR}
|
231
164
|
[bibliography]
|
@@ -318,7 +251,6 @@ RSpec.describe Asciidoctor::ISO do
|
|
318
251
|
<language>fr</language>
|
319
252
|
<script>Latn</script>
|
320
253
|
<abstract format="plain" language="en" script="Latn">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.</abstract>
|
321
|
-
<abstract format="plain" language="fr" script="Latn">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.</abstract>
|
322
254
|
<status>Published</status>
|
323
255
|
<copyright>
|
324
256
|
<from>2014</from>
|
@@ -543,4 +475,131 @@ RSpec.describe Asciidoctor::ISO do
|
|
543
475
|
</iso-standard>
|
544
476
|
OUTPUT
|
545
477
|
end
|
478
|
+
|
479
|
+
private
|
480
|
+
|
481
|
+
private
|
482
|
+
|
483
|
+
def mock_isobib_get_123
|
484
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
|
485
|
+
<<~"OUTPUT"
|
486
|
+
<bibitem type=\"international-standard\" id=\"ISO123\">\n <title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <source type=\"src\">https://www.iso.org/standard/23281.html</source>\n <source type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</source>\n <source type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</source>\n <docidentifier>ISO 123</docidentifier>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status>Published</status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem>\n <formattedref>ISO 123:1985</formattedref>\n <docidentifier>ISO 123:1985</docidentifier>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem>\n <formattedref>ISO 123:2001</formattedref>\n <docidentifier>ISO 123:2001</docidentifier>\n </bibitem>\n </relation>\n</bibitem>
|
487
|
+
OUTPUT
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
def mock_isobib_get_124
|
492
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
|
493
|
+
<<~"OUTPUT"
|
494
|
+
<bibitem type="international-standard" id="iso124">
|
495
|
+
<title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
|
496
|
+
<title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
|
497
|
+
<source type="src">https://www.iso.org/standard/61884.html</source>
|
498
|
+
<source type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</source>
|
499
|
+
<source type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</source>
|
500
|
+
<docidentifier>ISO 124</docidentifier>
|
501
|
+
<date type="published">
|
502
|
+
<on>2014</on>
|
503
|
+
</date>
|
504
|
+
<contributor>
|
505
|
+
<role type="publisher"/>
|
506
|
+
<organization>
|
507
|
+
<name>International Organization for Standardization</name>
|
508
|
+
<abbreviation>ISO</abbreviation>
|
509
|
+
<uri>www.iso.org</uri>
|
510
|
+
</organization>
|
511
|
+
</contributor>
|
512
|
+
<edition>7</edition>
|
513
|
+
<language>en</language>
|
514
|
+
<language>fr</language>
|
515
|
+
<script>Latn</script>
|
516
|
+
<abstract format="plain" language="en" script="Latn">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.</abstract>
|
517
|
+
<status>Published</status>
|
518
|
+
<copyright>
|
519
|
+
<from>2014</from>
|
520
|
+
<owner>
|
521
|
+
<organization>
|
522
|
+
<name>ISO</name>
|
523
|
+
<abbreviation/>
|
524
|
+
</organization>
|
525
|
+
</owner>
|
526
|
+
</copyright>
|
527
|
+
<relation type="obsoletes">
|
528
|
+
<bibitem>
|
529
|
+
<formattedref>ISO 124:2011</formattedref>
|
530
|
+
<docidentifier>ISO 124:2011</docidentifier>
|
531
|
+
</bibitem>
|
532
|
+
</relation>
|
533
|
+
<ics>
|
534
|
+
<code>83.040.10</code>
|
535
|
+
<text>Latex and raw rubber</text>
|
536
|
+
</ics>
|
537
|
+
</bibitem>
|
538
|
+
OUTPUT
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
def mock_isobib_get_iec12382
|
543
|
+
expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
|
544
|
+
<<~"OUTPUT"
|
545
|
+
<bibitem type="international-standard" id="iso123">
|
546
|
+
<title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
|
547
|
+
<title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
|
548
|
+
<source type="src">https://www.iso.org/standard/21071.html</source>
|
549
|
+
<source type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</source>
|
550
|
+
<source type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</source>
|
551
|
+
<docidentifier>ISO/IEC 12382</docidentifier>
|
552
|
+
<date type="published">
|
553
|
+
<on>1992</on>
|
554
|
+
</date>
|
555
|
+
<contributor>
|
556
|
+
<role type="publisher"/>
|
557
|
+
<organization>
|
558
|
+
<name>International Organization for Standardization</name>
|
559
|
+
<abbreviation>ISO</abbreviation>
|
560
|
+
<uri>www.iso.org</uri>
|
561
|
+
</organization>
|
562
|
+
</contributor>
|
563
|
+
<contributor>
|
564
|
+
<role type="publisher"/>
|
565
|
+
<organization>
|
566
|
+
<name>International Electrotechnical Commission</name>
|
567
|
+
<abbreviation>IEC</abbreviation>
|
568
|
+
<uri>www.iec.ch</uri>
|
569
|
+
</organization>
|
570
|
+
</contributor>
|
571
|
+
<edition>2</edition>
|
572
|
+
<language>en</language>
|
573
|
+
<language>fr</language>
|
574
|
+
<script>Latn</script>
|
575
|
+
<abstract format="plain" language="en" script="Latn">Contains a permuted index of all terms included in the parts 1 - 28 of ISO 2382. If any of these parts has been revised, the present TR refers to the revision.</abstract>
|
576
|
+
<status>Published</status>
|
577
|
+
<copyright>
|
578
|
+
<from>1992</from>
|
579
|
+
<owner>
|
580
|
+
<organization>
|
581
|
+
<name>ISO/IEC</name>
|
582
|
+
<abbreviation/>
|
583
|
+
</organization>
|
584
|
+
</owner>
|
585
|
+
</copyright>
|
586
|
+
<relation type="updates">
|
587
|
+
<bibitem>
|
588
|
+
<formattedref>ISO/IEC TR 12382:1992</formattedref>
|
589
|
+
<docidentifier>ISO/IEC TR 12382:1992</docidentifier>
|
590
|
+
</bibitem>
|
591
|
+
</relation>
|
592
|
+
<ics>
|
593
|
+
<code>35.020</code>
|
594
|
+
<text>Information technology (IT) in general</text>
|
595
|
+
</ics>
|
596
|
+
<ics>
|
597
|
+
<code>01.040.35</code>
|
598
|
+
<text>Information technology (Vocabularies)</text>
|
599
|
+
</ics>
|
600
|
+
</bibitem>
|
601
|
+
OUTPUT
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
546
605
|
end
|
data/spec/examples/rice.adoc
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.8
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.
|
68
|
+
version: 0.1.8
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: iso-bib-item
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,16 +224,16 @@ dependencies:
|
|
224
224
|
name: metanorma
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - "
|
227
|
+
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 0.2.4
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 0.2.4
|
237
237
|
description: |
|
238
238
|
asciidoctor-iso lets you write ISO standards in AsciiDoc syntax.
|
239
239
|
|