jekyll-ebook_reader 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ccdea2673cc4e1899604b328a1f43ed3709a362d5020dc9affe02f2a3afc4e44
4
+ data.tar.gz: c895480b789f80577cf8f1b6064bca2ca8270369dd564ed30337d13b647b2fdf
5
+ SHA512:
6
+ metadata.gz: 5d46a21953420e4b79c53c4364e78c645e6e77852ee3bb74d2c4e6a8e12e8e5cd3c45f5cdaff2ed0c75df3f2e4e879ebd6687c47f48f104119060ebd618ffbbb
7
+ data.tar.gz: 519f93377b19398884a9263cdde4103b32b2f6cd261a82a31a3fdd15109da27fe01d38dfa38628400c02c037ac99ef1327ec2eb7a47be9b05a609598399e8f5d
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.6.2
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.9
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-02-13
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll-ebook_reader.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Quinn Batten
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Jekyll::EbookReader
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jekyll/ebook_reader`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'jekyll-ebook_reader'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install jekyll-ebook_reader
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-ebook_reader.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "jekyll/ebook_reader"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jekyll/ebook_reader/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jekyll-ebook_reader"
7
+ spec.version = Jekyll::EbookReader::VERSION
8
+ spec.authors = ["Quinn Batten"]
9
+ spec.email = ["quinnbatten@mac.com"]
10
+
11
+ spec.summary = "Plugin to embed ebooks in your site."
12
+ spec.description = "EbookReader uses ePub.js to embed ebooks on any page or post you like."
13
+ spec.homepage = "https://www.quinnbatten.com/jekyllebookreader.html"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/qbatten/jekyll-ebook_reader.git"
19
+ spec.metadata["changelog_uri"] = "https://github.com/qbatten/jekyll-ebook_reader/blob/main/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "jekyll", ">= 3.0", "< 5.0"
31
+ spec.add_dependency "fileutils", ">= 1.1.0", "<= 1.5.0"
32
+
33
+ spec.add_development_dependency "bundler"
34
+ end
@@ -0,0 +1,66 @@
1
+ require "fileutils"
2
+ require "jekyll"
3
+
4
+
5
+ module Jekyll
6
+ module EbookReader
7
+ class EbookEmbed < Jekyll::Generator
8
+ safe false
9
+ priority :low
10
+ def generate(site)
11
+ @site = site
12
+ @site = site.static_files += add_all_static_files
13
+
14
+ end
15
+
16
+ private
17
+
18
+ # Destination for sitemap.xml file within the site source directory
19
+ def destination_path(file)
20
+ @site.in_dest_dir("/assets/jekyll-ebookreader/#{file}")
21
+ end
22
+
23
+ def static_files_to_include
24
+ ["reader.js" , "ebookreader_main.css", "ebookreader_iframe.css", "ajax-loader.gif"]
25
+ end
26
+
27
+ def add_all_static_files
28
+ files ||= []
29
+ static_files_to_include.each do |file_name|
30
+ incl = Jekyll::StaticFile.new(@site, File.join( File.dirname(__FILE__), 'ebook_reader'), "assets/jekyll-ebookreader-assets", file_name)
31
+ incl.destination(destination_path(file_name))
32
+ files.append(incl)
33
+ end
34
+ files
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+
42
+ class EBookReaderTag < Liquid::Tag
43
+ def initialize(tag_name, input, tokens)
44
+ super
45
+ @input = input
46
+ end
47
+
48
+ def render(context)
49
+ path = File.join(File.dirname(__FILE__), 'ebook_reader', "assets/jekyll-ebookreader-assets/ebook_include_body_tag.html")
50
+ include_string = File.read(path)
51
+ processed = Liquid::Template.parse(include_string).render(context)
52
+ return processed
53
+ end
54
+ end
55
+
56
+ # Add relevant scripts and style tags to doc head
57
+ Jekyll::Hooks.register [:pages, :posts], :post_render do |post|
58
+ path = File.join(File.dirname(__FILE__), 'ebook_reader', "assets/jekyll-ebookreader-assets/ebook_include_header.html")
59
+ include_string = File.read(path)
60
+
61
+ if post.data.has_key? ("ebook_path")
62
+ post.output = post.output.gsub("</head>", include_string + "</head>")
63
+ end
64
+ end
65
+
66
+ Liquid::Template.register_tag('ebook', EBookReaderTag)
@@ -0,0 +1,42 @@
1
+ <div id="ebook-includes">
2
+ <script type="text/javascript">
3
+ let ebookPath = "{{page.ebook.ebook_path}}" || "{{page.ebook_path}}";
4
+ let style_path = "{{page.ebook_iframe_custom_stylesheet}}" || "/assets/jekyll-ebookreader-assets/ebookreader_iframe.css"
5
+ let eBookRenderOptions = {
6
+ flow: "scrolled-doc",
7
+ ignoreClass: "annotator-hl",
8
+ width: "100%",
9
+ height: "100%",
10
+ stylesheet: style_path
11
+ }
12
+ document.addEventListener(
13
+ 'DOMContentLoaded',
14
+ () => launchEpubJS(ebookPath, eBookRenderOptions),
15
+ false);
16
+ </script>
17
+ <a id="opener">
18
+ <i class="material-icons">menu</i>
19
+ </a>
20
+ <div id="ebook-main">
21
+ <div id="viewer" class="loading"></div>
22
+ <span id="hiddenTitle"></span>
23
+ <div id="bottom-nav-arrows">
24
+ <a id="prev" href="#prev" class="arrow">
25
+ <i class="material-icons">chevron_left</i>
26
+ </a>
27
+ <a id="next" href="#next" class="arrow">
28
+ <i class="material-icons">chevron_right</i>
29
+ </a>
30
+ </div>
31
+ </div>
32
+ <div id="navigation">
33
+ <a id="closer">
34
+ <i class="material-icons">close</i>
35
+ </a>
36
+ <h1 id="title">...</h1>
37
+ <image id="cover" width="150px" />
38
+ <h2 id="author">...</h2>
39
+ <ul id="toc"></ul>
40
+ </div>
41
+ </div>
42
+ </div>
@@ -0,0 +1,3 @@
1
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js"></script><script src="https://cdn.jsdelivr.net/npm/epubjs/dist/epub.min.js"></script><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
2
+ <link rel="stylesheet" type="text/css" href="/assets/jekyll-ebookreader-assets/ebookreader_main.css">
3
+ <script src="/assets/jekyll-ebookreader-assets/reader.js"></script>
@@ -0,0 +1,348 @@
1
+ body {
2
+ font-size: 1em;
3
+ line-height: 1.33em;
4
+ font-family: 'Times New Roman', 'Georgia', serif;
5
+ font-variant-numeric: oldstyle-nums;
6
+ max-width: 100%;
7
+ background-color: rgb(255, 255, 255);
8
+ }
9
+
10
+ p {
11
+ padding: 4px 0px;
12
+ margin: 0px;
13
+ font-family: 'Times New Roman', 'Georgia', serif;
14
+ }
15
+
16
+ p.indent, p.nonindent {
17
+ text-align: left;
18
+ }
19
+
20
+ header+p:first-line {
21
+ text-transform: lowercase !important;
22
+ font-variant: small-caps;
23
+ font-size: 1.1em;
24
+ }
25
+
26
+ p+p {
27
+ text-indent: 1.33em;
28
+ }
29
+
30
+ .decoration-rw {
31
+ text-align: center;
32
+ padding-top: 1em;
33
+ padding-bottom: 1em;
34
+ padding-left: 0em;
35
+ padding-right: 0em;
36
+ }
37
+
38
+ .copyright-rw {
39
+ font-size: .8em;
40
+ line-height: 1em;
41
+ text-align: left;
42
+ padding-top: 2em;
43
+ }
44
+
45
+ .copyright-rw p {
46
+ margin-bottom: 1em;
47
+ text-indent: 0;
48
+ }
49
+
50
+ .dedication-rw p {
51
+ text-align: center;
52
+ text-indent: 0;
53
+ }
54
+
55
+ .Dedication-rw {
56
+ margin-top: 3em;
57
+ }
58
+
59
+ .leading-line-rw {
60
+ height: 1.33em;
61
+ }
62
+
63
+ .fp-rw {
64
+ text-indent: 0;
65
+ }
66
+
67
+
68
+
69
+ h1 {
70
+ font-size: 1.5em;
71
+ line-height: 1.33em;
72
+ text-align: center;
73
+ padding-bottom: 0em;
74
+ text-align: center;
75
+ text-transform: uppercase;
76
+ font-weight: normal;
77
+ letter-spacing: 4px;
78
+ }
79
+
80
+ h2 {
81
+ text-align: center;
82
+ font-size: 1.33em;
83
+ line-height: 1.2em;
84
+ text-align: center;
85
+ padding-bottom: 0em;
86
+ text-align: center;
87
+ text-transform: uppercase;
88
+ font-weight: normal;
89
+ letter-spacing: 3px;
90
+ }
91
+
92
+ .title-author-rw {
93
+ text-align: center;
94
+ font-size: 1.5em;
95
+ text-indent: 0;
96
+ }
97
+
98
+ .title-num-rw {
99
+ text-align: center;
100
+ font-size: 1.5em;
101
+ text-indent: 0;
102
+ margin-top: 1em;
103
+ margin-bottom: 1em;
104
+ }
105
+
106
+ .title-sub-rw {
107
+ text-align: center;
108
+ font-size: 1.5em;
109
+ text-indent: 0;
110
+ }
111
+
112
+ .imprint-rw {
113
+ text-align: center;
114
+ }
115
+
116
+ .extract-verse-rw {
117
+ margin-top: 1.33em;
118
+ margin-bottom: 1.33em;
119
+ padding-left: 20pt;
120
+ }
121
+
122
+ .extract-rw {
123
+ margin-top: 1.33em;
124
+ margin-bottom: 1.33em;
125
+ padding-left: 20pt;
126
+ }
127
+
128
+ .extract-verse-rw p {
129
+ text-align: left;
130
+ text-indent: -20pt;
131
+ margin-left: 20pt;
132
+ }
133
+
134
+ .epigraph-rw {
135
+ margin-top: 1.33em;
136
+ margin-bottom: 1.33em;
137
+ padding-left: 20pt;
138
+ padding-right: 20pt;
139
+ }
140
+
141
+ .sc-rw {
142
+ font-size: 75%;
143
+ }
144
+
145
+ .block-rw {
146
+ margin-top: 1em;
147
+ margin-bottom: 1em;
148
+ margin-left: 20pt;
149
+ margin-right: 20pt;
150
+ }
151
+
152
+ span.dropcap-rw {
153
+ float: left;
154
+ font-size: 2.7em;
155
+ line-height: .87em;
156
+ }
157
+
158
+
159
+ .signature-rw {
160
+ margin-left: 50%;
161
+ text-align: left;
162
+ text-indent: 0;
163
+ }
164
+
165
+ .AdCard-rw h4 {
166
+ text-align: center;
167
+ }
168
+
169
+ .AdCard-rw p {
170
+ text-align: center;
171
+ text-indent: 0;
172
+ }
173
+
174
+ .FrontSales-rw h4,
175
+ .FrontSales-rw h2 {
176
+ text-align: center;
177
+ }
178
+
179
+ .FrontSales-rw p {
180
+ text-indent: 0;
181
+ }
182
+
183
+
184
+
185
+ /* NAVIGATION */
186
+
187
+ a {
188
+ color: black !important;
189
+ }
190
+
191
+ #toc ol {
192
+ list-style-type: none;
193
+ margin: 0 0 0 2em;
194
+ padding: 0 0 0 0;
195
+ }
196
+
197
+ #toc ol ol {
198
+ list-style-type: none;
199
+ margin: 0 0 0 1em;
200
+ padding: 0 0 0 0;
201
+ }
202
+
203
+
204
+
205
+
206
+
207
+ #toc ol li {
208
+ margin: 0 0 0 0;
209
+ padding: 0 0 0 0;
210
+ }
211
+
212
+ #toc ol li a {
213
+ text-decoration: none;
214
+ font-family: sans-serif;
215
+ }
216
+
217
+ .toc-short ol li a {
218
+ text-decoration: none;
219
+ font-family: sans-serif;
220
+ }
221
+
222
+
223
+ .toc-short ol {
224
+ list-style-type: none;
225
+ margin: 0 0 0 2em;
226
+ padding: 0 0 0 0;
227
+ }
228
+
229
+
230
+ #guide {
231
+ display: none;
232
+ }
233
+
234
+
235
+ header {
236
+ padding: 3em 0 2em 0;
237
+ }
238
+
239
+ header a {
240
+ text-decoration: none;
241
+ color: black;
242
+ }
243
+
244
+
245
+
246
+
247
+
248
+ .center {
249
+ text-align: center;
250
+ text-indent: 0;
251
+ }
252
+
253
+ img {
254
+ max-width: 100%;
255
+ max-height: 100%;
256
+ }
257
+
258
+
259
+
260
+ .title-other-rw {
261
+ text-align: center;
262
+ text-indent: 0;
263
+ margin-top: .5em;
264
+ }
265
+
266
+ .dateline-rw {
267
+ text-align: left;
268
+ text-indent: 0;
269
+ margin-top: 1.33em;
270
+ margin-bottom: 1.33em;
271
+ }
272
+
273
+
274
+ .frontmatter-rw h1 {
275
+ font-size: 1.5em;
276
+ }
277
+
278
+ .backmatter-rw h1 {
279
+ font-size: 1.5em;
280
+ }
281
+
282
+
283
+
284
+ .direction-rw {
285
+ text-align: center;
286
+ text-indent: 0;
287
+ font-style: italic;
288
+ margin: 1em 0 1em 0;
289
+ }
290
+
291
+ .source-rw {
292
+ margin-bottom: 0em;
293
+ text-align: right !important;
294
+ font-variant: small-caps;
295
+ text-transform: lowercase;
296
+ font-size: 1.1em;
297
+ page-break-before: avoid;
298
+ }
299
+
300
+ div.block-rw {
301
+ border-top: 2px solid #EEE;
302
+ border-bottom: 2px solid #EEE;
303
+ padding: 6pt 0 6pt 0;
304
+ }
305
+
306
+ .list-simple-rw p {
307
+ text-indent: 0;
308
+ text-align: left;
309
+ }
310
+
311
+ .headline-rw p {
312
+ text-indent: 0;
313
+ text-align: center;
314
+ padding-top: 6px;
315
+ }
316
+
317
+ div.photo {
318
+ margin-top: 1em;
319
+ padding-top: 2em;
320
+ text-align: center;
321
+
322
+ }
323
+
324
+ div.photo p {
325
+ text-align: center;
326
+ padding: 6px;
327
+ font-style: italic;
328
+
329
+
330
+
331
+ }
332
+
333
+
334
+ .-epub-media-overlay-active {
335
+ background-color: #abc;
336
+ }
337
+
338
+ @media screen and (max-width: 500px) {
339
+ html body.hypothesis-highlights-always-on {
340
+ font-size: 15px;
341
+ }
342
+
343
+ body.hypothesis-highlights-always-on {
344
+ padding: 3%;
345
+ }
346
+
347
+ body.
348
+ }