pubid 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.adoc +4 -123
- data/lib/pubid/registry.rb +30 -0
- data/lib/pubid/version.rb +1 -3
- data/lib/pubid.rb +13 -6
- metadata +164 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690aaebd36159f29f0c30f305e45c2a44cb27f2aa03e501d3b264af0acee6bb9
|
4
|
+
data.tar.gz: dc4bf083ed329452fa61a6e2080356fc5a46b88cec2d442327d79f35bcdd1745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac9c45a40be24fe9791acea1b15bd7f8124c60d59e594d4803c2b01dffb39d8100c2efdeae73b4da4b64096300183fd4202edd34f22fb9f0166008404376726
|
7
|
+
data.tar.gz: '09789ff8bff807dfe2fcee2852137b27d77b2ef8bd32aa5e2de855c24ef276ce083fe26b854afd4d4c25f68b828085c3e484d94d325220e1b75f417c5881a3a8'
|
data/LICENSE.txt
CHANGED
data/README.adoc
CHANGED
@@ -1,127 +1,8 @@
|
|
1
|
-
=
|
1
|
+
= PubID
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Implements a mechanism to parse and utilize IEEE publication identifers.
|
6
|
-
|
7
|
-
== Historic identifier patterns
|
8
|
-
|
9
|
-
There are at least two major "pattern series" of identifiers due to historical reasons: old (type I) and new (type II).
|
10
|
-
This implementation attempts to support both types of publication identifier patterns.
|
11
|
-
|
12
|
-
== Use cases to support
|
13
|
-
|
14
|
-
* analyze a pattern of type I idetifier
|
15
|
-
* parse type II idetifier into components
|
16
|
-
* generate a filename from the components similar to type I pattern
|
17
|
-
|
18
|
-
== Elements of the PubID
|
19
|
-
|
20
|
-
=== Publisher
|
21
|
-
|
22
|
-
|===
|
23
|
-
| Name | Abbrev
|
24
|
-
|
25
|
-
| Institute of Electrical and Electronics Engineers
|
26
|
-
| IEEE
|
27
|
-
|
28
|
-
|===
|
29
|
-
|
30
|
-
=== Report number
|
31
|
-
|
32
|
-
`{number}` - is a set of one or more digits and optional letters
|
33
|
-
|
34
|
-
=== Part
|
35
|
-
|
36
|
-
`{part}` - is a set of digits and optional letters; starts with a digit; if a letter or letters are present then they are in the end; optional
|
37
|
-
|
38
|
-
=== Subpart
|
39
|
-
|
40
|
-
`{subpart}` - is a set of digits and optional letters; optional, many subparts are possible
|
3
|
+
image:https://badge.fury.io/rb/pubid.svg["Gem Version", link="https://badge.fury.io/rb/pubid"]
|
41
4
|
|
42
|
-
|
43
|
-
|
44
|
-
`{year}` - is a set of 4 digits; optional
|
45
|
-
|
46
|
-
=== Corrigendum & Amendment
|
47
|
-
|
48
|
-
`{cor}` - is a corrigendum or an amendments with the pattern `Cor {cornum}-{year}` or `Amd {cornum}:{year}` where {cornum} is a set of digits; optional
|
49
|
-
|
50
|
-
== Type I pattern
|
51
|
-
|
52
|
-
[source]
|
53
|
-
----
|
54
|
-
{publisher} {type} {series} {number}{part}.{subpart}{year} {edition}/{conform}/{correction}
|
55
|
-
----
|
56
|
-
|
57
|
-
* `{publisher}` IEEE
|
58
|
-
* `{type}` one of the values: `Standard`, `Std`, `Draft`, `Draft Standard`, `Draft Supplement` ^*^
|
59
|
-
* `{series}` one of the values: `ISO/IEC`, `ISO/IEC/IEEE` ^*^
|
60
|
-
* `{number}` set of digits optionally prefixed with uppercase letter and optionally suffixed with letter
|
61
|
-
* `{part}` from 1 to 2 digits prefixed with `.` or `-` and optionally suffixed with up to 4 letters ^*^
|
62
|
-
* `{subpart}` 1 digit optionally suffixed with a letter ^*^
|
63
|
-
* `{year}` 4 digits prefixed with `-`, `:`, ` - `, or breakspace ^*^
|
64
|
-
* `{edition}` prefix `Edition` followed by a reference in brackets or prefix `First edition` followed by date in format `YYYY-MM-DD` ^*^
|
65
|
-
* `{conform}` prefix `Conformance` followed by 2 digits, dash, and 4 digits year ^*^
|
66
|
-
* `{correction}` prefix `Cor` optionally followed by breakspace, or prefix `Amd` followed by `.`, followed by from 1 to 2 digits, dash and 4 digits year ^*^
|
67
|
-
|
68
|
-
(*) - optional
|
69
|
-
|
70
|
-
An identifier can be composed of 2 other identifiers with breakspace delimiter. Only the first identifier needs to cnatain puplisher, for the secont it's optional
|
71
|
-
|
72
|
-
Following RegEx expression parses 100% of identifiers from the type I https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ieee/[dataset]:
|
73
|
-
[source,regex]
|
74
|
-
|
75
|
-
----
|
76
|
-
{
|
77
|
-
^IEEE\s
|
78
|
-
((?<type1>Standard|Std|Draft(\sStandard|\sSupplement)?)\s)?
|
79
|
-
((?<series>ISO\/IEC(\/IEEE)?)\s)?
|
80
|
-
(?<number1>[A-Z]?\d+[[:alpha:]]?)
|
81
|
-
([.-](?<part1>\d{1,2}(?!\d)[[:alpha:]]{0,4}))?
|
82
|
-
(\.(?<subpart1>\d[[:alpha:]]?))?
|
83
|
-
(?<year1>([-:]|\s-\s|,\s)\d{4})?
|
84
|
-
(\s(IEEE\s(?<type2>Std)\s)?(?<number2>[A-Z]?\d+[[:alpha:]]?)
|
85
|
-
([.-](?<part2>\d{1,2}(?!\d)[[:alpha:]]{0,4}))?
|
86
|
-
([.](?<subpart2>\d[[:alpha:]]?))?
|
87
|
-
(?<year2>([-:.]|_-|\s-\s|,\s)\d{4})?)?
|
88
|
-
(\s(?<edition>Edition(\s\([^)]+\))?|First\sedition\s[\d-]+))?
|
89
|
-
(\/(?<conform>Conformance\d{2})-(?<confyear>\d{4}))?
|
90
|
-
(\/(?<correction>(Cor\s?|(Amd\.)\d{1,2})
|
91
|
-
(?<coryear>(:|-|:-)\d{4}))?$
|
92
|
-
}x
|
93
|
-
----
|
94
|
-
|
95
|
-
== Pasing PubID elements from type II identifiers
|
96
|
-
|
97
|
-
To parse PubID elements from the type II pattern identifiers we can use a RegEx expression:
|
98
|
-
|
99
|
-
[source,regex]
|
100
|
-
----
|
101
|
-
{
|
102
|
-
^IEEE\s(?<number1>\w+(\.[A-Z]\d|\sHBK)?)
|
103
|
-
(?<part1>(\.|\s)\d{1,4}[[:alpha:],]{0,7}|-\d?[A-Z]+|-\d(?=[-.]))?
|
104
|
-
(?<subpart11>\.\d{1,3}[a-z]?|-\d{5}[a-z]?|-\d+(?=[-:_]))?
|
105
|
-
(?<subpart12>\.\d|-\d+(?=-))?
|
106
|
-
(?<year1>([-:.]|_-|\s-)\d{4})?
|
107
|
-
(\/(?<number2>([A-Z]?\d+[a-z]?|Conformance\d+))
|
108
|
-
((\.|-)(?<part2>\d{1,3}[a-z]?)(?!\d))?
|
109
|
-
(\.(?<subpart21>\d{1,2}))?)?
|
110
|
-
(\/(?<number3>\d+)(\.(?<part3>\d))?)?
|
111
|
-
(?<year2>([-:.]|_-|\s-)\d{4})?
|
112
|
-
((\/|_|-|\s\/)(?<correction>(Cor|(?i)Amd(?-i))(\s|\.|\.\s)?\d{1,2})
|
113
|
-
(?<coryear>(:|-|:-|_[A-Z][a-z]{2}_)\d{4}(-\d{4})?)?)?$
|
114
|
-
}x
|
115
|
-
----
|
116
|
-
|
117
|
-
This RegEx expession covers 99% of the identifiers from the type II bibxml-ieee https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ieee-new/[dataset].
|
118
|
-
|
119
|
-
== File name generator
|
120
|
-
|
121
|
-
For type I identifiers file names are generated by replacing symbols `/`, `\`, `,`, `'`, `"`, `(`, `)`, and breakspace with symbol `_`. Sequences of multiple sybols `_` should be squized to one symbol.
|
5
|
+
== Purpose
|
122
6
|
|
123
|
-
|
7
|
+
This gem include all pubid-* gems for compatibility testing.
|
124
8
|
|
125
|
-
----
|
126
|
-
IEEE.{number1}_{part1}.{subpart11}.{subpart12}-{year1}_{number2}_{part2}.{subpart21}_{number3}_{part3}-{year2}_{correction}-{coryear}
|
127
|
-
----
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Pubid
|
2
|
+
class Registry
|
3
|
+
class << self
|
4
|
+
def parse(*args)
|
5
|
+
modules = [Pubid::Iso,
|
6
|
+
Pubid::Ieee,
|
7
|
+
Pubid::Nist,
|
8
|
+
Pubid::Iec,
|
9
|
+
Pubid::Cen,
|
10
|
+
Pubid::Bsi,
|
11
|
+
Pubid::Ccsds,
|
12
|
+
Pubid::Itu,
|
13
|
+
Pubid::Jis]
|
14
|
+
modules.each do |mod|
|
15
|
+
module_identifier = Kernel.const_get("#{mod}::Identifier")
|
16
|
+
return module_identifier.parse(*args) if module_identifier.parseable?(*args)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Go through each module to try to parse unknown prefix
|
20
|
+
modules.each do |mod|
|
21
|
+
return Kernel.const_get("#{mod}::Identifier").parse(*args)
|
22
|
+
rescue Pubid::Core::Errors::ParseError
|
23
|
+
next
|
24
|
+
end
|
25
|
+
|
26
|
+
raise Pubid::Core::Errors::ParseError, "cannot find module to parse #{args}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/pubid/version.rb
CHANGED
data/lib/pubid.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "pubid/version"
|
4
|
-
|
5
1
|
module Pubid
|
6
|
-
class Error < StandardError; end
|
7
|
-
# Your code goes here...
|
8
2
|
end
|
3
|
+
|
4
|
+
require_relative "pubid/registry"
|
5
|
+
|
6
|
+
require "pubid-core"
|
7
|
+
require "pubid-iso"
|
8
|
+
require "pubid-ieee"
|
9
|
+
require "pubid-nist"
|
10
|
+
require "pubid-iec"
|
11
|
+
require "pubid-cen"
|
12
|
+
require "pubid-bsi"
|
13
|
+
require "pubid-ccsds"
|
14
|
+
require "pubid-itu"
|
15
|
+
require "pubid-jis"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,7 +38,161 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pubid-core
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.12.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.12.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pubid-nist
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pubid-iso
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.7.5
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.7.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pubid-ieee
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pubid-cen
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.2.4
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.2.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pubid-iec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.3.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.3.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pubid-ccsds
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.1.3
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.1.3
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pubid-itu
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.1.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.1.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pubid-jis
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.3.2
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.3.2
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: pubid-bsi
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.3.4
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.3.4
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: pubid-etsi
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.1.0
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.1.0
|
195
|
+
description: Gem including all pubid-* gems.
|
42
196
|
email:
|
43
197
|
- open.source@ribose.com
|
44
198
|
executables: []
|
@@ -50,12 +204,13 @@ files:
|
|
50
204
|
- LICENSE.txt
|
51
205
|
- README.adoc
|
52
206
|
- lib/pubid.rb
|
207
|
+
- lib/pubid/registry.rb
|
53
208
|
- lib/pubid/version.rb
|
54
|
-
homepage: https://github.com/metanorma/pubid
|
209
|
+
homepage: https://github.com/metanorma/pubid
|
55
210
|
licenses:
|
56
211
|
- BSD-2-Clause
|
57
212
|
metadata: {}
|
58
|
-
post_install_message:
|
213
|
+
post_install_message:
|
59
214
|
rdoc_options: []
|
60
215
|
require_paths:
|
61
216
|
- lib
|
@@ -70,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
225
|
- !ruby/object:Gem::Version
|
71
226
|
version: '0'
|
72
227
|
requirements: []
|
73
|
-
rubygems_version: 3.3.
|
74
|
-
signing_key:
|
228
|
+
rubygems_version: 3.3.27
|
229
|
+
signing_key:
|
75
230
|
specification_version: 4
|
76
|
-
summary:
|
231
|
+
summary: Gem including all pubid-* gems.
|
77
232
|
test_files: []
|