relaton-ietf 1.11.4 → 1.11.5

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: c59dcf63b161361f93d22743447d26e76aa17ae8e418d0a7e7930809248957cf
4
- data.tar.gz: 9a8b4e68190d11712078136ff4957ac611cb771f7c724085a1d23fab2df7aaf1
3
+ metadata.gz: c8668aa18254f8c9c0dd9f0a6b47b8d8c3b83e9795ef2ece6d422962cb894e6a
4
+ data.tar.gz: 5c47519efd521568f671c7e56148133f3d3155d3a3057829b6c735df6be887f5
5
5
  SHA512:
6
- metadata.gz: 5e13facb10ad39ccfc02dbc45f362460b2d06a1e767217e34efd56e5bdb7274558c8c3805e1f0003df59a1c3e0a2d13efad83febedbfd8aa7b65f338d5f70585
7
- data.tar.gz: '09124c9ae1f33596edcf1bb97f4c349c01626a5f328be669f8c363eba09f37340d236745e1afd63c564dcd6911d276eb5eee0aa948b6a0412b231e55cc1e33b8'
6
+ metadata.gz: ffadb9d261290bc847c5ef4d56a85eaee3eee4d6ddab429e56b350dca0c30c78fb35c155e59c65dc00889cf7a33d7d821545215bd372a8457ec73cacabbdf8f3
7
+ data.tar.gz: 6b5262d9b858af95a5c0afccb2c09f109bdd6edf3ad85c5552988c8193bd1107e00ee2ee4f1751334d0d5eccb50eef9b0d8f8494887cbdc1bb835f148563e2ba
@@ -94,6 +94,7 @@ module RelatonIetf
94
94
  if series != match[:series]
95
95
  bib_versions = versions.select { |ref| ref.include? match[:series] }
96
96
  create_series match[:series], bib_versions
97
+ series = match[:series]
97
98
  end
98
99
  lv = bib_versions.select { |ref| ref.match(/\d+$/).to_s.to_i < match[:ver].to_i }
99
100
  hv = bib_versions.select { |ref| ref.match(/\d+$/).to_s.to_i > match[:ver].to_i }
@@ -103,7 +104,6 @@ module RelatonIetf
103
104
  bib.relation << version_relation(hv.first, "updatedBy") if hv.any?
104
105
  save_doc bib, check_duplicate: false
105
106
  end
106
- series = match[:series]
107
107
  end
108
108
  end
109
109
  end
@@ -114,14 +114,18 @@ module RelatonIetf
114
114
  # @param [String] ref reference
115
115
  # @param [Array<String>] versions list of versions
116
116
  #
117
- def create_series(ref, versions)
117
+ def create_series(ref, versions) # rubocop:disable Metrics/AbcSize
118
118
  return if versions.size < 2
119
119
 
120
+ vs = versions.sort_by { |v| v.match(/\d+$/).to_s.to_i }
120
121
  fref = RelatonBib::FormattedRef.new content: ref
121
- rel = versions.map do |v|
122
- version_relation v, "includes"
123
- end
124
- save_doc IetfBibliographicItem.new(formattedref: fref, relation: rel)
122
+ docid = RelatonBib::DocumentIdentifier.new type: "Internet-Draft", id: ref, primary: true
123
+ rel = vs.map { |v| version_relation v, "includes" }
124
+ last_v = HashConverter.hash_to_bib YAML.load_file("#{@output}/#{vs.last}.#{@ext}")
125
+ bib = IetfBibliographicItem.new(
126
+ title: last_v[:title], abstract: last_v[:abstract], formattedref: fref, docid: [docid], relation: rel,
127
+ )
128
+ save_doc bib
125
129
  end
126
130
 
127
131
  #
@@ -134,7 +138,8 @@ module RelatonIetf
134
138
  #
135
139
  def version_relation(ref, type)
136
140
  fref = RelatonBib::FormattedRef.new content: ref
137
- bibitem = IetfBibliographicItem.new formattedref: fref
141
+ docid = RelatonBib::DocumentIdentifier.new type: "Internet-Draft", id: ref, primary: true
142
+ bibitem = IetfBibliographicItem.new formattedref: fref, docid: [docid]
138
143
  RelatonBib::DocumentRelation.new(type: type, bibitem: bibitem)
139
144
  end
140
145
 
@@ -243,7 +243,8 @@ module RelatonIetf
243
243
  types = { "updates" => "updates", "obsoleted-by" => "obsoletedBy"}
244
244
  @doc.xpath("./xmlns:updates/xmlns:doc-id|./xmlns:obsoleted-by/xmlns:doc-id").map do |r|
245
245
  fref = RelatonBib::FormattedRef.new(content: r.text)
246
- bib = IetfBibliographicItem.new(formattedref: fref)
246
+ docid = RelatonBib::DocumentIdentifier.new type: "IETF", id: r.text, primary: true
247
+ bib = IetfBibliographicItem.new(formattedref: fref, docid: [docid])
247
248
  RelatonBib::DocumentRelation.new(type: types[r.parent.name], bibitem: bib)
248
249
  end
249
250
  end
@@ -30,6 +30,11 @@ module RelatonIetf
30
30
  new(doc, doc_id.text, is_also).parse
31
31
  end
32
32
 
33
+ #
34
+ # Parse document
35
+ #
36
+ # @return [RelatonIetf::IetfBibliographicItem] bib item
37
+ #
33
38
  def parse
34
39
  IetfBibliographicItem.new(
35
40
  docnumber: docnumber,
@@ -44,14 +49,19 @@ module RelatonIetf
44
49
  end
45
50
 
46
51
  #
47
- # Document id
52
+ # Document number
48
53
  #
49
- # @return [Strinng] document id
54
+ # @return [Strinng] document number
50
55
  #
51
56
  def docnumber
52
57
  @doc_id
53
58
  end
54
59
 
60
+ #
61
+ # Create docidentifiers
62
+ #
63
+ # @return [Array<RelatonBib::DocumentIdentifier>] docidentifiers
64
+ #
55
65
  def parse_docid
56
66
  [
57
67
  RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id, primary: true),
@@ -59,34 +69,55 @@ module RelatonIetf
59
69
  ]
60
70
  end
61
71
 
72
+ #
73
+ # Create pub_id
74
+ #
75
+ # @return [String] pub_id
76
+ #
62
77
  def pub_id
63
78
  "#{@name.upcase} #{@shortnum}"
64
79
  end
65
80
 
81
+ #
82
+ # Create anchor
83
+ #
84
+ # @return [String] anchor
85
+ #
66
86
  def anchor
67
87
  "#{@name.upcase}#{@shortnum}"
68
88
  end
69
89
 
90
+ #
91
+ # Create link
92
+ #
93
+ # @return [Array<RelatonBib::TypedUri>]
94
+ #
70
95
  def parse_link
71
96
  [RelatonBib::TypedUri.new(type: "src", content: "https://www.rfc-editor.org/info/#{@name}#{@shortnum}")]
72
97
  end
73
98
 
99
+ #
100
+ # Create formatted reference
101
+ #
102
+ # @return [RelatonBib::FormattedRef]
103
+ #
74
104
  def formattedref
75
105
  RelatonBib::FormattedRef.new(
76
106
  content: anchor, language: "en", script: "Latn",
77
107
  )
78
108
  end
79
109
 
110
+ #
111
+ # Create relations
112
+ #
113
+ # @return [Array<Hash>] relations
114
+ #
80
115
  def parse_relation
81
- @is_also.each_with_object([]) do |ref, a|
82
- # bib = IetfBibliography.get ref.sub(/^(RFC)(\d+)/, '\1 \2')
83
- ref_doc = @doc.at "/xmlns:rfc-index/xmlns:rfc-entry[xmlns:doc-id[text()='#{ref}']]"
84
- bib = if ref_doc then RfcEntry.parse ref_doc
85
- else
86
- fref = RelatonBib::FormattedRef.new content: ref
87
- IetfBibliographicItem.new formattedref: fref
88
- end
89
- a << { type: "includes", bibitem: bib } if bib
116
+ @is_also.map do |ref|
117
+ fref = RelatonBib::FormattedRef.new content: ref
118
+ docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: ref, primary: true)
119
+ bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
120
+ { type: "includes", bibitem: bib }
90
121
  end
91
122
  end
92
123
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.11.4".freeze
2
+ VERSION = "1.11.5".freeze
3
3
  end
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.11.4
4
+ version: 1.11.5
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-05-08 00:00:00.000000000 Z
11
+ date: 2022-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml