relaton-ietf 1.9.11 → 1.9.12

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: 158773d0da39dc2b3e8829cc5e8873820c3f58ff9589887af1d52e0d946a384d
4
- data.tar.gz: eeac44410467846a7f79eee9291c088b261792b2c44c8ac759f4f00a85beac8f
3
+ metadata.gz: c189b76c5cd1565d79d2b910449c708bd759419e38fafd7cc8a96d0bfc2eab9a
4
+ data.tar.gz: cefad1d99e228226e1ac6ac5fdaf627911006a1e67d8ed93babb108150f4631b
5
5
  SHA512:
6
- metadata.gz: f3ee4c3add2574937638ed5975a46f2fdc4d0dbd7013cd7fdf83741016715dafec8921210dff398310c402926b6ad6605458fd7c9a02d3c6ccbce4ed3dc56c84
7
- data.tar.gz: 1ed33f92838279279361975a75b8d3f6bdd54a91959b1142c901686a5bcf6f5cdf7747a74effffe41f689fd05e2a0970463dbe71e108eeaeef0d8b1e38391e0a
6
+ metadata.gz: fec8da43d98eadd06a4e511399fee9832dccbd4783a69268bd4762901270051c4eb275b8c91b9da3d9360fe86ba740e488d263cd697884f144a3749dfc6e26bf
7
+ data.tar.gz: 4a7c370e2e1825df2474be9796855f024aed008c30f737e087abb0bf8b02aed03d1332221c3eb8f71a7a3d51913eee215c1b77c21e6848ab01731e77fa8b5da6
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /bibxml-ids/
9
10
  .vscode/
10
11
 
11
12
  # rspec failure tracking
@@ -41,10 +41,25 @@ module RelatonIetf
41
41
  abstract: parse_abstract,
42
42
  relation: parse_relation,
43
43
  status: parse_status,
44
+ series: parse_series,
44
45
  editorialgroup: parse_editorialgroup,
45
46
  )
46
47
  end
47
48
 
49
+ #
50
+ # Parse series
51
+ #
52
+ # @return [Array<RelatonBib::Series>] series
53
+ #
54
+ def parse_series
55
+ title = RelatonBib::TypedTitleString.new(content: "RFC")
56
+ @doc.xpath("./xmlns:is-also/xmlns:doc-id").map do |s|
57
+ /^(?<name>\D+)(?<num>\d+)/ =~ s.text
58
+ t = RelatonBib::TypedTitleString.new(content: name)
59
+ RelatonBib::Series.new title: t, number: num.gsub(/^0+/, "")
60
+ end + [RelatonBib::Series.new(title: title, number: docnum)]
61
+ end
62
+
48
63
  #
49
64
  # Parse document identifiers
50
65
  #
@@ -76,8 +91,16 @@ module RelatonIetf
76
91
  # @return [String] PubID
77
92
  #
78
93
  def pub_id
79
- /^RFC(?<num>\d+)$/ =~ code
80
- "RFC #{num.sub(/^0+/, '')}"
94
+ "RFC #{docnum}"
95
+ end
96
+
97
+ #
98
+ # Parse document number
99
+ #
100
+ # @return [String] document number
101
+ #
102
+ def docnum
103
+ /\d+$/.match(code).to_s.sub(/^0+/, "")
81
104
  end
82
105
 
83
106
  #
@@ -122,8 +145,11 @@ module RelatonIetf
122
145
  def parse_contributor
123
146
  @doc.xpath("./xmlns:author").map do |contributor|
124
147
  n = contributor.at("./xmlns:name").text
125
- name = RelatonBib::LocalizedString.new( n, "en", "Latn")
126
- fname = RelatonBib::FullName.new(completename: name)
148
+ int, snm = n.split
149
+ initial = [RelatonBib::LocalizedString.new(int, "en", "Latn")]
150
+ surname = RelatonBib::LocalizedString.new(snm, "en", "Latn")
151
+ name = RelatonBib::LocalizedString.new(n, "en", "Latn")
152
+ fname = RelatonBib::FullName.new(completename: name, initial: initial, surname: surname)
127
153
  person = RelatonBib::Person.new(name: fname)
128
154
  RelatonBib::ContributionInfo.new(entity: person, role: [{ type: "author" }])
129
155
  end
@@ -145,7 +171,10 @@ module RelatonIetf
145
171
  #
146
172
  def parse_abstract
147
173
  @doc.xpath("./xmlns:abstract").map do |c|
148
- RelatonBib::FormattedString.new(content: c.text, language: "en",
174
+ content = c.xpath("./xmlns:p").map do |p|
175
+ "<#{p.name}>#{p.text.strip}</#{p.name}>"
176
+ end.join
177
+ RelatonBib::FormattedString.new(content: content, language: "en",
149
178
  script: "Latn", format: "text/html")
150
179
  end
151
180
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.9.11".freeze
2
+ VERSION = "1.9.12".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.9.11
4
+ version: 1.9.12
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-01-19 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml