relaton-iec 1.7.8 → 1.8.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 +12 -0
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +4 -6
- data/grammars/iec.rng +92 -1
- data/grammars/isodoc.rng +460 -6
- data/grammars/isostandard.rng +42 -104
- data/grammars/reqt.rng +31 -2
- data/lib/relaton_iec/basic_block/alignment.rb +30 -0
- data/lib/relaton_iec/basic_block/basic_block.rb +15 -0
- data/lib/relaton_iec/basic_block/citation_type.rb +32 -0
- data/lib/relaton_iec/basic_block/dl.rb +60 -0
- data/lib/relaton_iec/basic_block/eref.rb +10 -0
- data/lib/relaton_iec/basic_block/eref_type.rb +39 -0
- data/lib/relaton_iec/basic_block/formula.rb +34 -0
- data/lib/relaton_iec/basic_block/image.rb +41 -0
- data/lib/relaton_iec/basic_block/index.rb +27 -0
- data/lib/relaton_iec/basic_block/index_xref.rb +31 -0
- data/lib/relaton_iec/basic_block/note.rb +21 -0
- data/lib/relaton_iec/basic_block/paragraph.rb +27 -0
- data/lib/relaton_iec/basic_block/paragraph_with_footnote.rb +29 -0
- data/lib/relaton_iec/basic_block/reference_format.rb +38 -0
- data/lib/relaton_iec/basic_block/stem.rb +30 -0
- data/lib/relaton_iec/basic_block/table.rb +115 -0
- data/lib/relaton_iec/basic_block/text_element.rb +27 -0
- data/lib/relaton_iec/hit_collection.rb +1 -1
- data/lib/relaton_iec/iec_bibliographic_item.rb +85 -0
- data/lib/relaton_iec/tc_sc_officers_note.rb +24 -0
- data/lib/relaton_iec/version.rb +1 -1
- data/lib/relaton_iec/xml_parser.rb +20 -0
- data/relaton_iec.gemspec +1 -1
- metadata +22 -4
@@ -6,11 +6,96 @@ module RelatonIec
|
|
6
6
|
guide
|
7
7
|
].freeze
|
8
8
|
|
9
|
+
FUNCTION = %w[emc safety enviroment quality-assurance].freeze
|
10
|
+
|
11
|
+
# @return [String, nil]
|
12
|
+
attr_reader :function, :updates_document_type, :price_code, :secretary,
|
13
|
+
:interest_to_committees
|
14
|
+
|
15
|
+
# @return [Boolean, nil]
|
16
|
+
attr_reader :accessibility_color_inside, :cen_processing
|
17
|
+
|
18
|
+
# attr_reader :tc_sc_officers_note
|
19
|
+
|
20
|
+
def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
21
|
+
if args[:function] && !FUNCTION.include?(args[:function])
|
22
|
+
warn "[relaton-iec] WARNING: invalid function \"#{args[:function]}\""
|
23
|
+
warn "[relaton-iec] allowed function values are: #{FUNCTION.join(', ')}"
|
24
|
+
end
|
25
|
+
if args[:updates_document_type] &&
|
26
|
+
!TYPES.include?(args[:updates_document_type])
|
27
|
+
warn "[relaton-iec] WARNING: invalid updates_document_type "\
|
28
|
+
"\"#{args[:updates_document_type]}\""
|
29
|
+
warn "[relaton-iec] allowed updates_document_type values are: "\
|
30
|
+
"#{TYPES.join(', ')}"
|
31
|
+
end
|
32
|
+
@function = args.delete :function
|
33
|
+
@updates_document_type = args.delete :updates_document_type
|
34
|
+
@accessibility_color_inside = args.delete :accessibility_color_inside
|
35
|
+
@price_code = args.delete :price_code
|
36
|
+
@cen_processing = args.delete :cen_processing
|
37
|
+
@secretary = args.delete :secretary
|
38
|
+
@interest_to_committees = args.delete :interest_to_committees
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
9
42
|
# @param hash [Hash]
|
10
43
|
# @return [RelatonIsoBib::IecBibliographicItem]
|
11
44
|
def self.from_hash(hash)
|
12
45
|
item_hash = ::RelatonIec::HashConverter.hash_to_bib(hash)
|
13
46
|
new **item_hash
|
14
47
|
end
|
48
|
+
|
49
|
+
# @param opts [Hash]
|
50
|
+
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
51
|
+
# @option opts [Boolean] :bibdata
|
52
|
+
# @option opts [String] :lang language
|
53
|
+
# @return [String] XML
|
54
|
+
def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
55
|
+
super **opts do |b|
|
56
|
+
if opts[:bibdata]
|
57
|
+
b.ext do
|
58
|
+
b.doctype doctype if doctype
|
59
|
+
b.horizontal horizontal unless horizontal.nil?
|
60
|
+
b.function function if function
|
61
|
+
editorialgroup&.to_xml b
|
62
|
+
ics.each { |i| i.to_xml b }
|
63
|
+
structuredidentifier&.to_xml b
|
64
|
+
b.stagename stagename if stagename
|
65
|
+
if updates_document_type
|
66
|
+
b.send("updates-document-type", updates_document_type)
|
67
|
+
end
|
68
|
+
unless accessibility_color_inside.nil?
|
69
|
+
b.send("accessibility-color-inside", accessibility_color_inside)
|
70
|
+
end
|
71
|
+
b.send("price-code", price_code) if price_code
|
72
|
+
b.send("cen-processing", cen_processing) unless cen_processing.nil?
|
73
|
+
b.secretary secretary if secretary
|
74
|
+
if interest_to_committees
|
75
|
+
b.send("interest-to-committees", interest_to_committees)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [Hash]
|
83
|
+
def to_hash # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
84
|
+
hash = super
|
85
|
+
hash["function"] = function if function
|
86
|
+
if updates_document_type
|
87
|
+
hash["updates_document_type"] = updates_document_type
|
88
|
+
end
|
89
|
+
unless accessibility_color_inside.nil?
|
90
|
+
hash["accessibility_color_inside"] = accessibility_color_inside
|
91
|
+
end
|
92
|
+
hash["price_code"] = price_code if price_code
|
93
|
+
hash["cen_processing"] = cen_processing unless cen_processing.nil?
|
94
|
+
hash["secretary"] = secretary if secretary
|
95
|
+
if interest_to_committees
|
96
|
+
hash["interest_to_committees"] = interest_to_committees
|
97
|
+
end
|
98
|
+
hash
|
99
|
+
end
|
15
100
|
end
|
16
101
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RelatonIec
|
2
|
+
class TcScOfficersNote
|
3
|
+
# @return [Array<RelatonIec::BasicBlock>]
|
4
|
+
attr_reader :basic_blocks
|
5
|
+
|
6
|
+
#
|
7
|
+
# @param [Array<BasicBlock::ParagraphWithFootnote>] basic_blocks
|
8
|
+
#
|
9
|
+
def initialize(basic_blocks)
|
10
|
+
@basic_blocks = basic_blocks
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# XML serialization
|
15
|
+
#
|
16
|
+
# @param [Nokogiri::XML::Builder] builder
|
17
|
+
#
|
18
|
+
def to_xml(builder)
|
19
|
+
builder.send "tc-sc-officers-note" do |b|
|
20
|
+
basic_blocks.each { |bb| bb.to_xml b }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/relaton_iec/version.rb
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
module RelatonIec
|
2
2
|
class XMLParser < RelatonIsoBib::XMLParser
|
3
3
|
class << self
|
4
|
+
# Override RelatonIsoBib::XMLParser.item_data method.
|
5
|
+
# @param isoitem [Nokogiri::XML::Element]
|
6
|
+
# @returtn [Hash]
|
7
|
+
def item_data(isoitem) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
8
|
+
data = super
|
9
|
+
ext = isoitem.at "./ext"
|
10
|
+
return data unless ext
|
11
|
+
|
12
|
+
data[:function] = ext.at("./function")&.text
|
13
|
+
data[:updates_document_type] = ext.at("./updates-document-type")&.text
|
14
|
+
aci = ext.at("./accessibility-color-inside")
|
15
|
+
data[:accessibility_color_inside] = aci.text == "true" if aci
|
16
|
+
data[:price_code] = ext.at("./price-code")&.text
|
17
|
+
cp = ext.at("./cen-processing")
|
18
|
+
data[:cen_processing] = cp.text == "true" if cp
|
19
|
+
data[:secretary] = ext.at("./secretary")&.text
|
20
|
+
data[:interest_to_committees] = ext.at("./interest-to-committees")&.text
|
21
|
+
data
|
22
|
+
end
|
23
|
+
|
4
24
|
private
|
5
25
|
|
6
26
|
# override RelatonIsoBib::IsoBibliographicItem.bib_item method
|
data/relaton_iec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.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: 2021-
|
11
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.8.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.8.0
|
153
153
|
description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
|
154
154
|
model'
|
155
155
|
email:
|
@@ -176,6 +176,23 @@ files:
|
|
176
176
|
- grammars/isostandard.rng
|
177
177
|
- grammars/reqt.rng
|
178
178
|
- lib/relaton_iec.rb
|
179
|
+
- lib/relaton_iec/basic_block/alignment.rb
|
180
|
+
- lib/relaton_iec/basic_block/basic_block.rb
|
181
|
+
- lib/relaton_iec/basic_block/citation_type.rb
|
182
|
+
- lib/relaton_iec/basic_block/dl.rb
|
183
|
+
- lib/relaton_iec/basic_block/eref.rb
|
184
|
+
- lib/relaton_iec/basic_block/eref_type.rb
|
185
|
+
- lib/relaton_iec/basic_block/formula.rb
|
186
|
+
- lib/relaton_iec/basic_block/image.rb
|
187
|
+
- lib/relaton_iec/basic_block/index.rb
|
188
|
+
- lib/relaton_iec/basic_block/index_xref.rb
|
189
|
+
- lib/relaton_iec/basic_block/note.rb
|
190
|
+
- lib/relaton_iec/basic_block/paragraph.rb
|
191
|
+
- lib/relaton_iec/basic_block/paragraph_with_footnote.rb
|
192
|
+
- lib/relaton_iec/basic_block/reference_format.rb
|
193
|
+
- lib/relaton_iec/basic_block/stem.rb
|
194
|
+
- lib/relaton_iec/basic_block/table.rb
|
195
|
+
- lib/relaton_iec/basic_block/text_element.rb
|
179
196
|
- lib/relaton_iec/hash_converter.rb
|
180
197
|
- lib/relaton_iec/hit.rb
|
181
198
|
- lib/relaton_iec/hit_collection.rb
|
@@ -184,6 +201,7 @@ files:
|
|
184
201
|
- lib/relaton_iec/processor.rb
|
185
202
|
- lib/relaton_iec/scrapper.rb
|
186
203
|
- lib/relaton_iec/statuses.yml
|
204
|
+
- lib/relaton_iec/tc_sc_officers_note.rb
|
187
205
|
- lib/relaton_iec/version.rb
|
188
206
|
- lib/relaton_iec/xml_parser.rb
|
189
207
|
- relaton_iec.gemspec
|