my_ebook_pub 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -13
- data/bin/assets/template.erb +0 -3
- data/bin/pub +6 -20
- data/lib/my_ebook_pub.rb +13 -46
- data/lib/my_ebook_pub/version.rb +1 -1
- data/my_ebook_pub.gemspec +1 -0
- metadata +3 -5
- data/bin/assets/epub.css +0 -57
- data/bin/assets/metadata.xml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67fee77c6ae7a46fc5e8ccfa76c6239370de424
|
4
|
+
data.tar.gz: e59191feb0bb746cb97f0c24ea8890afb348d501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e41eb4d5d8f20757985e37a540cbc71ac9aea03f431fef1bfb24ac59187c731924b1f37238fdb089df860088312309c64d9efeee795a07002bc25d157cd59c4
|
7
|
+
data.tar.gz: 8cf6b6f0e161a01b573b63a98bc71d26eecf4e7dde4bc87c82c52f01799493a2691aaa25b6090e06e8911b342891582cc0e33f3e966961b8acc0ce0cb183beba
|
data/README.md
CHANGED
@@ -24,11 +24,7 @@ Or install it yourself as:
|
|
24
24
|
> pub
|
25
25
|
Usage:
|
26
26
|
pub new
|
27
|
-
pub generate
|
28
|
-
|
29
|
-
options:
|
30
|
-
If no filetype specified, pdf will be used
|
31
|
-
Available file types: pdf, epub, mobi
|
27
|
+
pub generate
|
32
28
|
```
|
33
29
|
|
34
30
|
### New
|
@@ -73,14 +69,6 @@ Assets
|
|
73
69
|
> pub generate
|
74
70
|
Generating PDF to output directory...
|
75
71
|
Your file is ready. See ./output/render.pdf
|
76
|
-
|
77
|
-
> pub generate epub
|
78
|
-
Generating PDF to output directory...
|
79
|
-
Your file is ready. See ./output/render.epub
|
80
|
-
|
81
|
-
> pub generate mobi
|
82
|
-
Generating PDF to output directory...
|
83
|
-
Your file is ready. See ./output/render.mobi
|
84
72
|
```
|
85
73
|
|
86
74
|
## Contributing
|
data/bin/assets/template.erb
CHANGED
data/bin/pub
CHANGED
@@ -1,24 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'fileutils'
|
3
2
|
|
4
|
-
|
5
|
-
options = ''
|
6
|
-
if ARGV[1]
|
7
|
-
options = ARGV[1]
|
8
|
-
else
|
9
|
-
options = 'pdf'
|
10
|
-
end
|
11
|
-
options
|
12
|
-
end
|
3
|
+
require 'fileutils'
|
13
4
|
|
14
5
|
case ARGV[0]
|
15
6
|
when 'new'
|
16
7
|
STDOUT.puts 'Creating new pub directory structure...'
|
17
8
|
FileUtils.mkpath 'content/chapters'
|
18
|
-
FileUtils.touch 'content/acknowledgements.md'
|
19
9
|
FileUtils.touch 'content/cover.md'
|
20
10
|
FileUtils.touch 'content/preface.md'
|
21
|
-
FileUtils.touch 'content/chapters/
|
11
|
+
FileUtils.touch 'content/chapters/1.md'
|
22
12
|
FileUtils.mkdir 'output'
|
23
13
|
FileUtils.mkdir 'assets'
|
24
14
|
FileUtils.cp_r(Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'assets', '*')),
|
@@ -26,18 +16,14 @@ when 'new'
|
|
26
16
|
STDOUT.puts Dir.glob('**/*')
|
27
17
|
STDOUT.puts 'Your project is ready for content!'
|
28
18
|
when 'generate', 'gen'
|
29
|
-
STDOUT.puts 'Generating
|
19
|
+
STDOUT.puts 'Generating PDF to output directory...'
|
30
20
|
require 'my_ebook_pub'
|
31
|
-
MyEbookPub.generate
|
32
|
-
STDOUT.puts
|
21
|
+
MyEbookPub.generate
|
22
|
+
STDOUT.puts 'Your file is ready. See ./output/render.pdf'
|
33
23
|
else
|
34
24
|
STDOUT.puts <<-EOF
|
35
25
|
Usage:
|
36
26
|
pub new
|
37
|
-
pub generate
|
38
|
-
|
39
|
-
options:
|
40
|
-
If no filetype specified, pdf will be used
|
41
|
-
Available file types: pdf, epub, mobi
|
27
|
+
pub generate
|
42
28
|
EOF
|
43
29
|
end
|
data/lib/my_ebook_pub.rb
CHANGED
@@ -94,7 +94,7 @@ HERE
|
|
94
94
|
|
95
95
|
def raw_content
|
96
96
|
content = ""
|
97
|
-
Dir.glob("#{@location}/chapters/*.md").each do |chapter|
|
97
|
+
Dir.glob("#{@location}/chapters/*.md").sort.each do |chapter|
|
98
98
|
content << File.read(chapter)
|
99
99
|
end
|
100
100
|
content
|
@@ -104,54 +104,21 @@ HERE
|
|
104
104
|
@renderer_content.render(raw_content)
|
105
105
|
end
|
106
106
|
|
107
|
-
def generate
|
107
|
+
def generate # to PDF
|
108
108
|
@location = 'content'
|
109
|
-
@content = cover + preface +
|
109
|
+
@content = cover + preface + toc + content
|
110
110
|
html = ERB.new(@template).result(binding)
|
111
|
-
product_name = '
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
c.from = 'html'
|
122
|
-
c.to = 'pdf'
|
123
|
-
c.content = html
|
124
|
-
Dir.glob('assets/*') do |asset|
|
125
|
-
c.add_other_file asset
|
126
|
-
end
|
127
|
-
end)
|
128
|
-
end
|
129
|
-
when 'epub'
|
130
|
-
File.open("output/#{product_name}.epub", 'w+') do |file|
|
131
|
-
file.write(Docverter::Conversion.run do |c|
|
132
|
-
c.from = 'markdown'
|
133
|
-
c.to = 'epub'
|
134
|
-
c.content = raw_content
|
135
|
-
c.epub_metadata = 'metadata.xml'
|
136
|
-
c.epub_stylesheet = 'epub.css'
|
137
|
-
c.add_other_file 'assets/epub.css'
|
138
|
-
c.add_other_file 'assets/metadata.xml'
|
139
|
-
end)
|
140
|
-
end
|
141
|
-
when 'mobi'
|
142
|
-
File.open("output/#{product_name}.mobi", 'w+') do |file|
|
143
|
-
file.write(Docverter::Conversion.run do |c|
|
144
|
-
c.from = 'markdown'
|
145
|
-
c.to = 'mobi'
|
146
|
-
c.content = raw_content
|
147
|
-
c.epub_metadata = 'metadata.xml'
|
148
|
-
c.epub_stylesheet = 'epub.css'
|
149
|
-
c.add_other_file 'assets/epub.css'
|
150
|
-
c.add_other_file 'assets/metadata.xml'
|
151
|
-
end)
|
152
|
-
end
|
111
|
+
product_name = 'render'
|
112
|
+
File.open("output/#{product_name}.pdf", 'w+') do |f|
|
113
|
+
f.write(Docverter::Conversion.run do |c|
|
114
|
+
c.from = 'html'
|
115
|
+
c.to = 'pdf'
|
116
|
+
c.content = html
|
117
|
+
Dir.glob('assets/*') do |asset|
|
118
|
+
c.add_other_file asset
|
119
|
+
end
|
120
|
+
end)
|
153
121
|
end
|
154
|
-
|
155
122
|
end
|
156
123
|
|
157
124
|
end
|
data/lib/my_ebook_pub/version.rb
CHANGED
data/my_ebook_pub.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
#spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
18
|
spec.executables = ["pub"]
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_ebook_pub
|
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
|
- Dave Haeffner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,8 +109,6 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
111
|
- bin/assets/droid_sans.ttf
|
112
|
-
- bin/assets/epub.css
|
113
|
-
- bin/assets/metadata.xml
|
114
112
|
- bin/assets/template.erb
|
115
113
|
- bin/pub
|
116
114
|
- lib/my_ebook_pub.rb
|
@@ -136,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
134
|
version: '0'
|
137
135
|
requirements: []
|
138
136
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.6.11
|
140
138
|
signing_key:
|
141
139
|
specification_version: 4
|
142
140
|
summary: A simple ebook creator. Turns Markdown files into PDF, EPUB, and MOBI with
|
data/bin/assets/epub.css
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
/* This defines styles and classes used in the book */
|
2
|
-
body { margin-left: 5%; margin-right: 5%; margin-top: 5%; margin-bottom: 5%; text-align: justify; font-size: medium; }
|
3
|
-
code { font-family: monospace; }
|
4
|
-
h1 { text-align: center; }
|
5
|
-
h2 { text-align: center; }
|
6
|
-
h3 { text-align: center; }
|
7
|
-
h4 { text-align: center; }
|
8
|
-
h5 { text-align: center; }
|
9
|
-
h6 { text-align: center; }
|
10
|
-
h1.title { }
|
11
|
-
h2.author { }
|
12
|
-
h3.date { }
|
13
|
-
/* For source-code highlighting */
|
14
|
-
|
15
|
-
h1, h2, h3, h4 {
|
16
|
-
-webkit-hyphens: none;
|
17
|
-
hyphens: none;
|
18
|
-
adobe-hyphenate: none;
|
19
|
-
}
|
20
|
-
|
21
|
-
pre.sourceCode {
|
22
|
-
white-space: pre-wrap;
|
23
|
-
font-family: monospace;
|
24
|
-
font-size: 85%;
|
25
|
-
display: block;
|
26
|
-
-webkit-hyphens: none;
|
27
|
-
hyphens: none;
|
28
|
-
adobe-hyphenate: none;
|
29
|
-
}
|
30
|
-
|
31
|
-
code.sourceCode {
|
32
|
-
white-space: pre-wrap;
|
33
|
-
font-family: monospace;
|
34
|
-
font-size: 85%;
|
35
|
-
display: block;
|
36
|
-
-webkit-hyphens: none;
|
37
|
-
hyphens: none;
|
38
|
-
adobe-hyphenate: none;
|
39
|
-
}
|
40
|
-
|
41
|
-
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
|
42
|
-
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
|
43
|
-
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
|
44
|
-
td.sourceCode { padding-left: 5px; }
|
45
|
-
code.sourceCode span.kw { color: #007020; font-weight: bold; }
|
46
|
-
code.sourceCode span.dt { color: #902000; }
|
47
|
-
code.sourceCode span.dv { color: #40a070; }
|
48
|
-
code.sourceCode span.bn { color: #40a070; }
|
49
|
-
code.sourceCode span.fl { color: #40a070; }
|
50
|
-
code.sourceCode span.ch { color: #4070a0; }
|
51
|
-
code.sourceCode span.st { color: #4070a0; }
|
52
|
-
code.sourceCode span.co { color: #60a0b0; font-style: italic; }
|
53
|
-
code.sourceCode span.ot { color: #007020; }
|
54
|
-
code.sourceCode span.al { color: red; font-weight: bold; }
|
55
|
-
code.sourceCode span.fu { color: #06287e; }
|
56
|
-
code.sourceCode span.re { }
|
57
|
-
code.sourceCode span.er { color: red; font-weight: bold; }
|
data/bin/assets/metadata.xml
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
<dc:title>The Selenium Guidebook Java Edition: How To Use Selenium, successfully</dc:title>
|
2
|
-
<dc:language>en-US</dc:language>
|
3
|
-
<dc:rights>Copyright (c) 2015 Dave Haeffner. All rights reserved.</dc:rights>
|
4
|
-
<dc:creator>Dave Haeffner</dc:creator>
|
5
|
-
<dc:author>Dave Haeffner</dc:author>
|
6
|
-
<dc:date>2015-02-10</dc:date>
|