relaton-ietf 1.14.1 → 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: c4e282983c73210f9ca6bcd6ff4b8fee3eb8cd77063d69d9233e726b6ecc56ff
4
- data.tar.gz: 0c974753123af381e55c5379fa0539c180fe713f864fdf40e5ddb40ce3186dcc
3
+ metadata.gz: d095dbbd95a78f345ce51149c8fcea964014f3e7aeef7b96ee4021df52900e60
4
+ data.tar.gz: f240f8d05275819b620455f743bf4d31d096ca1f0bd4de9c594cd2d163b6fc0e
5
5
  SHA512:
6
- metadata.gz: dc868f1be3c80ca3d0db43fff29bfb743337d76a286934a2ab0fc8a0e4281941e94d94b92d5bd6c15bdfa3fcc9a518a86556fd4e5246908d0a96fe8ef87cf33e
7
- data.tar.gz: be4ca8fb1ee508e50f4c4dc2b123cbe10d8e8724aaf39530faf2a30f3ab263cd171362c7df8e2582083f5ee86d286d18cd93c18571060ee508bf09cfdf2413db
6
+ metadata.gz: fc7e74b30da9eb8c26d1b45e11511b0e2f17ff08eb0354b15e2445515c98d28d985e5582f09cbb2ab966916e872fdafe56b00b0e9a2148c80a1aa9fdc6b8b37e
7
+ data.tar.gz: e89482fa9042118c3cdece897e1c976d889986d374a89105aebe41c414cf57d6ad41f7ffb5e4b92bcb9d0f87e3f9ee79cf64b64dcde0ebe50127aa9ad16ad091
@@ -45,14 +45,15 @@ module RelatonIetf
45
45
  end
46
46
 
47
47
  #
48
- # Render date as BibXML
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
53
+ # @return [String, Nokogiri::XML::Builder::NodeBuilder] XML
54
+ #
55
+ def to_bibxml(builder = nil, include_keywords: false)
56
+ Renderer::BibXML.new(self).render builder: builder, include_keywords: include_keywords
56
57
  end
57
58
  end
58
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
  #
@@ -159,7 +170,7 @@ module RelatonIetf
159
170
  end
160
171
  RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib))
161
172
  end
162
- # contribs << create_org_contrib("RFC Publisher", "publisher")
173
+ contribs << create_org_contrib("RFC Publisher", "publisher")
163
174
  contribs << create_org_contrib("RFC Series", "authorizer")
164
175
  end
165
176
 
@@ -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.1".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.1
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-16 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