relaton-iho 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +41 -29
- data/grammars/isodoc.rng +114 -14
- data/lib/relaton_iho/iho_bibliography.rb +2 -2
- data/lib/relaton_iho/version.rb +1 -1
- data/relaton_iho.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c2889e6d995ae69c8aaf59df34b2a4c8ca5c7700be4e7f31f5ae27411469afd
|
4
|
+
data.tar.gz: 9c27f57bd7cd0824fcbfbd4acc6cd6921f7c7cf0bd2594a4032406ccd037d406
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73ac143dab2eff7e69440608d2373b0f62cfe059cebcf0a1fab47a2d395dd8fd6b3fd22ba5f3124293cd14f8d4e7382795e65a0c3135e0ea7fe407636af7503
|
7
|
+
data.tar.gz: e25a2f287db40dfc99a305358134b3dfd87afe2aa3a500c103f2de8f97e6ae4093b8aa3b1843a1cf253c073cb5bc8ca9d6b1f5002b11b711eb313ac15c4b43b4
|
data/README.adoc
CHANGED
@@ -32,7 +32,7 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
[source,sh]
|
34
34
|
----
|
35
|
-
$ gem install
|
35
|
+
$ gem install relaton-iho
|
36
36
|
----
|
37
37
|
|
38
38
|
== Usage
|
@@ -41,11 +41,13 @@ $ gem install relaton_iho
|
|
41
41
|
|
42
42
|
[source,ruby]
|
43
43
|
----
|
44
|
-
|
45
|
-
=>
|
44
|
+
pry(main)> require 'relaton_iho'
|
45
|
+
=> true
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
item = RelatonIho::IhoBibliography.search("B-11")
|
48
|
+
[relaton-iho] ("B-11") fetching...
|
49
|
+
[relaton-iho] ("B-11") found B-11
|
50
|
+
=> #<RelatonIho::IhoBibliographicItem:0x007fe74fc80800
|
49
51
|
...
|
50
52
|
----
|
51
53
|
|
@@ -53,14 +55,12 @@ tem = hits[0].fetch
|
|
53
55
|
[source,ruby]
|
54
56
|
----
|
55
57
|
item.to_xml
|
56
|
-
=> "<bibitem id="
|
57
|
-
<
|
58
|
-
<title type="main" format="text/plain" language="en"
|
59
|
-
<
|
60
|
-
<
|
61
|
-
<
|
62
|
-
<on>2019</on>
|
63
|
-
</date>
|
58
|
+
=> "<bibitem id="B-11" type="standard">
|
59
|
+
<fetched>2020-03-29</fetched>
|
60
|
+
<title type="main" format="text/plain" language="en">IHO-IOC GEBCO Cook Book</title>
|
61
|
+
<title type="main" format="text/plain" language="fr">Livre de recettes GEBCO OHI-COI</title>
|
62
|
+
<uri type="pdf">https://www.star.nesdis.noaa.gov/socd/lsa/GEBCO_Cookbook/documents/CookBook_20191031.pdf</uri>
|
63
|
+
<docidentifier type="IHO">B-11</docidentifier>
|
64
64
|
...
|
65
65
|
</bibitem>"
|
66
66
|
----
|
@@ -69,33 +69,45 @@ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and add
|
|
69
69
|
----
|
70
70
|
item.to_xml bibdata: true
|
71
71
|
=> "<bibdata type="standard">
|
72
|
-
<
|
73
|
-
<title type="main" format="text/plain" language="en"
|
74
|
-
<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<on>2019</on>
|
78
|
-
</date>
|
72
|
+
<fetched>2020-03-29</fetched>
|
73
|
+
<title type="main" format="text/plain" language="en">IHO-IOC GEBCO Cook Book</title>
|
74
|
+
<title type="main" format="text/plain" language="fr">Livre de recettes GEBCO OHI-COI</title>
|
75
|
+
<uri type="pdf">https://www.star.nesdis.noaa.gov/socd/lsa/GEBCO_Cookbook/documents/CookBook_20191031.pdf</uri>
|
76
|
+
<docidentifier type="IHO">B-11</docidentifier>
|
79
77
|
...
|
80
78
|
<ext>
|
81
|
-
<
|
79
|
+
<editorialgroup>
|
80
|
+
<committee>
|
81
|
+
<name>Hydrographic Services and Standards Committee</name>
|
82
|
+
<abbreviation>HSSC</abbreviation>
|
83
|
+
</committee>
|
84
|
+
<committee>
|
85
|
+
<name>Inter-Regional Coordination Committee</name>
|
86
|
+
<abbreviation>IRCC</abbreviation>
|
87
|
+
<committee>
|
88
|
+
<name>JOINT IHO-IOC GUIDING COMMITTEE FOR THE GENERAL BATHYMETRIC CHART OF THE OCEANS</name>
|
89
|
+
<abbreviation>GEBCO</abbreviation>
|
90
|
+
</committee>
|
91
|
+
</committee>
|
92
|
+
</editorialgroup>
|
82
93
|
</ext>
|
83
94
|
</bibdata>"
|
84
95
|
----
|
85
96
|
|
86
|
-
=== Get code
|
97
|
+
=== Get code
|
87
98
|
[source,ruby]
|
88
99
|
----
|
89
|
-
RelatonIho::IhoBibliography.get "
|
90
|
-
|
91
|
-
|
100
|
+
RelatonIho::IhoBibliography.get "IHO B-11"
|
101
|
+
[relaton-iho] ("IHO B-11") fetching...
|
102
|
+
[relaton-iho] ("IHO B-11") found B-11
|
103
|
+
=> #<RelatonIho::IhoBibliographicItem:0x007fe78dbb7c78
|
92
104
|
...
|
93
105
|
----
|
94
106
|
|
95
107
|
=== Create bibliographic item from XML
|
96
108
|
[source,ruby]
|
97
109
|
----
|
98
|
-
RelatonIho::XMLParser.from_xml File.read('spec/fixtures/
|
110
|
+
RelatonIho::XMLParser.from_xml File.read('spec/fixtures/iho.xml')
|
99
111
|
=> #<RelatonIho::IhoBibliographicItem:0x007fc322ea82c8
|
100
112
|
...
|
101
113
|
----
|
@@ -103,12 +115,12 @@ RelatonIho::XMLParser.from_xml File.read('spec/fixtures/ogc_bib_item.xml')
|
|
103
115
|
=== Create bibliographic item from YAML
|
104
116
|
[source,ruby]
|
105
117
|
----
|
106
|
-
hash = YAML.load_file 'spec/fixtures/
|
107
|
-
=> {"id"=>"
|
118
|
+
hash = YAML.load_file 'spec/fixtures/iho.yaml'
|
119
|
+
=> {"id"=>"B-11",
|
108
120
|
...
|
109
121
|
|
110
122
|
bib_hash = RelatonIho::HashConverter.hash_to_bib hash
|
111
|
-
=> {:id=>"
|
123
|
+
=> {:id=>"B-11",
|
112
124
|
...
|
113
125
|
|
114
126
|
RelatonIho::IhoBibliographicItem.new bib_hash
|
data/grammars/isodoc.rng
CHANGED
@@ -64,6 +64,11 @@
|
|
64
64
|
</choice>
|
65
65
|
</attribute>
|
66
66
|
</optional>
|
67
|
+
<optional>
|
68
|
+
<attribute name="droploc">
|
69
|
+
<data type="boolean"/>
|
70
|
+
</attribute>
|
71
|
+
</optional>
|
67
72
|
<text/>
|
68
73
|
</element>
|
69
74
|
</define>
|
@@ -581,6 +586,8 @@
|
|
581
586
|
<ref name="ol"/>
|
582
587
|
<ref name="dl"/>
|
583
588
|
<ref name="formula"/>
|
589
|
+
<ref name="quote"/>
|
590
|
+
<ref name="sourcecode"/>
|
584
591
|
</choice>
|
585
592
|
</oneOrMore>
|
586
593
|
</element>
|
@@ -664,6 +671,16 @@
|
|
664
671
|
</choice>
|
665
672
|
</attribute>
|
666
673
|
</optional>
|
674
|
+
<optional>
|
675
|
+
<attribute name="valign">
|
676
|
+
<choice>
|
677
|
+
<value>top</value>
|
678
|
+
<value>middle</value>
|
679
|
+
<value>bottom</value>
|
680
|
+
<value>baseline</value>
|
681
|
+
</choice>
|
682
|
+
</attribute>
|
683
|
+
</optional>
|
667
684
|
<choice>
|
668
685
|
<zeroOrMore>
|
669
686
|
<choice>
|
@@ -700,6 +717,16 @@
|
|
700
717
|
</choice>
|
701
718
|
</attribute>
|
702
719
|
</optional>
|
720
|
+
<optional>
|
721
|
+
<attribute name="valign">
|
722
|
+
<choice>
|
723
|
+
<value>top</value>
|
724
|
+
<value>middle</value>
|
725
|
+
<value>bottom</value>
|
726
|
+
<value>baseline</value>
|
727
|
+
</choice>
|
728
|
+
</attribute>
|
729
|
+
</optional>
|
703
730
|
<choice>
|
704
731
|
<zeroOrMore>
|
705
732
|
<choice>
|
@@ -858,7 +885,7 @@
|
|
858
885
|
<oneOrMore>
|
859
886
|
<choice>
|
860
887
|
<ref name="content"/>
|
861
|
-
<ref name="
|
888
|
+
<ref name="abstract"/>
|
862
889
|
<ref name="foreword"/>
|
863
890
|
<ref name="introduction"/>
|
864
891
|
<ref name="acknowledgements"/>
|
@@ -1052,14 +1079,17 @@
|
|
1052
1079
|
<ref name="section-title"/>
|
1053
1080
|
</optional>
|
1054
1081
|
<group>
|
1055
|
-
<
|
1056
|
-
<
|
1057
|
-
<
|
1058
|
-
|
1059
|
-
|
1060
|
-
<
|
1061
|
-
|
1062
|
-
|
1082
|
+
<choice>
|
1083
|
+
<group>
|
1084
|
+
<zeroOrMore>
|
1085
|
+
<ref name="BasicBlock"/>
|
1086
|
+
</zeroOrMore>
|
1087
|
+
<zeroOrMore>
|
1088
|
+
<ref name="note"/>
|
1089
|
+
</zeroOrMore>
|
1090
|
+
</group>
|
1091
|
+
<ref name="amend"/>
|
1092
|
+
</choice>
|
1063
1093
|
<zeroOrMore>
|
1064
1094
|
<choice>
|
1065
1095
|
<ref name="clause-subsection"/>
|
@@ -1456,11 +1486,6 @@
|
|
1456
1486
|
</optional>
|
1457
1487
|
</element>
|
1458
1488
|
</define>
|
1459
|
-
<define name="preface_abstract">
|
1460
|
-
<element name="abstract">
|
1461
|
-
<ref name="Basic-Section"/>
|
1462
|
-
</element>
|
1463
|
-
</define>
|
1464
1489
|
<define name="term-clause">
|
1465
1490
|
<element name="clause">
|
1466
1491
|
<optional>
|
@@ -1510,4 +1535,79 @@
|
|
1510
1535
|
<ref name="CitationType"/>
|
1511
1536
|
</element>
|
1512
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1513
1613
|
</grammar>
|
@@ -10,7 +10,7 @@ module RelatonIho
|
|
10
10
|
# @return [RelatonIho::IhoBibliographicItem]
|
11
11
|
def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
12
12
|
warn "[relaton-iho] (\"#{text}\") fetching..."
|
13
|
-
ref = text.sub(/^IHO\s/, "").downcase
|
13
|
+
ref = text.sub(/^IHO\s/, "").downcase.sub /^([[:alpha:]]+)(\d+)/, '\1-\2'
|
14
14
|
uri = URI("#{ENDPOINT}#{ref}.yaml")
|
15
15
|
resp = Net::HTTP.get_response uri
|
16
16
|
return unless resp.code == "200"
|
@@ -21,7 +21,7 @@ module RelatonIho
|
|
21
21
|
item
|
22
22
|
rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
23
23
|
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
24
|
-
Net::ProtocolError, Net::ReadTimeout, OpenSSL::SSL::SSLError,
|
24
|
+
Net::ProtocolError, Net::ReadTimeout, # OpenSSL::SSL::SSLError,
|
25
25
|
Errno::ETIMEDOUT => e
|
26
26
|
raise RelatonBib::RequestError, "Could not access #{uri}: #{e.message}"
|
27
27
|
end
|
data/lib/relaton_iho/version.rb
CHANGED
data/relaton_iho.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
159
|
+
version: 1.4.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
166
|
+
version: 1.4.0
|
167
167
|
description: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
|
168
168
|
model'
|
169
169
|
email:
|