metanorma-standoc 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/asciidoctor/standoc/basicdoc.rng +5 -4
- data/lib/asciidoctor/standoc/biblio.rng +3 -0
- data/lib/asciidoctor/standoc/ref.rb +1 -0
- data/lib/asciidoctor/standoc/utils.rb +18 -7
- data/lib/asciidoctor/standoc/validate.rb +16 -11
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor-standoc/refs_spec.rb +75 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8fab97f6fa53dcc3ff51d52897b6b7d7c0eaad734f21cb87e41bc1c8236e333
|
4
|
+
data.tar.gz: f71df060df2100c4a991f08b3d9129547bf8ca7bda29e43ec17a2d24b7847c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ee129d2c67a72e6ec71653e3bb6a064fa16e1de9f6323b3a610802825649243e89cecb23b2f5644cb0508dfa3aa0832af74afe7421a582de6062ee2bea13f9
|
7
|
+
data.tar.gz: 39bfaf064020bf8e8fbf8d7c974f3661128d7331e1b3eb95779743f8d59a295d0410cbb911151c03c162338d37bdee86f9bf8e1d118ad5bee64affcf457795b0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
metanorma-standoc (1.3.
|
4
|
+
metanorma-standoc (1.3.8)
|
5
5
|
asciidoctor (~> 2.0.0)
|
6
6
|
concurrent-ruby
|
7
7
|
html2doc (~> 0.9.0)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
nokogiri (>= 1.4.3)
|
35
35
|
faraday (0.17.0)
|
36
36
|
multipart-post (>= 1.2, < 3)
|
37
|
-
ffi (1.11.
|
37
|
+
ffi (1.11.2)
|
38
38
|
formatador (0.2.5)
|
39
39
|
gb-agencies (0.0.6)
|
40
40
|
guard (2.16.1)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
guard-compat (~> 1.1)
|
53
53
|
rspec (>= 2.99.0, < 4.0)
|
54
54
|
hashdiff (1.0.0)
|
55
|
-
html2doc (0.9.
|
55
|
+
html2doc (0.9.2)
|
56
56
|
asciimath (~> 1.0.9)
|
57
57
|
htmlentities (~> 4.3.4)
|
58
58
|
image_size
|
@@ -64,7 +64,7 @@ GEM
|
|
64
64
|
iev (0.2.3)
|
65
65
|
nokogiri (>= 1.10.4)
|
66
66
|
image_size (2.0.2)
|
67
|
-
isodoc (1.0.
|
67
|
+
isodoc (1.0.8)
|
68
68
|
asciimath
|
69
69
|
html2doc (~> 0.9.0)
|
70
70
|
htmlentities (~> 4.3.4)
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
84
84
|
rb-inotify (~> 0.9, >= 0.9.10)
|
85
85
|
lumberjack (1.0.13)
|
86
|
-
metanorma (0.3.
|
86
|
+
metanorma (0.3.17)
|
87
87
|
asciidoctor
|
88
88
|
htmlentities
|
89
89
|
method_source (0.9.2)
|
@@ -100,7 +100,7 @@ GEM
|
|
100
100
|
nenv (~> 0.1)
|
101
101
|
shellany (~> 0.0)
|
102
102
|
optout (0.0.2)
|
103
|
-
parallel (1.
|
103
|
+
parallel (1.19.0)
|
104
104
|
parser (2.6.5.0)
|
105
105
|
ast (~> 2.4.0)
|
106
106
|
powerpack (0.1.2)
|
@@ -113,7 +113,7 @@ GEM
|
|
113
113
|
rb-fsevent (0.10.3)
|
114
114
|
rb-inotify (0.10.0)
|
115
115
|
ffi (~> 1.0)
|
116
|
-
relaton (0.5.
|
116
|
+
relaton (0.5.14)
|
117
117
|
relaton-calconnect (~> 0.1.0)
|
118
118
|
relaton-gb (~> 0.6.0)
|
119
119
|
relaton-iec (~> 0.4.0)
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
relaton-iec (0.4.10)
|
136
136
|
addressable
|
137
137
|
relaton-iso-bib (~> 0.3.0)
|
138
|
-
relaton-ietf (0.6.
|
138
|
+
relaton-ietf (0.6.10)
|
139
139
|
relaton-bib (~> 0.3.0)
|
140
140
|
relaton-iev (0.1.1)
|
141
141
|
relaton (~> 0.5.0)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
-
<include href="biblio.rng"
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
<include href="biblio.rng">
|
4
|
+
<start>
|
5
|
+
<ref name="document"/>
|
6
|
+
</start>
|
7
|
+
</include>
|
7
8
|
<define name="document">
|
8
9
|
<element name="document">
|
9
10
|
<optional>
|
@@ -33,6 +33,9 @@
|
|
33
33
|
<param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))))?</param>
|
34
34
|
</data>
|
35
35
|
</define>
|
36
|
+
<start>
|
37
|
+
<ref name="relaton_collection"/>
|
38
|
+
</start>
|
36
39
|
<define name="status">
|
37
40
|
<element name="status">
|
38
41
|
<ref name="stage"/>
|
@@ -45,6 +45,7 @@ module Asciidoctor
|
|
45
45
|
type, code1 = /^\[\d+\]$|^\(.+\)$/.match(code) ?
|
46
46
|
["metanorma", code.sub(/^\(/, "[").sub(/\)$/, "]")] :
|
47
47
|
@bibdb&.docid_type(code) || [nil, code]
|
48
|
+
code1.sub!(/^nofetch\((.+)\)$/, "\\1")
|
48
49
|
t.docidentifier code1, **attr_code(type: type)
|
49
50
|
end
|
50
51
|
|
@@ -188,16 +188,27 @@ module Asciidoctor
|
|
188
188
|
|
189
189
|
def datauri2mime(uri)
|
190
190
|
%r{^data:image/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ uri
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
file.close
|
197
|
-
file.unlink
|
191
|
+
type = nil
|
192
|
+
imgtype = "png" unless /^[a-z0-9]+$/.match imgtype
|
193
|
+
Tempfile.open(["imageuri", ".#{imgtype}"]) do |file|
|
194
|
+
type = datauri2mime1(file, imgdata)
|
195
|
+
end
|
198
196
|
[type]
|
199
197
|
end
|
200
198
|
|
199
|
+
def datauri2mime1(file, imgdata)
|
200
|
+
type = nil
|
201
|
+
begin
|
202
|
+
file.binmode
|
203
|
+
file.write(Base64.strict_decode64(imgdata))
|
204
|
+
file.rewind
|
205
|
+
type = MimeMagic.by_magic(file)
|
206
|
+
ensure
|
207
|
+
file.close!
|
208
|
+
end
|
209
|
+
type
|
210
|
+
end
|
211
|
+
|
201
212
|
SUBCLAUSE_XPATH = "//clause[ancestor::clause or ancestor::annex or "\
|
202
213
|
"ancestor::introduction]".freeze
|
203
214
|
end
|
@@ -2,7 +2,6 @@ require "asciidoctor/standoc/utils"
|
|
2
2
|
require_relative "./validate_section.rb"
|
3
3
|
require "nokogiri"
|
4
4
|
require "jing"
|
5
|
-
require "pp"
|
6
5
|
require "iev"
|
7
6
|
|
8
7
|
module Asciidoctor
|
@@ -35,16 +34,22 @@ module Asciidoctor
|
|
35
34
|
iev_validate(doc.root)
|
36
35
|
end
|
37
36
|
|
38
|
-
def schema_validate(doc,
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
def schema_validate(doc, schema)
|
38
|
+
Tempfile.open(["tmp", ".xml"], :encoding => 'UTF-8') do |f|
|
39
|
+
begin
|
40
|
+
f.write(doc.to_xml)
|
41
|
+
f.close
|
42
|
+
#File.open(".tmp.xml", "w:UTF-8") { |f| f.write(doc.to_xml) }
|
43
|
+
errors = Jing.new(schema).validate(f.path)
|
44
|
+
warn "Valid!" if errors.none?
|
45
|
+
errors.each do |error|
|
46
|
+
warn "#{error[:message]} @ #{error[:line]}:#{error[:column]}"
|
47
|
+
end
|
48
|
+
rescue Jing::Error => e
|
49
|
+
abort "Jing failed with error: #{e}"
|
50
|
+
ensure
|
51
|
+
f.close!
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
@@ -395,6 +395,81 @@ RSpec.describe Asciidoctor::Standoc do
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
|
+
it "declines to fetch individual references" do
|
399
|
+
VCR.use_cassette "dated_iso_ref_joint_iso_iec" do
|
400
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
|
401
|
+
#{ISOBIB_BLANK_HDR}
|
402
|
+
[bibliography]
|
403
|
+
== Normative References
|
404
|
+
|
405
|
+
* [[[iso123,nofetch(ISO/IEC TR 12382:1992)]]] _Standard_
|
406
|
+
* [[[iso124,ISO 124:2014]]] _Standard_
|
407
|
+
INPUT
|
408
|
+
#{BLANK_HDR}
|
409
|
+
<sections>
|
410
|
+
|
411
|
+
</sections><bibliography><references id="_" obligation="informative">
|
412
|
+
<title>Normative References</title>
|
413
|
+
#{NORM_REF_BOILERPLATE}
|
414
|
+
<bibitem id='iso123'>
|
415
|
+
<formattedref format='application/x-isodoc+xml'>
|
416
|
+
<em>Standard</em>
|
417
|
+
</formattedref>
|
418
|
+
<docidentifier>ISO/IEC TR 12382:1992</docidentifier>
|
419
|
+
</bibitem>
|
420
|
+
<bibitem id='iso124' type='standard'>
|
421
|
+
<fetched>#{Date.today}</fetched>
|
422
|
+
<title type='title-intro' format='text/plain' language='en' script='Latn'>Latex, rubber</title>
|
423
|
+
<title type='title-main' format='text/plain' language='en' script='Latn'>Determination of total solids content</title>
|
424
|
+
<title type='main' format='text/plain' language='en' script='Latn'>Latex, rubber – Determination of total solids content</title>
|
425
|
+
<title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
|
426
|
+
<title type='title-main' format='text/plain' language='fr' script='Latn'>Détermination des matières solides totales</title>
|
427
|
+
<title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc – Détermination des matières solides totales</title>
|
428
|
+
<uri type='src'>https://www.iso.org/standard/61884.html</uri>
|
429
|
+
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
|
430
|
+
<uri type='rss'>https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
|
431
|
+
<docidentifier type='ISO'>ISO 124:2014</docidentifier>
|
432
|
+
<docnumber>124</docnumber>
|
433
|
+
<date type='published'>
|
434
|
+
<on>2014</on>
|
435
|
+
</date>
|
436
|
+
<contributor>
|
437
|
+
<role type='publisher'/>
|
438
|
+
<organization>
|
439
|
+
<name>International Organization for Standardization</name>
|
440
|
+
<abbreviation>ISO</abbreviation>
|
441
|
+
<uri>www.iso.org</uri>
|
442
|
+
</organization>
|
443
|
+
</contributor>
|
444
|
+
<edition>7</edition>
|
445
|
+
<language>en</language>
|
446
|
+
<language>fr</language>
|
447
|
+
<script>Latn</script>
|
448
|
+
<abstract format='text/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>
|
449
|
+
<abstract format='text/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>
|
450
|
+
<status>
|
451
|
+
<stage>90</stage>
|
452
|
+
<substage>93</substage>
|
453
|
+
</status>
|
454
|
+
<copyright>
|
455
|
+
<from>2014</from>
|
456
|
+
<owner>
|
457
|
+
<organization>
|
458
|
+
<name>ISO</name>
|
459
|
+
</organization>
|
460
|
+
</owner>
|
461
|
+
</copyright>
|
462
|
+
<relation type='obsoletes'>
|
463
|
+
<bibitem type='standard'>
|
464
|
+
<formattedref format='text/plain'>ISO 124:2011</formattedref>
|
465
|
+
</bibitem>
|
466
|
+
</relation>
|
467
|
+
</bibitem>
|
468
|
+
</references></bibliography></standard-document>
|
469
|
+
OUTPUT
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
398
473
|
it "processes draft ISO reference" do
|
399
474
|
#stub_fetch_ref no_year: true, note: "The standard is in press"
|
400
475
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|