epuber 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/epuber/command/build.rb +2 -0
- data/lib/epuber/command/server.rb +2 -0
- data/lib/epuber/compiler/xhtml_processor.rb +7 -1
- data/lib/epuber/config.rb +14 -5
- data/lib/epuber/lockfile.rb +23 -9
- 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: 36b3de5a7595e7eb07e7604f51fe0e57f2610c9d4e65bd4efed8bf34a3f5d79a
|
4
|
+
data.tar.gz: 7b3413db0823660dee8cd28ac1e820c8cfd10b557e5be1e2c82afce72335a194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df514b965ad7e809d7c447556bd256f4d4329914b871d165f975ebb1673fda40f95c5957ba4867855b959e529269859cfc30e6b9ff62b86770c2432351b8e1d
|
7
|
+
data.tar.gz: 7d4e411ce744dfb5e61bc43c9a77e3b00866756f9a6dfd625cdf5adec2163d76b73ff9bd58453b3f3e737dc2e40b2eac192334efd4bf69244ab173f40697ca30
|
data/lib/epuber/command/build.rb
CHANGED
@@ -34,7 +34,7 @@ module Epuber
|
|
34
34
|
end
|
35
35
|
|
36
36
|
doctypes = []
|
37
|
-
while /(\n|\?>|\A)?(<![^>]*>\n*)/ =~ text
|
37
|
+
while /(\n|\?>|\A)?(<!DOCTYPE [^>]*>\n*)/ =~ text
|
38
38
|
doctypes << $2.strip
|
39
39
|
|
40
40
|
match = Regexp.last_match
|
@@ -103,6 +103,12 @@ module Epuber
|
|
103
103
|
|
104
104
|
html.children.first.before(head)
|
105
105
|
end
|
106
|
+
|
107
|
+
# https://github.com/IDPF/epubcheck/issues/631
|
108
|
+
if epub_version < 3.0
|
109
|
+
xhtml_doc.internal_subset.remove unless xhtml_doc.internal_subset.nil?
|
110
|
+
xhtml_doc.create_internal_subset('html', "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd")
|
111
|
+
end
|
106
112
|
end
|
107
113
|
|
108
114
|
# Method for adding style sheets with links, method will not add duplicate items
|
data/lib/epuber/config.rb
CHANGED
@@ -67,16 +67,15 @@ module Epuber
|
|
67
67
|
# @return [Epuber::Lockfile]
|
68
68
|
#
|
69
69
|
def bookspec_lockfile
|
70
|
-
@bookspec_lockfile ||= (
|
71
|
-
lockfile = Lockfile.from_file(bookspec_lockfile_path)
|
72
|
-
lockfile.version = Epuber::VERSION
|
73
|
-
lockfile
|
74
|
-
)
|
70
|
+
@bookspec_lockfile ||= Lockfile.from_file(bookspec_lockfile_path)
|
75
71
|
end
|
76
72
|
|
77
73
|
# @return nil
|
78
74
|
#
|
79
75
|
def save_lockfile
|
76
|
+
bookspec_lockfile.epuber_version = Epuber::VERSION
|
77
|
+
bookspec_lockfile.bade_version = Bade::VERSION
|
78
|
+
|
80
79
|
bookspec_lockfile.write_to_file
|
81
80
|
end
|
82
81
|
|
@@ -118,6 +117,16 @@ module Epuber
|
|
118
117
|
File.join(working_path, 'metadata', 'target_stats', target.name.to_s, 'file_stats.yml')
|
119
118
|
end
|
120
119
|
|
120
|
+
def warn_for_outdated_versions!
|
121
|
+
if bookspec_lockfile.epuber_version > Epuber::VERSION
|
122
|
+
UI.warning('Warning: the running version of Epuber is older than the version that created the lockfile. We suggest you upgrade to the latest version of Epuber by running `gem install epuber`')
|
123
|
+
end
|
124
|
+
|
125
|
+
if bookspec_lockfile.bade_version && bookspec_lockfile.bade_version > Bade::VERSION
|
126
|
+
UI.warning('Warning: the running version of Bade is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bade by running `gem install bade`')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
121
130
|
# ---------------------------------------------------------------------------------------------------------------- #
|
122
131
|
|
123
132
|
class << self
|
data/lib/epuber/lockfile.rb
CHANGED
@@ -17,11 +17,16 @@ module Epuber
|
|
17
17
|
#
|
18
18
|
def self.from_file(file_path)
|
19
19
|
if File.exists?(file_path)
|
20
|
-
hash = YAML.
|
20
|
+
hash = YAML.safe_load(File.read(file_path))
|
21
21
|
else
|
22
22
|
hash = {}
|
23
23
|
end
|
24
24
|
|
25
|
+
# backward compatibility for version 0.5 and older
|
26
|
+
if hash.include?('version')
|
27
|
+
hash['epuber_version'] = hash.delete('version')
|
28
|
+
end
|
29
|
+
|
25
30
|
inst = self.new(hash)
|
26
31
|
inst.defined_from_file = file_path
|
27
32
|
inst
|
@@ -32,24 +37,33 @@ module Epuber
|
|
32
37
|
def write_to_file
|
33
38
|
return if defined_from_file.nil?
|
34
39
|
|
35
|
-
File.
|
36
|
-
f.write(YAML.dump(@internal_data))
|
37
|
-
end
|
40
|
+
File.write(defined_from_file, @internal_data.to_yaml)
|
38
41
|
end
|
39
42
|
|
40
|
-
|
41
43
|
# @return [Epuber::Version]
|
42
44
|
#
|
43
|
-
def
|
44
|
-
@internal_data['
|
45
|
+
def epuber_version
|
46
|
+
Version.new(@internal_data['epuber_version'])
|
45
47
|
end
|
46
48
|
|
47
49
|
# @param [Epuber::Version] new_version
|
48
50
|
#
|
51
|
+
def epuber_version=(new_version)
|
52
|
+
@internal_data['epuber_version'] = new_version.to_s
|
53
|
+
end
|
54
|
+
|
49
55
|
# @return [Epuber::Version]
|
50
56
|
#
|
51
|
-
def
|
52
|
-
@internal_data['
|
57
|
+
def bade_version
|
58
|
+
value = @internal_data['bade_version']
|
59
|
+
value = Version.new(value) unless value.nil?
|
60
|
+
value
|
61
|
+
end
|
62
|
+
|
63
|
+
# @param [Epuber::Version] new_version
|
64
|
+
#
|
65
|
+
def bade_version=(new_version)
|
66
|
+
@internal_data['bade_version'] = new_version
|
53
67
|
end
|
54
68
|
end
|
55
69
|
end
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Kříž
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|