relaton-ogc 1.2.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87083ec001e4455f32f366ae2abae1d363fa04a5ebd2e934d0972170cb30e8a1
4
- data.tar.gz: 3e2cdc145e63b059b60ff7e4d6f3826646dae21b2bf833f4786e050bd810b35f
3
+ metadata.gz: 522ba1924795803f2950a72cb2dada90bf6b74a263683bc11e719c974c3ce4f7
4
+ data.tar.gz: 0513d3f18b61a538d866ddeea0536224effc9a7883ec0d840b84b512b1f27efc
5
5
  SHA512:
6
- metadata.gz: 9f3b7f2759e1759915979279b9490dc6039950abacb5c1e0862dd8c0dd81d1a45e4e4373ba6c1819658cf326ae8b574501ae037866bf5921cb1144a9802d1cf0
7
- data.tar.gz: be6f7d638a6421e6c287496828723c13996c494938b2bb8050c5799b615fe290bd851e1c1f82046112df54544ec19839e03b1b74d463729540fbc934d6be7224
6
+ metadata.gz: d38dfb0d2cb57c4c64a5cc48ef563687493d2484831dc9cfba7dab9169319d4e4081c9e842e4efed254f694601dc483aba55d4bc86e78d83cd208409cd871e68
7
+ data.tar.gz: 4b6f6b79ad13ca89c2207139a078387b7c3dd30b6da158208f3eb65e7b3e641639063e2709e353d4e0be7413e8a3fc1fa9f05f5d897a5302f8c7cb0b418895a8
@@ -26,6 +26,8 @@ jobs:
26
26
  - name: Update gems
27
27
  run: |
28
28
  sudo gem install bundler --force
29
+ ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
30
+ ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
29
31
  bundle install --jobs 4 --retry 3
30
32
  - name: Run specs
31
33
  run: |
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -18,7 +18,7 @@ Add this line to your application's Gemfile:
18
18
 
19
19
  [source,ruby]
20
20
  ----
21
- gem 'relaton_ogc'
21
+ gem 'relaton-ogc'
22
22
  ----
23
23
 
24
24
  And then execute:
@@ -27,7 +27,7 @@ And then execute:
27
27
 
28
28
  Or install it yourself as:
29
29
 
30
- $ gem install relaton_ogc
30
+ $ gem install relaton-ogc
31
31
 
32
32
  == Usage
33
33
 
@@ -35,8 +35,11 @@ Or install it yourself as:
35
35
 
36
36
  [source,ruby]
37
37
  ----
38
+ require 'relaton_ogc'
39
+ => true
40
+
38
41
  hits = RelatonOgc::OgcBibliography.search("OGC 19-025r1")
39
- => [<RelatonOgc::Hit:0x007fcab6b9aab8 @text="OGC 19-025r1" @fetched="false" @fullIdentifier="" @title="">]
42
+ => <RelatonOgc::HitCollection:0x007fcc8e085ba8 @ref=OGC 19-025r1 @fetched=false>
40
43
 
41
44
  tem = hits[0].fetch
42
45
  => #<RelatonOgc::OgcBibliographicItem:0x007fcab3cb4758
@@ -72,7 +75,10 @@ item.to_xml bibdata: true
72
75
  </date>
73
76
  ...
74
77
  <ext>
75
- <doctype>public-engineering-report</doctype>
78
+ <doctype>engineering-report</doctype>
79
+ <editorialgroup>
80
+ <committee>technical</committee>
81
+ </editorialgroup>
76
82
  </ext>
77
83
  </bibdata>"
78
84
  ----
@@ -81,7 +87,8 @@ item.to_xml bibdata: true
81
87
  [source,ruby]
82
88
  ----
83
89
  RelatonOgc::OgcBibliography.get "OGC 19-025r1", "2019", {}
84
- fetching OGC 19-025r1...
90
+ [relaton-ogc] ("OGC 19-025r1") fetching...
91
+ [relaton-ogc] ("OGC 19-025r1") found 19-025r1
85
92
  => #<RelatonOgc::OgcBibliographicItem:0x007fc322e9aba0
86
93
  ...
87
94
  ----
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -922,6 +958,9 @@
922
958
  <optional>
923
959
  <attribute name="script"/>
924
960
  </optional>
961
+ <optional>
962
+ <attribute name="type"/>
963
+ </optional>
925
964
  <optional>
926
965
  <attribute name="obligation">
927
966
  <choice>
@@ -961,9 +1000,6 @@
961
1000
  </define>
962
1001
  <define name="content-subsection">
963
1002
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
1003
  <ref name="Content-Section"/>
968
1004
  </element>
969
1005
  </define>
@@ -992,6 +1028,9 @@
992
1028
  </choice>
993
1029
  </attribute>
994
1030
  </optional>
1031
+ <optional>
1032
+ <attribute name="type"/>
1033
+ </optional>
995
1034
  <optional>
996
1035
  <ref name="section-title"/>
997
1036
  </optional>
@@ -1011,9 +1050,6 @@
1011
1050
  </define>
1012
1051
  <define name="clause">
1013
1052
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1053
  <ref name="Clause-Section"/>
1018
1054
  </element>
1019
1055
  </define>
@@ -1042,18 +1078,24 @@
1042
1078
  </choice>
1043
1079
  </attribute>
1044
1080
  </optional>
1081
+ <optional>
1082
+ <attribute name="type"/>
1083
+ </optional>
1045
1084
  <optional>
1046
1085
  <ref name="section-title"/>
1047
1086
  </optional>
1048
1087
  <group>
1049
- <group>
1050
- <zeroOrMore>
1051
- <ref name="BasicBlock"/>
1052
- </zeroOrMore>
1053
- <zeroOrMore>
1054
- <ref name="note"/>
1055
- </zeroOrMore>
1056
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1057
1099
  <zeroOrMore>
1058
1100
  <choice>
1059
1101
  <ref name="clause-subsection"/>
@@ -1180,6 +1222,9 @@
1180
1222
  <optional>
1181
1223
  <attribute name="script"/>
1182
1224
  </optional>
1225
+ <optional>
1226
+ <attribute name="type"/>
1227
+ </optional>
1183
1228
  <optional>
1184
1229
  <attribute name="obligation">
1185
1230
  <choice>
@@ -1447,11 +1492,6 @@
1447
1492
  </optional>
1448
1493
  </element>
1449
1494
  </define>
1450
- <define name="preface_abstract">
1451
- <element name="abstract">
1452
- <ref name="Basic-Section"/>
1453
- </element>
1454
- </define>
1455
1495
  <define name="term-clause">
1456
1496
  <element name="clause">
1457
1497
  <optional>
@@ -1501,4 +1541,79 @@
1501
1541
  <ref name="CitationType"/>
1502
1542
  </element>
1503
1543
  </define>
1544
+ <define name="amend">
1545
+ <element name="amend">
1546
+ <optional>
1547
+ <attribute name="id">
1548
+ <data type="ID"/>
1549
+ </attribute>
1550
+ </optional>
1551
+ <attribute name="change">
1552
+ <choice>
1553
+ <value>add</value>
1554
+ <value>modify</value>
1555
+ <value>delete</value>
1556
+ </choice>
1557
+ </attribute>
1558
+ <optional>
1559
+ <attribute name="path"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <attribute name="path_end"/>
1563
+ </optional>
1564
+ <optional>
1565
+ <attribute name="title"/>
1566
+ </optional>
1567
+ <optional>
1568
+ <element name="location">
1569
+ <zeroOrMore>
1570
+ <ref name="locality"/>
1571
+ </zeroOrMore>
1572
+ </element>
1573
+ </optional>
1574
+ <zeroOrMore>
1575
+ <ref name="autonumber"/>
1576
+ </zeroOrMore>
1577
+ <optional>
1578
+ <element name="description">
1579
+ <zeroOrMore>
1580
+ <ref name="BasicBlock"/>
1581
+ </zeroOrMore>
1582
+ </element>
1583
+ </optional>
1584
+ <optional>
1585
+ <element name="newcontent">
1586
+ <zeroOrMore>
1587
+ <ref name="BasicBlock"/>
1588
+ </zeroOrMore>
1589
+ </element>
1590
+ </optional>
1591
+ <optional>
1592
+ <element name="description">
1593
+ <zeroOrMore>
1594
+ <ref name="BasicBlock"/>
1595
+ </zeroOrMore>
1596
+ </element>
1597
+ </optional>
1598
+ </element>
1599
+ </define>
1600
+ <define name="autonumber">
1601
+ <element name="autonumber">
1602
+ <attribute name="type">
1603
+ <choice>
1604
+ <value>requirement</value>
1605
+ <value>recommendation</value>
1606
+ <value>permission</value>
1607
+ <value>table</value>
1608
+ <value>figure</value>
1609
+ <value>admonition</value>
1610
+ <value>formula</value>
1611
+ <value>sourcecode</value>
1612
+ <value>example</value>
1613
+ <value>note</value>
1614
+ </choice>
1615
+ </attribute>
1616
+ <text/>
1617
+ </element>
1618
+ </define>
1504
1619
  </grammar>
@@ -54,7 +54,7 @@
54
54
  <define name="preface">
55
55
  <element name="preface">
56
56
  <optional>
57
- <ref name="preface_abstract"/>
57
+ <ref name="abstract"/>
58
58
  </optional>
59
59
  <ref name="foreword"/>
60
60
  <optional>
@@ -104,6 +104,13 @@
104
104
  </define>
105
105
  <define name="ogc-standard">
106
106
  <element name="ogc-standard">
107
+ <attribute name="version"/>
108
+ <attribute name="type">
109
+ <choice>
110
+ <value>semantic</value>
111
+ <value>presentation</value>
112
+ </choice>
113
+ </attribute>
107
114
  <ref name="bibdata"/>
108
115
  <zeroOrMore>
109
116
  <ref name="termdocsource"/>
@@ -35,6 +35,11 @@ module RelatonOgc
35
35
  @workgroup = subgroup args[:workgroup]
36
36
  end
37
37
 
38
+ # @return [true]
39
+ def presence?
40
+ true
41
+ end
42
+
38
43
  # @param builder [Nokogiri::XML::Builder]
39
44
  def to_xml(builder)
40
45
  builder.editorialgroup do
@@ -52,6 +57,17 @@ module RelatonOgc
52
57
  hash
53
58
  end
54
59
 
60
+ # @param prefix [String]
61
+ # @return [String]
62
+ def to_asciibib(prefix)
63
+ pref = prefix.empty? ? prefix : prefix + "."
64
+ pref += "editorialgroup"
65
+ out = "#{pref}.committee:: #{committee}\n"
66
+ out += subcommittee.to_asciibib "#{pref}.subcommittee" if subcommittee
67
+ out += workgroup.to_asciibib "#{pref}.workgroup" if workgroup
68
+ out
69
+ end
70
+
55
71
  private
56
72
 
57
73
  # @param group [Hash, RelatonIsoBib::IsoSubgroup]
@@ -12,7 +12,7 @@ module RelatonOgc
12
12
  committee: eg[:committee],
13
13
  subcommittee: eg[:subcommittee],
14
14
  workgroup: eg[:workgroup],
15
- secretariat: eg[:secretariat],
15
+ secretariat: eg[:secretariat]
16
16
  )
17
17
  end
18
18
  end
@@ -52,10 +52,13 @@ module RelatonOgc
52
52
  #
53
53
  # fetch data form server and save it to file.
54
54
  #
55
- def fetch_data
55
+ def fetch_data # rubocop:disable Metrics/AbcSize
56
56
  resp = Faraday.new(ENDPOINT, headers: { "If-None-Match" => etag }).get
57
57
  # return if there aren't any changes since last fetching
58
- raise RelatonBib::RequestError, "Could not access #{ENDPOINT}" unless resp.status == 200
58
+ return if resp.status == 304
59
+ unless resp.status == 200
60
+ raise RelatonBib::RequestError, "Could not access #{ENDPOINT}"
61
+ end
59
62
 
60
63
  FileUtils.mkdir_p DATADIR unless Dir.exist? DATADIR
61
64
  self.etag = resp[:etag]
@@ -20,12 +20,13 @@ module RelatonOgc
20
20
  # @param docsubtype [String]
21
21
  def initialize(**args)
22
22
  if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype])
23
- warn "[relaton-ogc] WARNING: invalid document subtype: #{args[:docsubtype]}"
23
+ warn "[relaton-ogc] WARNING: invalid document "\
24
+ "subtype: #{args[:docsubtype]}"
24
25
  end
25
26
 
26
27
  @docsubtype = args.delete :docsubtype
28
+ # @doctype = args.delete :doctype
27
29
  super
28
- # @doctype = args[:doctype]
29
30
  end
30
31
 
31
32
  # @return [Hash]
@@ -35,11 +36,14 @@ module RelatonOgc
35
36
  hash
36
37
  end
37
38
 
38
- # @param builder [Nokogiri::XML::Builder]
39
39
  # @param opts [Hash]
40
+ # @option opts [Nokogiri::XML::Builder] :builder XML builder
40
41
  # @option opts [Boolean] :bibdata
41
- def to_xml(builder = nil, **opts)
42
- super do |b|
42
+ # @option opts [Symbol, NilClass] :date_format (:short), :full
43
+ # @option opts [String, Symbol] :lang language
44
+ # @return [String] XML
45
+ def to_xml(**opts)
46
+ super **opts do |b|
43
47
  b.ext do
44
48
  b.doctype doctype if doctype
45
49
  b.docsubtype docsubtype if docsubtype
@@ -48,5 +52,14 @@ module RelatonOgc
48
52
  end
49
53
  end
50
54
  end
55
+
56
+ # @param prefix [String]
57
+ # @return [String]
58
+ def to_asciibib(prefix = "")
59
+ pref = prefix.empty? ? prefix : prefix + "."
60
+ out = super
61
+ out += "#{pref}docsubtype:: #{docsubtype}\n" if docsubtype
62
+ out
63
+ end
51
64
  end
52
65
  end
@@ -3,10 +3,10 @@ module RelatonOgc
3
3
  class << self
4
4
  # @param text [String]
5
5
  # @return [RelatonOgc::HitCollection]
6
- def search(text, year = nil, opts = {})
6
+ def search(text, year = nil, _opts = {})
7
7
  HitCollection.new text, year
8
8
  rescue Faraday::ConnectionFailed
9
- raise RelatonBib::RequestError, "Could not access https://www.nist.gov"
9
+ raise RelatonBib::RequestError, HitCollection::ENDPOINT
10
10
  end
11
11
 
12
12
  # @param code [String] the OGC standard Code to look up (e..g "8200")
@@ -1,3 +1,3 @@
1
1
  module RelatonOgc
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.5.1".freeze
3
3
  end
@@ -3,19 +3,6 @@ require "nokogiri"
3
3
  module RelatonOgc
4
4
  class XMLParser < RelatonIsoBib::XMLParser
5
5
  class << self
6
- # Override RelatonIsoBib::XMLParser.form_xml method.
7
- # @param xml [String]
8
- # @return [RelatonOgc::OgcBibliographicItem]
9
- # def from_xml(xml)
10
- # doc = Nokogiri::XML(xml)
11
- # item = doc.at "/bibitem|/bibdata"
12
- # if item
13
- # OgcBibliographicItem.new item_data(item)
14
- # else
15
- # warn "[relaton-ogc] can't find bibitem or bibdata element in the XML"
16
- # end
17
- # end
18
-
19
6
  private
20
7
 
21
8
  # override RelatonIsoBib::IsoBibliographicItem.bib_item method
@@ -48,7 +35,7 @@ module RelatonOgc
48
35
  sc = iso_subgroup eg&.at("subcommittee")
49
36
  wg = iso_subgroup eg&.at("workgroup")
50
37
  EditorialGroup.new(
51
- committee: committe, subcommittee: sc, workgroup: wg,
38
+ committee: committe, subcommittee: sc, workgroup: wg
52
39
  )
53
40
  end
54
41
  end
@@ -36,5 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "webmock"
37
37
 
38
38
  spec.add_dependency "faraday", "~> 1.0.0"
39
- spec.add_dependency "relaton-iso-bib", "~> 1.2.0"
39
+ spec.add_dependency "relaton-iso-bib", "~> 1.5.0"
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.2.0
173
+ version: 1.5.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.2.0
180
+ version: 1.5.0
181
181
  description: 'RelatonOgc: retrieve OGC Standards for bibliographic use using the OgcBibliographicItem
182
182
  model'
183
183
  email:
@@ -219,7 +219,7 @@ homepage: https://github.com/relaton/relaton-ogc
219
219
  licenses:
220
220
  - BSD-2-Clause
221
221
  metadata: {}
222
- post_install_message:
222
+ post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths:
225
225
  - lib
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  requirements: []
237
237
  rubygems_version: 3.0.6
238
- signing_key:
238
+ signing_key:
239
239
  specification_version: 4
240
240
  summary: 'RelatonOgc: retrieve OGC Standards for bibliographic use using the OgcBibliographicItem
241
241
  model'