relaton-ietf 1.14.2 → 1.14.3

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: aeb4af4144610491bf2bea9e39dc33eb0df67f8a64c67302b2a503a07d3e8fc8
4
- data.tar.gz: 9e3ec1c20c3c987449cc438c88045b445c1a4196a53aee5a0e5b00b6a038aef4
3
+ metadata.gz: d095dbbd95a78f345ce51149c8fcea964014f3e7aeef7b96ee4021df52900e60
4
+ data.tar.gz: f240f8d05275819b620455f743bf4d31d096ca1f0bd4de9c594cd2d163b6fc0e
5
5
  SHA512:
6
- metadata.gz: d24d58dae25d535ce8fde08676e244e8435ab9d20fbbd5d9eb6b6f6c620e377686cf3436f49df145d7016a16a3713a6bc65955f1e8d8062ac84953d6cc67796e
7
- data.tar.gz: 056caff1d268d56dc15049714784edb13ff25339fded08b8b2833ec95d843ccfe82855ebeece50f1f126c30c6bc9461af9d937451f9856bd53547b486434ae21
6
+ metadata.gz: fc7e74b30da9eb8c26d1b45e11511b0e2f17ff08eb0354b15e2445515c98d28d985e5582f09cbb2ab966916e872fdafe56b00b0e9a2148c80a1aa9fdc6b8b37e
7
+ data.tar.gz: e89482fa9042118c3cdece897e1c976d889986d374a89105aebe41c414cf57d6ad41f7ffb5e4b92bcb9d0f87e3f9ee79cf64b64dcde0ebe50127aa9ad16ad091
@@ -45,33 +45,15 @@ module RelatonIetf
45
45
  end
46
46
 
47
47
  #
48
- # Render date as BibXML. Override to skip IANA docidentifiers
48
+ # Render BibXML (RFC)
49
49
  #
50
- # @param [Nokogiri::XML::Builder] builder xml builder
50
+ # @param [Nokogiri::XML::Builder, nil] builder
51
+ # @param [Boolean] include_keywords (false)
51
52
  #
52
- def render_date(builder)
53
- return if docidentifier.detect { |i| i.type == "IANA" }
54
-
55
- super
56
- end
57
-
53
+ # @return [String, Nokogiri::XML::Builder::NodeBuilder] XML
58
54
  #
59
- # Render authors as BibXML. Override to skip "RFC Publisher" organization
60
- #
61
- # @param [Nokogiri::XML::Builder] builder xml builder
62
- #
63
- def render_authors(builder) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
64
- contributor.each do |c|
65
- next if c.entity.is_a?(Organization) && c.entity.name.map(&:content).include?("RFC Publisher")
66
-
67
- builder.author do |xml|
68
- xml.parent[:role] = "editor" if c.role.detect { |r| r.type == "editor" }
69
- if c.entity.is_a?(Person) then render_person xml, c.entity
70
- else render_organization xml, c.entity, c.role
71
- end
72
- render_address xml, c
73
- end
74
- end
55
+ def to_bibxml(builder = nil, include_keywords: false)
56
+ Renderer::BibXML.new(self).render builder: builder, include_keywords: include_keywords
75
57
  end
76
58
  end
77
59
  end
@@ -0,0 +1,33 @@
1
+ module RelatonIetf
2
+ module Renderer
3
+ class BibXML < RelatonBib::Renderer::BibXML
4
+ #
5
+ # Render dates as BibXML. Override to skip IANA date rendering.
6
+ #
7
+ # @param [Nokogiri::XML::Builder] builder xml builder
8
+ #
9
+ def render_date(builder)
10
+ super unless @bib.docidentifier.detect { |i| i.type == "IANA" }
11
+ end
12
+
13
+ #
14
+ # Render authors as BibXML. Override to skip "RFC Publisher" organization.
15
+ #
16
+ # @param [Nokogiri::XML::Builder] builder xml builder
17
+ #
18
+ def render_authors(builder) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
19
+ @bib.contributor.each do |c|
20
+ next if c.entity.is_a?(RelatonBib::Organization) && c.entity.name.map(&:content).include?("RFC Publisher")
21
+
22
+ builder.author do |xml|
23
+ xml.parent[:role] = "editor" if c.role.detect { |r| r.type == "editor" }
24
+ if c.entity.is_a?(RelatonBib::Person) then render_person xml, c.entity
25
+ else render_organization xml, c.entity, c.role
26
+ end
27
+ render_address xml, c
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -52,11 +52,22 @@ module RelatonIetf
52
52
  #
53
53
  def parse_series
54
54
  title = RelatonBib::TypedTitleString.new(content: "RFC")
55
+ series_is_also + seires_stream + [RelatonBib::Series.new(title: title, number: docnum)]
56
+ end
57
+
58
+ def series_is_also
55
59
  @doc.xpath("./xmlns:is-also/xmlns:doc-id").map do |s|
56
60
  /^(?<name>\D+)(?<num>\d+)/ =~ s.text
57
61
  t = RelatonBib::TypedTitleString.new(content: name)
58
62
  RelatonBib::Series.new title: t, number: num.gsub(/^0+/, "")
59
- end + [RelatonBib::Series.new(title: title, number: docnum)]
63
+ end
64
+ end
65
+
66
+ def seires_stream
67
+ @doc.xpath("./xmlns:stream").map do |s|
68
+ t = RelatonBib::TypedTitleString.new content: s.text
69
+ RelatonBib::Series.new type: "stream", title: t
70
+ end
60
71
  end
61
72
 
62
73
  #
@@ -46,6 +46,7 @@ module RelatonIetf
46
46
  link: parse_link,
47
47
  formattedref: formattedref,
48
48
  relation: parse_relation,
49
+ series: parse_series,
49
50
  )
50
51
  end
51
52
 
@@ -73,10 +74,7 @@ module RelatonIetf
73
74
  # @return [Array<RelatonBib::DocumentIdentifier>] docidentifiers
74
75
  #
75
76
  def parse_docid
76
- [
77
- RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id, primary: true),
78
- # RelatonBib::DocumentIdentifier.new(type: "IETF", scope: "anchor", id: anchor),
79
- ]
77
+ [RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id, primary: true)]
80
78
  end
81
79
 
82
80
  #
@@ -100,7 +98,7 @@ module RelatonIetf
100
98
  #
101
99
  # Create link
102
100
  #
103
- # @return [Array<RelatonBib::TypedUri>]
101
+ # @return [Array<RelatonBib::TypedUri>]
104
102
  #
105
103
  def parse_link
106
104
  [RelatonBib::TypedUri.new(type: "src", content: "https://www.rfc-editor.org/info/#{@name}#{@shortnum}")]
@@ -109,7 +107,7 @@ module RelatonIetf
109
107
  #
110
108
  # Create formatted reference
111
109
  #
112
- # @return [RelatonBib::FormattedRef]
110
+ # @return [RelatonBib::FormattedRef]
113
111
  #
114
112
  def formattedref
115
113
  RelatonBib::FormattedRef.new(
@@ -131,5 +129,12 @@ module RelatonIetf
131
129
  { type: "includes", bibitem: bib }
132
130
  end
133
131
  end
132
+
133
+ def parse_series
134
+ @doc.xpath("./xmlns:stream").map do |s|
135
+ title = RelatonBib::TypedTitleString.new content: s.text
136
+ RelatonBib::Series.new type: "stream", title: title
137
+ end
138
+ end
134
139
  end
135
140
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.14.2".freeze
2
+ VERSION = "1.14.3".freeze
3
3
  end
data/lib/relaton_ietf.rb CHANGED
@@ -8,6 +8,7 @@ require "relaton_ietf/ietf_bibliography"
8
8
  require "relaton_ietf/xml_parser"
9
9
  require "relaton_ietf/hash_converter"
10
10
  require "relaton_ietf/data_fetcher"
11
+ require "relaton_ietf/renderer/bibxml"
11
12
  require "relaton/provider_ietf"
12
13
 
13
14
  module RelatonIetf
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.2
4
+ version: 1.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-24 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -171,6 +171,7 @@ files:
171
171
  - lib/relaton_ietf/ietf_bibliographic_item.rb
172
172
  - lib/relaton_ietf/ietf_bibliography.rb
173
173
  - lib/relaton_ietf/processor.rb
174
+ - lib/relaton_ietf/renderer/bibxml.rb
174
175
  - lib/relaton_ietf/rfc_entry.rb
175
176
  - lib/relaton_ietf/rfc_index_entry.rb
176
177
  - lib/relaton_ietf/scrapper.rb