relaton-bipm 1.16.6 → 1.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fed200c28077ec8e08f755b1185ec918797d15bf6937b884f207efd95837e230
4
- data.tar.gz: e252b80a27cf21e0fd9c66af2bec464eea8cc578b6da66b4c51316b707aa4b39
3
+ metadata.gz: 4d6ca7c2babd9a223b0ed3493818df34cee58241d4589edb19c640d28d2d473d
4
+ data.tar.gz: 42a2f2b7c16a9e06be43c0ddcfea027220a9bbcd4d9fe7aeed67b1fc579135c2
5
5
  SHA512:
6
- metadata.gz: 7d73f4d65055a47285532d0bcc0f812e58fa75a0790fc92a1e396d40b444732a84192e9f81467246552c61d0ae780a6449333186417f2a0154c756ae555e5097
7
- data.tar.gz: 7415e3f9f5bb4cacaa3e28f79b25a08a22814a6de7c52e5effd21f53632c59bcce41a6d4ef52a84169ad996efdd8e82687c7404f32cd22b199ee50a6cfbd77f8
6
+ metadata.gz: 4375e47c892a72b1f9c7a246d303fc2deb3334b42ca505121133246bdd59584338e12d4c8a6afcd791787267cd1c4574a145f72ede538cffcf87dab20b1d8d1b
7
+ data.tar.gz: b384da3f7d91958f0c1c8c8f4ef41e1f74cd2faa2a4e631684c93fdf2d9af8dd180cde2213d4a7e7a37bd99fce66c6f5e4a06e7e2fb30b2b4d6e33af8bcaf1c2
@@ -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>
@@ -2,10 +2,6 @@ module RelatonBipm
2
2
  class BipmBibliographicItem < RelatonBib::BibliographicItem
3
3
  include RelatonBib
4
4
 
5
- DOCTYPES = %w[brochure mise-en-pratique rapport monographie guide
6
- meeting-report technical-report working-party-note strategy
7
- cipm-mra resolutions].freeze
8
-
9
5
  STATUSES = %w[draft-proposal draft-development in-force retired].freeze
10
6
 
11
7
  SI_ASPECTS = %w[
@@ -69,7 +65,7 @@ module RelatonBipm
69
65
  si_aspect || comment_period ||
70
66
  structuredidentifier)
71
67
  ext = b.ext do
72
- b.doctype doctype if doctype
68
+ doctype&.to_xml b
73
69
  editorialgroup&.to_xml b
74
70
  comment_period&.to_xml b
75
71
  b.send :"si-aspect", si_aspect if si_aspect
@@ -159,7 +159,7 @@ module RelatonBipm
159
159
  args[:en]["resolutions"].each.with_index do |r, i| # rubocop:disable Metrics/BlockLength
160
160
  hash = {
161
161
  type: "proceedings", title: [],
162
- doctype: r["type"], place: [RelatonBib::Place.new(city: "Paris")]
162
+ doctype: DocumentType.new(type: r["type"]), place: [RelatonBib::Place.new(city: "Paris")]
163
163
  }
164
164
  fr_r = args[:fr]["resolutions"].fetch(i, nil)
165
165
  hash[:title] = resolution_title r, fr_r
@@ -385,7 +385,7 @@ module RelatonBipm
385
385
  #
386
386
  def meeting_bibitem(**args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
387
387
  docnum = create_meeting_docnum args[:body], args[:type], args[:num], args[:en]["date"]
388
- hash = { title: [], type: "proceedings", doctype: args[:type],
388
+ hash = { title: [], type: "proceedings", doctype: DocumentType.new(type: args[:type]),
389
389
  place: [RelatonBib::Place.new(city: "Paris")] }
390
390
  hash[:title] = create_titles args.slice(:en, :fr)
391
391
  hash[:date] = [{ type: "published", on: args[:en]["date"] }]
@@ -0,0 +1,29 @@
1
+ module RelatonBipm
2
+ class DocumentType < RelatonBib::DocumentType
3
+ DOCTYPES = %w[brochure mise-en-pratique rapport monographie guide
4
+ meeting-report technical-report working-party-note strategy
5
+ cipm-mra resolutions].freeze
6
+
7
+ #
8
+ # Initialize a document type object.
9
+ #
10
+ # @param [String] type document type
11
+ # @param [String, nil] abbreviation abbreviation
12
+ #
13
+ def initialize(type:, abbreviation: nil)
14
+ check_type type
15
+ super
16
+ end
17
+
18
+ #
19
+ # Check if document type is valid.
20
+ #
21
+ # @param [String] type document type
22
+ #
23
+ def check_type(type)
24
+ # unless DOCTYPES.include? type
25
+ # Util.warn "WARNING: invalid doctype: `#{type}`"
26
+ # end
27
+ end
28
+ end
29
+ end
@@ -1,105 +1,110 @@
1
1
  require "yaml"
2
2
 
3
3
  module RelatonBipm
4
- class HashConverter < RelatonBib::HashConverter
4
+ module HashConverter
5
+ include RelatonBib::HashConverter
6
+ extend self
7
+
5
8
  @@acronyms = nil
6
9
 
7
- class << self
8
- # @override RelatonIsoBib::HashConverter.hash_to_bib
9
- # @param args [Hash]
10
- # @param nested [TrueClass, FalseClass]
11
- # @return [Hash]
12
- def hash_to_bib(args)
13
- ret = super
14
- return if ret.nil?
15
-
16
- # project_group_hash_to_bib ret
17
- commentperiod_hash_to_bib ret
18
- ret
19
- end
10
+ # @override RelatonIsoBib::HashConverter.hash_to_bib
11
+ # @param args [Hash]
12
+ # @param nested [TrueClass, FalseClass]
13
+ # @return [Hash]
14
+ def hash_to_bib(args)
15
+ ret = super
16
+ return if ret.nil?
20
17
 
21
- private
18
+ # project_group_hash_to_bib ret
19
+ commentperiod_hash_to_bib ret
20
+ ret
21
+ end
22
22
 
23
- # @param item_hash [Hash]
24
- # @return [RelatonBib::BibliographicItem]
25
- def bib_item(item_hash)
26
- BipmBibliographicItem.new(**item_hash)
27
- end
23
+ private
28
24
 
29
- # @param ret [Hash]
30
- def title_hash_to_bib(ret)
31
- ret[:title] &&= RelatonBib.array(ret[:title])
32
- .reduce(RelatonBib::TypedTitleStringCollection.new) do |m, t|
33
- m << if t.is_a? Hash
34
- RelatonBib::TypedTitleString.new(**t)
35
- else
36
- RelatonBib::TypedTitleString.new(content: t)
37
- end
38
- end
39
- end
25
+ # @param item_hash [Hash]
26
+ # @return [RelatonBib::BibliographicItem]
27
+ def bib_item(item_hash)
28
+ BipmBibliographicItem.new(**item_hash)
29
+ end
40
30
 
41
- # @param ret [Hash]
42
- def commentperiod_hash_to_bib(ret)
43
- ret[:comment_period] &&= CommentPeriond.new(**ret[:comment_period])
31
+ # @param ret [Hash]
32
+ def title_hash_to_bib(ret)
33
+ ret[:title] &&= RelatonBib.array(ret[:title])
34
+ .reduce(RelatonBib::TypedTitleStringCollection.new) do |m, t|
35
+ m << if t.is_a? Hash
36
+ RelatonBib::TypedTitleString.new(**t)
37
+ else
38
+ RelatonBib::TypedTitleString.new(content: t)
39
+ end
44
40
  end
41
+ end
45
42
 
46
- # @param ret [Hash]
47
- # def project_group_hash_to_bib(ret)
48
- # ret[:project_group] &&= RelatonBib.array(ret[:project_group]).map do |pg|
49
- # wg = RelatonBib::FormattedString.new pg[:workgroup]
50
- # ProjectTeam.new(committee: pg[:committee], workgroup: wg)
51
- # end
52
- # end
53
-
54
- # @param ret [Hash]
55
- def dates_hash_to_bib(ret)
56
- super
57
- ret[:date] &&= ret[:date].map { |d| BibliographicDate.new(**d) }
58
- end
43
+ # @param ret [Hash]
44
+ def commentperiod_hash_to_bib(ret)
45
+ ret[:comment_period] &&= CommentPeriond.new(**ret[:comment_period])
46
+ end
59
47
 
60
- # @param ret [Hash]
61
- def relations_hash_to_bib(ret)
62
- super
63
- ret[:relation] &&= ret[:relation].map do |r|
64
- RelatonBipm::DocumentRelation.new(**r)
65
- end
66
- end
48
+ # @param ret [Hash]
49
+ # def project_group_hash_to_bib(ret)
50
+ # ret[:project_group] &&= RelatonBib.array(ret[:project_group]).map do |pg|
51
+ # wg = RelatonBib::FormattedString.new pg[:workgroup]
52
+ # ProjectTeam.new(committee: pg[:committee], workgroup: wg)
53
+ # end
54
+ # end
67
55
 
68
- # @param ret [Hash]
69
- def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
70
- return unless ret[:editorialgroup]
71
-
72
- cmt = ret[:editorialgroup][:committee].map do |c|
73
- if (vars = committee_variants c).any?
74
- content = RelatonBib::LocalizedString.new vars
75
- Committee.new acronym: c[:acronym], content: content
76
- else
77
- Committee.new(**c)
78
- end
79
- end
80
- wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
81
- w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
82
- end
83
- ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
56
+ # @param ret [Hash]
57
+ def dates_hash_to_bib(ret)
58
+ super
59
+ ret[:date] &&= ret[:date].map { |d| BibliographicDate.new(**d) }
60
+ end
61
+
62
+ # @param ret [Hash]
63
+ def relations_hash_to_bib(ret)
64
+ super
65
+ ret[:relation] &&= ret[:relation].map do |r|
66
+ RelatonBipm::DocumentRelation.new(**r)
84
67
  end
68
+ end
85
69
 
86
- def committee_variants(cmt)
87
- RelatonBib.array(cmt[:variants]).each_with_object([]) do |v, a|
88
- c = v[:content] || (ac = acronyms[cmt[:acronym]]) && ac[v[:language]]
89
- a << RelatonBib::LocalizedString.new(c, v[:language], v[:script]) if c
70
+ # @param ret [Hash]
71
+ def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
72
+ return unless ret[:editorialgroup]
73
+
74
+ cmt = ret[:editorialgroup][:committee].map do |c|
75
+ if (vars = committee_variants c).any?
76
+ content = RelatonBib::LocalizedString.new vars
77
+ Committee.new acronym: c[:acronym], content: content
78
+ else
79
+ Committee.new(**c)
90
80
  end
91
81
  end
92
-
93
- def acronyms
94
- @@acronyms ||= YAML.load_file File.join __dir__, "acronyms.yaml"
82
+ wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
83
+ w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
95
84
  end
85
+ ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
86
+ end
96
87
 
97
- # @param ret [Hash]
98
- def structuredidentifier_hash_to_bib(ret)
99
- ret[:structuredidentifier] &&= StructuredIdentifier.new(
100
- **ret[:structuredidentifier],
101
- )
88
+ def committee_variants(cmt)
89
+ RelatonBib.array(cmt[:variants]).each_with_object([]) do |v, a|
90
+ c = v[:content] || (ac = acronyms[cmt[:acronym]]) && ac[v[:language]]
91
+ a << RelatonBib::LocalizedString.new(c, v[:language], v[:script]) if c
102
92
  end
103
93
  end
94
+
95
+ def acronyms
96
+ @@acronyms ||= YAML.load_file File.join __dir__, "acronyms.yaml"
97
+ end
98
+
99
+ # @param ret [Hash]
100
+ def structuredidentifier_hash_to_bib(ret)
101
+ ret[:structuredidentifier] &&= StructuredIdentifier.new(
102
+ **ret[:structuredidentifier],
103
+ )
104
+ end
105
+
106
+ def create_doctype(**args)
107
+ DocumentType.new(**args)
108
+ end
104
109
  end
105
110
  end
@@ -316,7 +316,9 @@ module RelatonBipm
316
316
  "article"
317
317
  end
318
318
 
319
- alias_method :parse_doctype, :parse_type
319
+ def parse_doctype
320
+ DocumentType.new type: "article"
321
+ end
320
322
  end
321
323
  end
322
324
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.16.6".freeze
2
+ VERSION = "1.17.0".freeze
3
3
  end
data/lib/relaton_bipm.rb CHANGED
@@ -7,6 +7,7 @@ require "relaton_bipm/config"
7
7
  require "relaton_bipm/util"
8
8
  require "relaton_bipm/id_parser"
9
9
  require "relaton_bipm/version"
10
+ require "relaton_bipm/document_type"
10
11
  require "relaton_bipm/editorial_group"
11
12
  require "relaton_bipm/committee"
12
13
  require "relaton_bipm/workgroup"
data/relaton_bipm.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
35
35
  spec.add_dependency "faraday", "~> 2.7.0"
36
36
  spec.add_dependency "mechanize", "~> 2.8.0"
37
37
  spec.add_dependency "parslet", "~> 2.0.0"
38
- spec.add_dependency "relaton-bib", "~> 1.16.0"
38
+ spec.add_dependency "relaton-bib", "~> 1.17.0"
39
39
  spec.add_dependency "relaton-index", "~> 0.2.2"
40
40
  spec.add_dependency "rubyzip", "~> 2.3.0"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.6
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-11-12 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: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.16.0
61
+ version: 1.17.0
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: 1.16.0
68
+ version: 1.17.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: relaton-index
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -131,6 +131,7 @@ files:
131
131
  - lib/relaton_bipm/data_fetcher.rb
132
132
  - lib/relaton_bipm/data_outcomes_parser.rb
133
133
  - lib/relaton_bipm/document_relation.rb
134
+ - lib/relaton_bipm/document_type.rb
134
135
  - lib/relaton_bipm/editorial_group.rb
135
136
  - lib/relaton_bipm/hash_converter.rb
136
137
  - lib/relaton_bipm/id_parser.rb