relaton-cie 1.16.1 → 1.17.0

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: 736da12c1c19f8a12b9dcf4b7ceed1fc8a2f30b25a43dc3ee745e6be4cb42f44
4
- data.tar.gz: fb84d6dbeea2788218efe2f7f6ed003be5b077bf507a756d73367b16218219d9
3
+ metadata.gz: 11878869c776cb0e77ce456b8f774fd549d45a1681ab05a1b18d0178d6ec9dc9
4
+ data.tar.gz: d6a0c2395217422c2c16de2313eba99818aae4792a280bb27e5abdd6d62ebdc8
5
5
  SHA512:
6
- metadata.gz: 17c841542d8ee4922923d7e741ed7b1e8abacf52be55234c24ad859190c81155402f1cf561901f603210a0f5f5aaaf2998c8926a5e04db6b2d71496be5d1164f
7
- data.tar.gz: cb10e7ede2db4f1dccc38e6ff13cfed5fa6876adae21e3e7602892c4a75c54aaf434d21f4f649d77dafc500c9eeb8921107c3be229321864c23ebfe05ea91475
6
+ metadata.gz: f3884f990e810108ef61152b8b7b178d5208f310d640aeec04bbd573327ec9cf28370e96842f427155e4d0e917d987074bfeeb5348cdfe43cce71965fbe8d7e6
7
+ data.tar.gz: 914aac83049568ca9ba66fbf496d8ea4688a263cc8e47418ea828bc2e822d08a03fac95c5aa80daae24460db6cc283ebf3f9b6faa9a0c9f67817a9f715f656a4
data/README.adoc CHANGED
@@ -29,23 +29,34 @@ Or install it yourself as:
29
29
 
30
30
  == Usage
31
31
 
32
- === Search document
32
+ === Configuration
33
+
34
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonCie.configure` block.
33
35
 
34
36
  [source,ruby]
35
37
  ----
36
38
  require 'relaton_cie'
37
39
  => true
38
40
 
41
+ RelatonCie.configure do |config|
42
+ config.logger.level = Logger::DEBUG
43
+ end
44
+ ----
45
+
46
+ === Search document
47
+
48
+ [source,ruby]
49
+ ----
39
50
  item = RelatonCie::CieBibliography.get 'CIE 001-1980'
40
- [relaton-cie] ("CIE 001-1980") fetching...
41
- [relaton-cie] ("CIE 001-1980") found CIE 001-1980
51
+ [relaton-cie] (CIE 001-1980) Fetching from Realton repository ...
52
+ [relaton-cie] (CIE 001-1980) Found: `CIE 001-1980`
42
53
  => #<RelatonBib::BibliographicItem:0x007fb3f6098920
43
54
  ...
44
55
 
45
56
  # Return nil if a document doesn't exist.
46
57
  RelatonCie::CieBibliography.get '1111'
47
- [relaton-cie] ("1111") fetching...
48
- [relaton-cie] WARNING no match found online for 1111. The code must be exactly like it is on the standards website.
58
+ [relaton-cie] (1111) Fetching from Realton repository ...
59
+ [relaton-cie] (1111) Not found.
49
60
  => nil
50
61
  ----
51
62
 
@@ -346,6 +346,8 @@
346
346
  <ref name="keyword"/>
347
347
  <ref name="xref"/>
348
348
  <ref name="hyperlink"/>
349
+ <ref name="index"/>
350
+ <ref name="index-xref"/>
349
351
  </choice>
350
352
  </oneOrMore>
351
353
  </element>
@@ -623,6 +625,8 @@
623
625
  <ref name="eref"/>
624
626
  <ref name="xref"/>
625
627
  <ref name="hyperlink"/>
628
+ <ref name="index"/>
629
+ <ref name="index-xref"/>
626
630
  </choice>
627
631
  </zeroOrMore>
628
632
  </element>
@@ -636,6 +640,8 @@
636
640
  <ref name="eref"/>
637
641
  <ref name="xref"/>
638
642
  <ref name="hyperlink"/>
643
+ <ref name="index"/>
644
+ <ref name="index-xref"/>
639
645
  </choice>
640
646
  </zeroOrMore>
641
647
  </element>
@@ -648,6 +654,8 @@
648
654
  <ref name="eref"/>
649
655
  <ref name="xref"/>
650
656
  <ref name="hyperlink"/>
657
+ <ref name="index"/>
658
+ <ref name="index-xref"/>
651
659
  </choice>
652
660
  </zeroOrMore>
653
661
  </element>
@@ -655,7 +663,11 @@
655
663
  <define name="keyword">
656
664
  <element name="keyword">
657
665
  <zeroOrMore>
658
- <ref name="PureTextElement"/>
666
+ <choice>
667
+ <ref name="PureTextElement"/>
668
+ <ref name="index"/>
669
+ <ref name="index-xref"/>
670
+ </choice>
659
671
  </zeroOrMore>
660
672
  </element>
661
673
  </define>
@@ -676,7 +688,11 @@
676
688
  <define name="strike">
677
689
  <element name="strike">
678
690
  <zeroOrMore>
679
- <ref name="PureTextElement"/>
691
+ <choice>
692
+ <ref name="PureTextElement"/>
693
+ <ref name="index"/>
694
+ <ref name="index-xref"/>
695
+ </choice>
680
696
  </zeroOrMore>
681
697
  </element>
682
698
  </define>
data/grammars/biblio.rng CHANGED
@@ -942,6 +942,7 @@
942
942
  <value>obsoleted</value>
943
943
  <value>confirmed</value>
944
944
  <value>updated</value>
945
+ <value>corrected</value>
945
946
  <value>issued</value>
946
947
  <value>transmitted</value>
947
948
  <value>copied</value>
@@ -15,13 +15,12 @@ module RelatonCie
15
15
  # @param opts [Hash] not used
16
16
  # @return [RelatonCie::BibliographicItem] Relaton of reference
17
17
  def get(code, _year = nil, _opts = {})
18
- Util.warn "(#{code}) fetching..."
18
+ Util.warn "(#{code}) Fetching from Relaton repository ..."
19
19
  result = search code
20
20
  if result
21
- Util.warn "(#{code}) found `#{result.docidentifier.first.id}`"
21
+ Util.warn "(#{code}) Found: `#{result.docidentifier.first.id}`"
22
22
  else
23
- Util.warn "(#{code}) WARNING no match found online for `#{code}`. " \
24
- "The code must be exactly like it is on the standards website."
23
+ Util.warn "(#{code}) Not found."
25
24
  end
26
25
  result
27
26
  end
@@ -160,6 +160,10 @@ module RelatonCie
160
160
  contribs << { entity: org, role: [{ type: "publisher" }] }
161
161
  end
162
162
 
163
+ def fetch_doctype
164
+ RelatonBib::DocumentType.new(type: "document")
165
+ end
166
+
163
167
  # @param bib [RelatonCie::BibliographicItem]
164
168
  def write_file(bib) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
165
169
  id = bib.docidentifier[0].id.gsub(%r{[/\s\-:.]}, "_")
@@ -191,7 +195,7 @@ module RelatonCie
191
195
  abstract: fetch_abstract(doc), date: fetch_date(doc),
192
196
  edition: fetch_edition(doc), contributor: fetch_contributor(doc),
193
197
  relation: fetch_relation(doc), language: ["en"], script: ["Latn"],
194
- doctype: "document"
198
+ doctype: fetch_doctype
195
199
  )
196
200
  write_file item
197
201
  rescue StandardError => e
@@ -1,11 +1,11 @@
1
1
  module RelatonCie
2
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- # @param item_hash [Hash]
5
- # @return [RelatonCie::BibliographicItem]
6
- def bib_item(item_hash)
7
- BibliographicItem.new(**item_hash)
8
- end
2
+ module HashConverter
3
+ include RelatonBib::HashConverter
4
+ extend self
5
+ # @param item_hash [Hash]
6
+ # @return [RelatonCie::BibliographicItem]
7
+ def bib_item(item_hash)
8
+ BibliographicItem.new(**item_hash)
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,6 @@
1
+ module RelatonCie
2
+ class NameParser < Parslet::Parser
3
+ root(:name)
4
+ rule(:name) { name_part.as(:name_part) >> (comma >> name_part).repeat }
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonCie
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.17.0".freeze
3
3
  end
data/relaton_cie.gemspec CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency "mechanize", "~> 2.8.0"
33
33
  spec.add_dependency "parslet", "~> 2.0.0"
34
- spec.add_dependency "relaton-bib", "~> 1.16.0"
34
+ spec.add_dependency "relaton-bib", "~> 1.17.0"
35
35
  spec.add_dependency "relaton-index", "~> 0.2.0"
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.16.0
47
+ version: 1.17.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.16.0
54
+ version: 1.17.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: relaton-index
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +98,7 @@ files:
98
98
  - lib/relaton_cie/config.rb
99
99
  - lib/relaton_cie/data_fetcher.rb
100
100
  - lib/relaton_cie/hash_converter.rb
101
+ - lib/relaton_cie/name_parser.rb
101
102
  - lib/relaton_cie/processor.rb
102
103
  - lib/relaton_cie/scrapper.rb
103
104
  - lib/relaton_cie/util.rb