relaton-iec 1.7.7 → 1.10.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/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +3 -1
- data/README.adoc +36 -0
- data/grammars/basicdoc.rng +191 -27
- data/grammars/biblio.rng +7 -8
- data/grammars/iec.rng +144 -1
- data/grammars/isodoc.rng +1156 -112
- data/grammars/isostandard.rng +69 -115
- data/grammars/reqt.rng +65 -7
- 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 +93 -1
- data/lib/relaton_iec/processor.rb +1 -2
- 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 +2 -4
- metadata +23 -5
@@ -0,0 +1,27 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Index
|
3
|
+
#
|
4
|
+
# @param [Array<BasicBlock::TextElement] primary
|
5
|
+
# @param [Hash] args
|
6
|
+
# @option args [String, nil] :to
|
7
|
+
# @option args [Array<BasicBlock::TextElement>, nil] :secondary
|
8
|
+
# @option args [Array<BasicBlock::TextElement>, nil] :tertiary
|
9
|
+
#
|
10
|
+
def initialize(primary:, **args)
|
11
|
+
@to = args[:to]
|
12
|
+
@primary = primary
|
13
|
+
@secondary = args[:secondary]
|
14
|
+
@tertiary = args[:tertiary]
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param [Nokogiri::XML::Builder] builder
|
18
|
+
def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
|
19
|
+
idx = builder.index do |b|
|
20
|
+
@primary.each { |p| p.to_xml b }
|
21
|
+
@secondary&.each { |s| s.to_xml b }
|
22
|
+
@tertiary&.each { |t| t.to_xml b }
|
23
|
+
end
|
24
|
+
idx[:to] = @to if @to
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class IndexXref
|
3
|
+
#
|
4
|
+
# @param [Boolean] also
|
5
|
+
# @param [Array<BasicBlock::TextElement>] primary
|
6
|
+
# @param [Array<BasicBlock::TextElement>] target
|
7
|
+
# @param [Hash] args
|
8
|
+
# @option args [Array<BasicBlock::TextElement>, nil] secondary
|
9
|
+
# @option args [Array<BasicBlock::TextElement>, nil] tertiary
|
10
|
+
#
|
11
|
+
def initialize(also:, primary:, target:, **args)
|
12
|
+
@also = also
|
13
|
+
@primary = primary
|
14
|
+
@target = target
|
15
|
+
@secondary = args[:secondary]
|
16
|
+
@tertiary = args[:tertiary]
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# @param [Nokogiri::XML::Builder] builder
|
21
|
+
#
|
22
|
+
def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
|
23
|
+
builder.send "index-xref", also: @also do |b|
|
24
|
+
@primary.each { |p| p.to_xml b }
|
25
|
+
@secondary&.each { |s| s.to_xml b }
|
26
|
+
@tertiary&.each { |t| t.to_xml b }
|
27
|
+
@target.each { |t| t.to_xml b }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Note
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [Array<BasicBlock::Paragraph>] content
|
6
|
+
#
|
7
|
+
def initialize(id:, content:)
|
8
|
+
@id = id
|
9
|
+
@contain = content
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# @param [Nokogiei::XMO::Builder] builder
|
14
|
+
#
|
15
|
+
def to_xml(builder)
|
16
|
+
builder.note id: @id do |b|
|
17
|
+
@content.each { |c| c.to_xm b }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Paragraph
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [Array<BasicBlock::TextElement>] content
|
6
|
+
# @param [Array<BasicBlock::Note>] note
|
7
|
+
# @param [BasicBlock::Alignment, nil] align
|
8
|
+
#
|
9
|
+
def initialize(id:, content:, note:, align: nil)
|
10
|
+
@id = id
|
11
|
+
@content = content
|
12
|
+
@note = note
|
13
|
+
@align = align
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# @param [Nokogiri::XML::Builder] builder
|
19
|
+
#
|
20
|
+
def to_xml(builder)
|
21
|
+
p = builder.p id: @id do |b|
|
22
|
+
@content.each { |c| c.to_xml b }
|
23
|
+
@note.each { |n| n.to_xml b }
|
24
|
+
end
|
25
|
+
p[:align] = @align if @align
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class ParagraphWithFootnote
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [Hash] args
|
6
|
+
# @param [BasicBlock::Alignment, nil] align
|
7
|
+
# @param [Array<BasicBlock::TextElement, BasicBlock::Eref, BasicBlock::Stem,
|
8
|
+
# BasicBlock::Image, BasicBlock::Index, BasicBlock::IndexXref>] content
|
9
|
+
# @param [Array<RelatonIec::Note>] note
|
10
|
+
#
|
11
|
+
def initialize(id:, align: nil, content: [], note: [])
|
12
|
+
@id = id
|
13
|
+
@aligments = align
|
14
|
+
@content = content
|
15
|
+
@note = note
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# @param [Nokogiri::XML::Builder] builder
|
20
|
+
#
|
21
|
+
def to_xml(builder)
|
22
|
+
elm = builder.p(@id) do |b|
|
23
|
+
@content.each { |te| te.to_xml b }
|
24
|
+
@note.each { |n| n.to_xml b }
|
25
|
+
end
|
26
|
+
elm[:align] = @align if @align
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module RelatonIec
|
2
|
+
def self.respond_to_missing?(method, _include_private)
|
3
|
+
method == "ReferenceFormat"
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.method_missing(_method, *args)
|
7
|
+
ReferenceFormat.new *args
|
8
|
+
end
|
9
|
+
|
10
|
+
class ReferenceFormat
|
11
|
+
FORMATS = %w[external inline footnote callout].freeze
|
12
|
+
|
13
|
+
#
|
14
|
+
# @param [String] format
|
15
|
+
#
|
16
|
+
def initialize(format)
|
17
|
+
unless FORMATS.include? format
|
18
|
+
warn "[relaton-iec] WARNING: invalid reference format \"#{format}\""
|
19
|
+
warn "[relaton-iec] alloved reference formats are: #{FORMATS.join ', '}"
|
20
|
+
end
|
21
|
+
@format = format
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
#
|
27
|
+
def to_s
|
28
|
+
@format
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# @return [Sting] <description>
|
33
|
+
#
|
34
|
+
def inspect
|
35
|
+
to_s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Stem
|
3
|
+
TYPES = %w[MathML AsciiMath].freeze
|
4
|
+
|
5
|
+
# @return [String]
|
6
|
+
attr_reader :type
|
7
|
+
|
8
|
+
#
|
9
|
+
# @param [String] type
|
10
|
+
# @param [Array<#to_xml>] content any element
|
11
|
+
#
|
12
|
+
def initialize(type:, content: [])
|
13
|
+
unless TYPES.include? type
|
14
|
+
warn "[relaton-iec] WARNING: invalud type \"#{type}\""
|
15
|
+
warn "[relaton-iec] allowed types are: #{TYPES.join ', '}"
|
16
|
+
end
|
17
|
+
@type = type
|
18
|
+
@content = content
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# @param [Nokogiri::XML::Builder] builder
|
23
|
+
#
|
24
|
+
def to_xml(builder)
|
25
|
+
builder.stem(type) do |b|
|
26
|
+
content.each { |c| c.to_xml b }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Table
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [Array<BasicBlock::Tr>] tbody
|
6
|
+
# @param [Array<BasicBlock::Paragraph>] note
|
7
|
+
# @param [Hash] args
|
8
|
+
# @option args [Boolean, nil] :unnumbered
|
9
|
+
# @option args [String, nil] :subsequence
|
10
|
+
# @option args [String, nil] :alt
|
11
|
+
# @option args [String, nil] :summary
|
12
|
+
# @option args [String, nil] :uri
|
13
|
+
# @option args [BasicBlock::TextElement, nil] :tname
|
14
|
+
# @option args [BasicBlock::Table::Tr, nil] :thead
|
15
|
+
# @option args [BasicBlock::TextElement, nil] :tfoot
|
16
|
+
# @option args [BasicBlock::Dl, nil] :dl
|
17
|
+
#
|
18
|
+
def initialize(id:, tbody:, note:, **args) # rubocop:disable Metrics/MethodLength
|
19
|
+
@id = id
|
20
|
+
@unnumbered = args[:unnumbered]
|
21
|
+
@subsequence = args[:subsequence]
|
22
|
+
@alt = args[:alt]
|
23
|
+
@summary = args[:summary]
|
24
|
+
@uri = args[:uri]
|
25
|
+
@tname = args[:tname]
|
26
|
+
@thead = args[:thead]
|
27
|
+
@tbody = tbody
|
28
|
+
@tfoot = args[:tfoot]
|
29
|
+
@note = note
|
30
|
+
@dl = args[:dl]
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param [Nokogiri::XML::Builder] builder
|
34
|
+
def to_xml(builder) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
35
|
+
tab = builder.table id: @id do |b|
|
36
|
+
b.name { @tname.to_xml b } if @tname
|
37
|
+
b.thead { @thead.to_xml b } if @thead
|
38
|
+
@tbody.each { |tb| tb.to_xml b }
|
39
|
+
b.name { @tfoot.to_xml b } if @tfoot
|
40
|
+
@note.each { |n| b.note { n.to_xml b } }
|
41
|
+
@dl.to_xml b
|
42
|
+
end
|
43
|
+
tab[:unnumbered] = @unnumbered if @unnumbered
|
44
|
+
tab[:subsequence] = @subsequence if @subsequence
|
45
|
+
tab[:alt] = @alt if @alt
|
46
|
+
tab[:summary] = @summary if @summary
|
47
|
+
tab[:uri] = @uri if @uri
|
48
|
+
end
|
49
|
+
|
50
|
+
class Tr
|
51
|
+
# @param [Array<BasicBlock::Table::Td, BasicBlock::Table::Th>] content
|
52
|
+
def initialize(content)
|
53
|
+
@content = content
|
54
|
+
end
|
55
|
+
|
56
|
+
# @param [Nokogiri::XML::Builder] builder
|
57
|
+
def to_xml(builder)
|
58
|
+
builder.tr do |b|
|
59
|
+
@content.each { |c| c.to_xm b }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class TabCell
|
65
|
+
ALIGNS = %w[left right ceter].freeze
|
66
|
+
VALIGNS = %w[top middle bottom baseline].freeze
|
67
|
+
|
68
|
+
# @param [Array<BasicBlock::TextElement,
|
69
|
+
# BasicBlock::ParagraphWithFootnote>] content
|
70
|
+
# @param [Hssh] args
|
71
|
+
# @option args [String, nil] :colspan
|
72
|
+
# @option args [String, nil] :rowspan
|
73
|
+
# @option args [String, nil] :align
|
74
|
+
# @option args [String, nil] :valign
|
75
|
+
def initialize(content, **args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
76
|
+
if args[:align] && !ALIGNS.include?(args[:align])
|
77
|
+
warn "[basic-block] WARNING: invalid table/tr/td align \"#{args[:align]}\""
|
78
|
+
warn "[basic-block] alloved aligns are: #{ALIGNS.join ', '}"
|
79
|
+
end
|
80
|
+
if args[:valign] && !VALIGNS.include?(args[:valign])
|
81
|
+
warn "[basic-block] WARNING: invalid table/tr/td valign \"#{args[:valign]}\""
|
82
|
+
warn "[basic-block] alloved valigns are: #{VALIGNS.join ', '}"
|
83
|
+
end
|
84
|
+
@content = content
|
85
|
+
@colspan = args[:colspan]
|
86
|
+
@rowspan = args[:rowspan]
|
87
|
+
@align = args[:align]
|
88
|
+
@valign = args[:valign]
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param [Nokogiri::XML::Builder] builder
|
92
|
+
def to_xml(builder)
|
93
|
+
td = @content.each { |c| c.to_xml builder }
|
94
|
+
td[:colspan] = @colspan if @colspan
|
95
|
+
td[:rowspan] = @rowspan if @rowspan
|
96
|
+
td[:align] = @align if @align
|
97
|
+
td[:valign] = @valign if @valign
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Td < BasicBlock::Table::TabCell
|
102
|
+
# @param [Nokogiri::XML::Builder] builder
|
103
|
+
def to_xml(builder)
|
104
|
+
builder.th { super }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class Th < BasicBlock::Table::TabCell
|
109
|
+
# @param [Nokogiri::XML::Builder] builder
|
110
|
+
def to_xml(builder)
|
111
|
+
builder.td { super }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class TextElement
|
3
|
+
TAGS = %w[em strong sub sup tt underline strike smallcap br hr keyword rp
|
4
|
+
rt ruby pagebreak bookmark].freeze
|
5
|
+
|
6
|
+
#
|
7
|
+
# @param [String] tag
|
8
|
+
# @param [Array<String, BasicBlock::TextElement, BasicBlock::Stem>,
|
9
|
+
# String] content
|
10
|
+
#
|
11
|
+
def initialize(tag:, content:)
|
12
|
+
unless TAGS.include? tag
|
13
|
+
warn "[basic-block] WARNING: invalid tag \"#{tag}\""
|
14
|
+
warn "[basic-block] allowed tags are: #{TAGS.join ', '}"
|
15
|
+
end
|
16
|
+
@tag = tag
|
17
|
+
@content = content
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param [Nokogiri::XML::Builder]
|
21
|
+
def to_xml(builder)
|
22
|
+
builder.send @tag do |b|
|
23
|
+
@content.each { |c| c.is_a?(String) ? c : c.to_xml(b) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -25,7 +25,7 @@ module RelatonIec
|
|
25
25
|
def to_all_parts # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity
|
26
26
|
parts = @array.reject { |h| h.part.nil? }
|
27
27
|
hit = parts.min_by &:part
|
28
|
-
return @array.first
|
28
|
+
return @array.first&.fetch unless hit
|
29
29
|
|
30
30
|
bibitem = hit.fetch
|
31
31
|
all_parts_item = bibitem.to_all_parts
|
@@ -3,7 +3,99 @@ module RelatonIec
|
|
3
3
|
TYPES = %w[
|
4
4
|
international-standard technical-specification technical-report
|
5
5
|
publicly-available-specification international-workshop-agreement
|
6
|
-
guide
|
6
|
+
guide industry-technical-agreement
|
7
7
|
].freeze
|
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
|
+
|
42
|
+
# @param hash [Hash]
|
43
|
+
# @return [RelatonIsoBib::IecBibliographicItem]
|
44
|
+
def self.from_hash(hash)
|
45
|
+
item_hash = ::RelatonIec::HashConverter.hash_to_bib(hash)
|
46
|
+
new **item_hash
|
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
|
8
100
|
end
|
9
101
|
end
|
@@ -26,8 +26,7 @@ module RelatonIec
|
|
26
26
|
# @param hash [Hash]
|
27
27
|
# @return [RelatonIsoBib::IecBibliographicItem]
|
28
28
|
def hash_to_bib(hash)
|
29
|
-
|
30
|
-
::RelatonIec::IecBibliographicItem.new item_hash
|
29
|
+
::RelatonIec::IecBibliographicItem.from_hash hash
|
31
30
|
end
|
32
31
|
|
33
32
|
# Returns hash of XML grammar
|
@@ -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
@@ -21,19 +21,17 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
25
25
|
|
26
|
-
# spec.add_development_dependency "debase"
|
27
26
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
28
27
|
spec.add_development_dependency "pry-byebug"
|
29
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
# spec.add_development_dependency "ruby-debug-ide"
|
32
30
|
spec.add_development_dependency "ruby-jing"
|
33
31
|
spec.add_development_dependency "simplecov"
|
34
32
|
spec.add_development_dependency "vcr"
|
35
33
|
spec.add_development_dependency "webmock"
|
36
34
|
|
37
35
|
spec.add_dependency "addressable"
|
38
|
-
spec.add_dependency "relaton-iso-bib", "~> 1.
|
36
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.10.0"
|
39
37
|
end
|
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.10.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:
|
11
|
+
date: 2022-01-30 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.10.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.10.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
|
@@ -199,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
217
|
requirements:
|
200
218
|
- - ">="
|
201
219
|
- !ruby/object:Gem::Version
|
202
|
-
version: 2.
|
220
|
+
version: 2.5.0
|
203
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
222
|
requirements:
|
205
223
|
- - ">="
|