epuber 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/epuber/epubcheck.rb +28 -20
- data/lib/epuber/server.rb +1 -1
- data/lib/epuber/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d80c921e39a42f4b28674f6dda66ef56bab9b312ab3fc75bb4dbf5edfbdbcaa
|
4
|
+
data.tar.gz: 9f795d610ad9bdd2da76622cc1f0092976d026535d4b024c4eb93e376e1f20fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cab13905cd84cdb40179854ff843517980443a1d0d160d9f4bdb122d7fc7f7216db7c13d1f79fcaf51103d9c8e633417d50566ad524b0e502ea4cc6915687755
|
7
|
+
data.tar.gz: 5a13612e2a5e96e5ce38c5f4cbace79fa7cd052525a162650edde1400fe6bff3cdf8772ee916b36f8545f59b434b8ebc30e424deea78b0632b61f881099e1dcc
|
data/Gemfile
CHANGED
data/lib/epuber/epubcheck.rb
CHANGED
@@ -36,25 +36,6 @@ module Epuber
|
|
36
36
|
def error?
|
37
37
|
level == :error || level == :fatal
|
38
38
|
end
|
39
|
-
|
40
|
-
def self.from_json(json)
|
41
|
-
json_location = json['locations'].first
|
42
|
-
|
43
|
-
location = if json_location
|
44
|
-
Epuber::Location.new(
|
45
|
-
path: json_location['path'],
|
46
|
-
lineno: json_location['line'],
|
47
|
-
column: json_location['column'],
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
new(
|
52
|
-
level: json['severity'].downcase.to_sym,
|
53
|
-
code: json['ID'],
|
54
|
-
message: json['message'],
|
55
|
-
location: location,
|
56
|
-
)
|
57
|
-
end
|
58
39
|
end
|
59
40
|
|
60
41
|
class << self
|
@@ -76,14 +57,41 @@ module Epuber
|
|
76
57
|
report
|
77
58
|
end
|
78
59
|
|
60
|
+
# Parse json from epubcheck
|
61
|
+
#
|
79
62
|
# @param [String] string json string
|
80
63
|
# @return [Report]
|
81
64
|
#
|
82
65
|
def _parse_json(string)
|
83
66
|
json = JSON.parse(string)
|
84
67
|
messages = json['messages']
|
68
|
+
problems = messages
|
69
|
+
.map { |msg| _parse_locations(msg) }
|
70
|
+
.flatten
|
71
|
+
|
72
|
+
Report.new(problems: problems)
|
73
|
+
end
|
85
74
|
|
86
|
-
|
75
|
+
# Parse all problems from single message
|
76
|
+
#
|
77
|
+
# @param [Hash] json
|
78
|
+
# @return [Array<Problem>]
|
79
|
+
#
|
80
|
+
def _parse_locations(json)
|
81
|
+
json['locations'].map do |json_location|
|
82
|
+
location = Epuber::Location.new(
|
83
|
+
path: json_location['path'],
|
84
|
+
lineno: json_location['line'],
|
85
|
+
column: json_location['column'],
|
86
|
+
)
|
87
|
+
|
88
|
+
Problem.new(
|
89
|
+
level: json['severity'].downcase.to_sym,
|
90
|
+
code: json['ID'],
|
91
|
+
message: json['message'],
|
92
|
+
location: location,
|
93
|
+
)
|
94
|
+
end
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
data/lib/epuber/server.rb
CHANGED
data/lib/epuber/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epuber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Kříž
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|