pubid-iso 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/iso/parser.rb +0 -1
- data/lib/pubid/iso/renderer/base.rb +1 -3
- data/lib/pubid/iso/transformer.rb +5 -31
- data/lib/pubid/iso/version.rb +1 -1
- metadata +4 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11124938cd55ceae313c720ac11b3c19c475e1398bb7e0eed93ac07ebbbe9eb4
|
4
|
+
data.tar.gz: 72de1b3ce2af85a21b888e2180410d5efbe57f6ea297ff7b412a9758e024d1e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4d5c372306186736e8c44c446e445758c8b7d871d73454096c739ed1e5e7fcc7890b8ea0189c44f5418150d54f6802d325687ab77dcf71984277ec244f303a
|
7
|
+
data.tar.gz: f93770f6fb62a8401e99a59d1e47c99eb6f97c5be34385acb9f01187bb8eab504ccff0dc8ae50162037ef3f5080a0e0f2a8add11a2f789ef67cf153128c339eb
|
data/lib/pubid/iso/parser.rb
CHANGED
@@ -64,7 +64,7 @@ module Pubid::Iso::Renderer
|
|
64
64
|
end
|
65
65
|
[publisher, copublishers].join("/")
|
66
66
|
when Array
|
67
|
-
([publisher] + copublishers.map(&:to_s)
|
67
|
+
([publisher] + copublishers.map(&:to_s)).map do |pub|
|
68
68
|
if opts[:language]
|
69
69
|
(TRANSLATION[opts[:language]][:publisher][pub] || pub).gsub('-', '/')
|
70
70
|
else
|
@@ -156,8 +156,6 @@ module Pubid::Iso::Renderer
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def render_part(part, opts, _params)
|
159
|
-
return "-#{part.reverse.join('-')}" if part.is_a?(Array)
|
160
|
-
|
161
159
|
"-#{part}"
|
162
160
|
end
|
163
161
|
|
@@ -2,7 +2,7 @@ require_relative "identifier/base"
|
|
2
2
|
require_relative "renderer/base"
|
3
3
|
|
4
4
|
module Pubid::Iso
|
5
|
-
class Transformer <
|
5
|
+
class Transformer < Pubid::Core::Transformer
|
6
6
|
rule(edition: "Ed") do
|
7
7
|
{ edition: "1" }
|
8
8
|
end
|
@@ -96,6 +96,10 @@ module Pubid::Iso
|
|
96
96
|
{ publisher: russian_publisher&.to_s || publisher }
|
97
97
|
end
|
98
98
|
|
99
|
+
rule(part: sequence(:part)) do
|
100
|
+
{ part: part.map(&:to_s).join("-") }
|
101
|
+
end
|
102
|
+
|
99
103
|
rule(joint_document: subtree(:joint_document)) do |context|
|
100
104
|
context[:joint_document] =
|
101
105
|
Identifier.create(**context[:joint_document])
|
@@ -108,36 +112,6 @@ module Pubid::Iso
|
|
108
112
|
context.select { |k, v| k != :dir_joint_document }
|
109
113
|
end
|
110
114
|
|
111
|
-
|
112
|
-
rule(roman_numerals: simple(:roman_numerals)) do |context|
|
113
|
-
roman_to_int(context[:roman_numerals])
|
114
|
-
# case roman_numerals
|
115
|
-
# when "III"
|
116
|
-
# 3
|
117
|
-
# else
|
118
|
-
# nil
|
119
|
-
# end
|
120
|
-
end
|
121
|
-
|
122
|
-
ROMAN_TO_INT = {
|
123
|
-
"I" => 1,
|
124
|
-
"V" => 5,
|
125
|
-
"X" => 10,
|
126
|
-
"L" => 50,
|
127
|
-
"C" => 100,
|
128
|
-
"D" => 500,
|
129
|
-
"M" => 1000,
|
130
|
-
}
|
131
|
-
|
132
|
-
def self.roman_to_int(roman)
|
133
|
-
sum = ROMAN_TO_INT[roman.to_s[0]]
|
134
|
-
roman.to_s.chars.each_cons(2) do |c1, c2|
|
135
|
-
sum += ROMAN_TO_INT[c2]
|
136
|
-
sum -= ROMAN_TO_INT[c1] * 2 if ROMAN_TO_INT[c1] < ROMAN_TO_INT[c2]
|
137
|
-
end
|
138
|
-
sum
|
139
|
-
end
|
140
|
-
|
141
115
|
def self.convert_stage(code)
|
142
116
|
russian_code = Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:stage].key(code.to_s)
|
143
117
|
return { stage: russian_code } if russian_code
|
data/lib/pubid/iso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,48 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: nokogiri
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: thor
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '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'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: lightly
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
41
|
- !ruby/object:Gem::Dependency
|
84
42
|
name: parslet
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +58,14 @@ dependencies:
|
|
100
58
|
requirements:
|
101
59
|
- - "~>"
|
102
60
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.8.
|
61
|
+
version: 1.8.6
|
104
62
|
type: :runtime
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
108
66
|
- - "~>"
|
109
67
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.8.
|
68
|
+
version: 1.8.6
|
111
69
|
description: Library to generate, parse and manipulate ISO PubID.
|
112
70
|
email:
|
113
71
|
- open.source@ribose.com
|