softcover 1.0.beta15 → 1.0.beta16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/softcover/book.rb +2 -1
- data/lib/softcover/builders/mobi.rb +6 -3
- data/lib/softcover/sanitizer.rb +4 -1
- data/lib/softcover/version.rb +1 -1
- data/softcover.gemspec +1 -1
- data/spec/book_spec.rb +1 -0
- data/spec/sanitizer_spec.rb +15 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8137c81992908717396867abb601cd2848c9b51
|
4
|
+
data.tar.gz: 9eab005f7c11be7b6891e6155a184297ac68298c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 887cd0da96df9dd87cd932fef09a4c2531bf2b6388fe1962269cefbb1e0026065807b20d6524e88d8ac504b62f2a3cf58a979836f32ea96fea958d830964ffba
|
7
|
+
data.tar.gz: eda12cf4e9470df7ec1d42a1cd03c4794d47019066636f3e8954423bc4a6c5642fd78c1b43c07d427c6a9a7242fd98e9a8f45da85cd33b664875039ecaaeb90d
|
data/lib/softcover/book.rb
CHANGED
@@ -58,7 +58,8 @@ class Softcover::Book
|
|
58
58
|
|
59
59
|
# get array of paths and checksums
|
60
60
|
def files
|
61
|
-
paths = %W{html/#{slug}.html html/*_fragment.html images/**/* config/*
|
61
|
+
paths = %W{html/#{slug}.html html/*_fragment.html images/**/* config/*
|
62
|
+
html/stylesheets/custom.css}
|
62
63
|
Dir[*paths].map do |path|
|
63
64
|
BookFile.new(path) unless File.directory?(path)
|
64
65
|
end.compact
|
@@ -23,12 +23,15 @@ module Softcover
|
|
23
23
|
|
24
24
|
# Returns the command for making a MOBI, based on the options.
|
25
25
|
def mobi_command(filename, options={})
|
26
|
+
silent = options[:silent] || Softcover.test?
|
26
27
|
if options[:kindlegen]
|
27
|
-
"#{kindlegen} ebooks/#{filename}.epub"
|
28
|
+
cmd = "#{kindlegen} ebooks/#{filename}.epub"
|
28
29
|
else
|
29
|
-
"#{calibre} ebooks/#{filename}.epub ebooks/#{filename}.mobi" +
|
30
|
-
|
30
|
+
cmd = "#{calibre} ebooks/#{filename}.epub ebooks/#{filename}.mobi" +
|
31
|
+
" #{calibre_options}"
|
31
32
|
end
|
33
|
+
puts cmd unless (options[:quiet] || silent)
|
34
|
+
cmd
|
32
35
|
end
|
33
36
|
|
34
37
|
private
|
data/lib/softcover/sanitizer.rb
CHANGED
@@ -35,6 +35,9 @@ module Softcover
|
|
35
35
|
'tr' => %w{id class},
|
36
36
|
'td' => %w{id class colspan}
|
37
37
|
},
|
38
|
+
css: {
|
39
|
+
properties: %w{color height width}
|
40
|
+
},
|
38
41
|
protocols: {
|
39
42
|
'a' => {'href' => [:relative, 'http', 'https', 'mailto']},
|
40
43
|
'img' => {'src' => [:relative, 'http', 'https']}
|
@@ -45,4 +48,4 @@ module Softcover
|
|
45
48
|
Sanitize.clean(html.force_encoding("UTF-8"), sanitize_options)
|
46
49
|
end
|
47
50
|
end
|
48
|
-
end
|
51
|
+
end
|
data/lib/softcover/version.rb
CHANGED
data/softcover.gemspec
CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |gem|
|
|
38
38
|
gem.add_dependency 'coffee-script', '~> 2.2.0'
|
39
39
|
gem.add_dependency 'listen', '~> 1.3.1'
|
40
40
|
gem.add_dependency 'rb-fsevent', '~> 0.9.3'
|
41
|
-
gem.add_dependency 'sanitize', '~>
|
41
|
+
gem.add_dependency 'sanitize', '~> 3.0.3'
|
42
42
|
end
|
data/spec/book_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Softcover::Book do
|
|
14
14
|
its(:filenames) { should include "html/#{subject.slug}.html"}
|
15
15
|
|
16
16
|
its(:filenames) { should include "config/marketing.yml"}
|
17
|
+
its(:filenames) { should include "html/stylesheets/custom.css"}
|
17
18
|
|
18
19
|
its(:slug) { should eq "book" }
|
19
20
|
its(:url) { should match /\/books\/(.*?)\/redirect/ }
|
data/spec/sanitizer_spec.rb
CHANGED
@@ -11,23 +11,24 @@ describe Softcover::Sanitizer do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
context "safe html" do
|
14
|
-
let(:html) do
|
14
|
+
let(:html) do <<-EOS
|
15
15
|
<div id="a" class="b"></div>
|
16
16
|
<div data-tralics-id="c" data-number="d" data-chapter="e"></div>
|
17
|
-
<a id="
|
18
|
-
<span id="
|
19
|
-
<ol id="
|
20
|
-
<ul id="
|
21
|
-
<li id="
|
22
|
-
|
23
|
-
|
24
|
-
<
|
25
|
-
<
|
26
|
-
<
|
27
|
-
<
|
28
|
-
<
|
17
|
+
<a id="b" class="b" href="c"></a>
|
18
|
+
<span id="c" class="b" style="color:white"></span>
|
19
|
+
<ol id="d" class="b"></ol>
|
20
|
+
<ul id="e" class="b">
|
21
|
+
<li id="f" class="b">
|
22
|
+
</li>
|
23
|
+
</ul>
|
24
|
+
<sup id="g" class="b"></sup>
|
25
|
+
<h1 id="h" class="b"></h1>
|
26
|
+
<h2 id="i" class="b"></h2>
|
27
|
+
<h3 id="j" class="b"></h3>
|
28
|
+
<h4 id="k" class="b"></h4>
|
29
|
+
<img id="l" class="b" src="c" alt="d">
|
30
|
+
<em id="m" class="b"></em>
|
29
31
|
EOS
|
30
|
-
).to_xhtml
|
31
32
|
end
|
32
33
|
|
33
34
|
it "allows class and id" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softcover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.beta16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: polytexnic
|
@@ -283,14 +283,14 @@ dependencies:
|
|
283
283
|
requirements:
|
284
284
|
- - "~>"
|
285
285
|
- !ruby/object:Gem::Version
|
286
|
-
version:
|
286
|
+
version: 3.0.3
|
287
287
|
type: :runtime
|
288
288
|
prerelease: false
|
289
289
|
version_requirements: !ruby/object:Gem::Requirement
|
290
290
|
requirements:
|
291
291
|
- - "~>"
|
292
292
|
- !ruby/object:Gem::Version
|
293
|
-
version:
|
293
|
+
version: 3.0.3
|
294
294
|
description: CLI interface for softcover.io
|
295
295
|
email:
|
296
296
|
- michael@softcover.io
|
@@ -1071,7 +1071,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1071
1071
|
version: 1.3.1
|
1072
1072
|
requirements: []
|
1073
1073
|
rubyforge_project:
|
1074
|
-
rubygems_version: 2.
|
1074
|
+
rubygems_version: 2.4.4
|
1075
1075
|
signing_key:
|
1076
1076
|
specification_version: 4
|
1077
1077
|
summary: A typesetting system for technical authors
|