asciidoctor-epub3 1.5.0.alpha.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/CHANGELOG.adoc +199 -0
- data/Gemfile +16 -0
- data/LICENSE.adoc +25 -0
- data/NOTICE.adoc +54 -0
- data/README.adoc +1001 -0
- data/Rakefile +5 -0
- data/asciidoctor-epub3.gemspec +42 -0
- data/bin/adb-push-ebook +35 -0
- data/bin/asciidoctor-epub3 +30 -0
- data/data/fonts/assorted-icons.ttf +0 -0
- data/data/fonts/fontawesome-icons.ttf +0 -0
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bolditalic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
- data/data/fonts/mplus1p-bold-latin-cyrillic.ttf +0 -0
- data/data/fonts/mplus1p-bold-latin-ext.ttf +0 -0
- data/data/fonts/mplus1p-bold-latin.ttf +0 -0
- data/data/fonts/mplus1p-bold-multilingual.ttf +0 -0
- data/data/fonts/mplus1p-light-latin-cyrillic.ttf +0 -0
- data/data/fonts/mplus1p-light-latin-ext.ttf +0 -0
- data/data/fonts/mplus1p-light-latin.ttf +0 -0
- data/data/fonts/mplus1p-light-multilingual.ttf +0 -0
- data/data/fonts/mplus1p-regular-latin-cyrillic.ttf +0 -0
- data/data/fonts/mplus1p-regular-latin-ext.ttf +0 -0
- data/data/fonts/mplus1p-regular-latin.ttf +0 -0
- data/data/fonts/mplus1p-regular-multilingual.ttf +0 -0
- data/data/fonts/notoserif-bold-latin-cyrillic.ttf +0 -0
- data/data/fonts/notoserif-bold-latin-ext.ttf +0 -0
- data/data/fonts/notoserif-bold-latin.ttf +0 -0
- data/data/fonts/notoserif-bold-multilingual.ttf +0 -0
- data/data/fonts/notoserif-bolditalic-latin-cyrillic.ttf +0 -0
- data/data/fonts/notoserif-bolditalic-latin-ext.ttf +0 -0
- data/data/fonts/notoserif-bolditalic-latin.ttf +0 -0
- data/data/fonts/notoserif-bolditalic-multilingual.ttf +0 -0
- data/data/fonts/notoserif-italic-latin-cyrillic.ttf +0 -0
- data/data/fonts/notoserif-italic-latin-ext.ttf +0 -0
- data/data/fonts/notoserif-italic-latin.ttf +0 -0
- data/data/fonts/notoserif-italic-multilingual.ttf +0 -0
- data/data/fonts/notoserif-regular-latin-cyrillic.ttf +0 -0
- data/data/fonts/notoserif-regular-latin-ext.ttf +0 -0
- data/data/fonts/notoserif-regular-latin.ttf +0 -0
- data/data/fonts/notoserif-regular-multilingual.ttf +0 -0
- data/data/images/default-avatar.jpg +0 -0
- data/data/images/default-avatar.png +0 -0
- data/data/images/default-avatar.svg +67 -0
- data/data/images/default-cover.svg +53 -0
- data/data/images/default-headshot.jpg +0 -0
- data/data/images/default-headshot.png +0 -0
- data/data/styles/color-palette.css +28 -0
- data/data/styles/epub3-css3-only.css +226 -0
- data/data/styles/epub3-fonts.css +94 -0
- data/data/styles/epub3.css +1266 -0
- data/lib/asciidoctor-epub3.rb +11 -0
- data/lib/asciidoctor-epub3/converter.rb +951 -0
- data/lib/asciidoctor-epub3/ext.rb +4 -0
- data/lib/asciidoctor-epub3/ext/asciidoctor.rb +3 -0
- data/lib/asciidoctor-epub3/ext/asciidoctor/logging_shim.rb +33 -0
- data/lib/asciidoctor-epub3/ext/core.rb +3 -0
- data/lib/asciidoctor-epub3/ext/core/string.rb +9 -0
- data/lib/asciidoctor-epub3/font_icon_map.rb +378 -0
- data/lib/asciidoctor-epub3/packager.rb +722 -0
- data/lib/asciidoctor-epub3/spine_item_processor.rb +92 -0
- data/lib/asciidoctor-epub3/version.rb +7 -0
- metadata +237 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 761bc4b79a56daa0101477d7e58da7e5bcfa33f1a23e0f58ded5639ea1f91241
|
4
|
+
data.tar.gz: dc6068f91e7c7284f7e3891ea74d42014255eb7e318911e85be3fbfbbba8fbb1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9691e8c859d1a4b8c27f5e1cf2999450ba6dc5dc53b5841084a734196de6ffc6eb6158bec6bd9dda70cfa869837d466e02bd7db9ca524fd27f72b417ad77bc37
|
7
|
+
data.tar.gz: 1d7f3bc67a899f05596ca5be57aedee0e737a0ec2243767faf2ea1f3ad2fcef40b6111d5a6798a9156ca73872df90e3e7338acf5c395d5b0f41d5523cab639e9
|
data/.yardopts
ADDED
data/CHANGELOG.adoc
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
= {project-name} Changelog
|
2
|
+
:project-name: Asciidoctor EPUB3
|
3
|
+
:uri-repo: https://github.com/asciidoctor/asciidoctor-epub3
|
4
|
+
|
5
|
+
This document provides a high-level view of the changes to the {project-name} by release.
|
6
|
+
For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
|
7
|
+
|
8
|
+
== 1.5.0.alpha.12 (2020-02-02) - @slonopotamus
|
9
|
+
|
10
|
+
* make kindlegen a runtime dependency so it installs automatically during `gem install asciidoctor-epub3` (#270)
|
11
|
+
* make `KINDLEGEN` env var work again (#269)
|
12
|
+
* stop adding default front cover image (#180)
|
13
|
+
* enable Pygments on non-Windows JRuby platforms (#264)
|
14
|
+
* provide a human-readable error message when we fail to find KindleGen (#268)
|
15
|
+
* try to use KindleGen/EPUBCheck binary from `$PATH` (#276)
|
16
|
+
* add `ebook-kindlegen-path`/`ebook-epubcheck-path` attributes to override KindleGen/EPUBCheck executable location (#276)
|
17
|
+
|
18
|
+
== 1.5.0.alpha.11 (2020-01-26) - @slonopotamus
|
19
|
+
|
20
|
+
* drop unused dependencies: thread_safe, concurrent-ruby (#234)
|
21
|
+
* add support for Unicode characters in chapter IDs (#217)
|
22
|
+
* fix sample-book to be a valid book (#196)
|
23
|
+
* don't insert quotation marks around quotes (#129)
|
24
|
+
* require at least Asciidoctor 1.5.3 (#245)
|
25
|
+
* remove Namo Reader font-icon quirk that produced invalid markup (#192)
|
26
|
+
* fix the (in)famous `undefined method `to_ios'` when given a document that doesn't follow asciidoctor-epub3 rules (#7)
|
27
|
+
* route messages through the logger (#176)
|
28
|
+
* update EPUBCheck to 4.2.2.0 (#240)
|
29
|
+
* handle invalid `revdate` gracefully (#14)
|
30
|
+
* do not post-process EPUBCHECK env var, but use it as-is (#258)
|
31
|
+
* disable Pygments on JRuby to prevent hanging (#253)
|
32
|
+
* fix ENOENT error when trying to run EPUBcheck on JRuby on Windows (#256)
|
33
|
+
* fix ENOENT error when running kindlegen on JRuby on Windows (#154)
|
34
|
+
* set up CI for JRuby on Windows (#254)
|
35
|
+
|
36
|
+
== 1.5.0.alpha.10 (2020-01-20) - @slonopotamus
|
37
|
+
|
38
|
+
* fix deep xrefs between chapters when using Asciidoctor 2 (#210)
|
39
|
+
* switch from epubcheck to epubcheck-ruby (#224)
|
40
|
+
* set up a test suite (#11)
|
41
|
+
* set up rubocop to enforce a consistent code style (#223)
|
42
|
+
* use GitHub Actions for CI and release process (#218)
|
43
|
+
* fix JS causing malformed XML that prevented footnotes from being displayed in Calibre (#207)
|
44
|
+
* fix installing on Windows (#213, #216)
|
45
|
+
* upgrade pygments.rb to 1.2.1 (#216)
|
46
|
+
* gepub dependency is no longer locked to 1.0.2 and will use latest 1.0.x version
|
47
|
+
* fix `-a ebook-validate` not working on Windows (#232)
|
48
|
+
|
49
|
+
== 1.5.0.alpha.9 (2019-04-04) - @mojavelinux
|
50
|
+
|
51
|
+
* allow converter to be used with Asciidoctor 2 (#185)
|
52
|
+
* upgrade gepub (and, indirectly, nokogiri) (#177)
|
53
|
+
* add support for start attribute on ordered list
|
54
|
+
* don't add end mark to chapter when publication-type is book (#163)
|
55
|
+
* drop unsupported versions of Ruby from CI matrix
|
56
|
+
|
57
|
+
== 1.5.0.alpha.8 (2018-02-20) - @mojavelinux
|
58
|
+
|
59
|
+
* include inline images in EPUB3 archive (#5)
|
60
|
+
* allow chapter to begin with level-1 section title by adding support for negative leveloffset (#107)
|
61
|
+
* don't transform the chapter title to uppercase (rely on CSS only) (#97)
|
62
|
+
* set correct mimetype for TTF files (#120)
|
63
|
+
* implement support for the custom xrefstyle for references within a chapter (#132)
|
64
|
+
* show correct path of front cover image and the current document when missing (#124)
|
65
|
+
* retain ID of block image (#141)
|
66
|
+
* retain ID of example block (#143)
|
67
|
+
* retain ID of admonition block (#146)
|
68
|
+
* transfer role specified on block image to output (#145)
|
69
|
+
* handle nil response from pygments.rb (#156)
|
70
|
+
* invert the colors for the chapter title (use black on white) (#96)
|
71
|
+
* darken font on Kindle Paperwhite devices (#67)
|
72
|
+
|
73
|
+
== 1.5.0.alpha.7 (2017-04-18) - @mojavelinux
|
74
|
+
|
75
|
+
* generate TOC levels in navigation document based on toclevels attribute (#90)
|
76
|
+
* automatically resolve title of reference between documents (#87)
|
77
|
+
* fix xref between chapter files (#27)
|
78
|
+
* don't include byline in chapter header if the value of the publication-type attribute is book (#86)
|
79
|
+
* don't include avatars if value of publication-type attribute is book (#53)
|
80
|
+
* make a stronger statement in the README about the dangers of the “Send to Kindle” tool
|
81
|
+
* add ebook-compress flag to enable huffdic compression in kindlegen
|
82
|
+
* implement embedded to handle AsciiDoc table cell content (#69)
|
83
|
+
* go into more depth about how to structure the document in README (#45)
|
84
|
+
* explain how to adjust section level of chapters if they use level-2 headings
|
85
|
+
* don't add content image to archive more than once (#76)
|
86
|
+
* warn when xref cannot be resolved and text is provided (#103)
|
87
|
+
* built-in avatar location should respect imagesdir (#2)
|
88
|
+
* change admonition icons (#72) (@PrimaryFeather)
|
89
|
+
* fix broken refs in bibliography (#19)
|
90
|
+
* remove text justification hack (#92)
|
91
|
+
* reset @page for CSS3-capable readers
|
92
|
+
* detect Calibre, set class attribute on body to calibre-desktop, add page margins
|
93
|
+
* force preformatted text to wrap in Gitden
|
94
|
+
* add svg property to front matter only if reference to SVG is detected
|
95
|
+
* switch from word-wrap to standard overflow-wrap property in stylesheet
|
96
|
+
* loosen letter spacing in quote attribute context
|
97
|
+
* adjust font size and margins on Gitden; force margins to be set
|
98
|
+
* document in README that using vw units causes Aldiko to crash
|
99
|
+
* drop trailing semi-colon in value of inline style attributes
|
100
|
+
* use standard format (from core) for warning and error messages
|
101
|
+
* update terminology in README; use ebook instead of e-book; refer to application as ereader
|
102
|
+
* allow front-cover-image to be specified using block image macro (#3)
|
103
|
+
* clean auto-generated file names for chapters (#46)
|
104
|
+
* register chapter ID in references
|
105
|
+
* only wrap open block content in div if id or role is defined (@rvolz)
|
106
|
+
* link to EPUB 3.1 spec from README
|
107
|
+
* set ebook-format-kf8 attribute when ebook-format is specified as mobi
|
108
|
+
* document the front-cover-image attribute properly
|
109
|
+
* update adb-push-book script to honor file extension if specified
|
110
|
+
* document limitations of applying page-break-* property on Kindle
|
111
|
+
* document that Asciidoctor is added as creator if creator attribute is not specified (#68)
|
112
|
+
* group optional gems in the :optional group; remove from gemspec
|
113
|
+
* upgrade kindlegen gem to 3.0.3
|
114
|
+
* upgrade Pygments to 1.1.1 and allow JRuby to install it
|
115
|
+
* document that Pygments bw style is used by default
|
116
|
+
* honor explicit table width even when autowidth option is set
|
117
|
+
* use method_defined? instead of respond_to? to check if method is already defined
|
118
|
+
* fix README typo, strong tag misspelled (@neontapir)
|
119
|
+
* fix name of bundler gem; add NOKOGIRI_USE_SYSTEM_LIBRARIES to install command
|
120
|
+
* state in README that the spine document must only have include directives as content
|
121
|
+
|
122
|
+
== 1.5.0.alpha.6 (2016-01-05) - @mojavelinux
|
123
|
+
|
124
|
+
* disable text-rendering: optimizeLegibility on Kindle devices (#58)
|
125
|
+
* proxy CSS in KF8 format to work around KDP removing font-related CSS rules
|
126
|
+
* don't append source when generating mobi file
|
127
|
+
* disable -webkit-hyphens to prevent Kindle for Mac from crashing (#26)
|
128
|
+
* don't explicitly enable hyphenation
|
129
|
+
* disable hyphens in preformatted text
|
130
|
+
* don't fail if source block is empty
|
131
|
+
* hide style element in body from Aldiko
|
132
|
+
* enable Original (Publisher) font option in iBooks client
|
133
|
+
* preserve heading & monospaced fonts in Kindle Paperwhite/Voyage
|
134
|
+
* force left justification in listings (fix for Namo)
|
135
|
+
* fix documentation regarding uuid attribute (@chkal)
|
136
|
+
* add note that currently images must be placed in a directory called images (@chkal)
|
137
|
+
* fix file type of avatar image in docs (@chkal)
|
138
|
+
* document how to install the pre-release gem (#38)
|
139
|
+
* use built-in font names for mobi7 (#56)
|
140
|
+
* document the epub3-stylesdir attribute
|
141
|
+
* prevent ellipsis from being used in inline code
|
142
|
+
* don't include scoped icon CSS in KF8 format
|
143
|
+
* remove link color hack for Gitden since its already covered
|
144
|
+
* override heading and monospace fonts for non-Kindle epub3 readers
|
145
|
+
* wrap simple dd content in span to allow font to be controlled in iBooks
|
146
|
+
* enforce use of monospace font for preformatted elements
|
147
|
+
* upgrade kindlegen
|
148
|
+
* don't allow UI button to wrap
|
149
|
+
* remove amzn-mobi from media query in CSS3-only file
|
150
|
+
* use CSS property word-wrap instead of word-break
|
151
|
+
* remove charset declaration from CSS
|
152
|
+
* switch samples to modern AsciiDoc syntax
|
153
|
+
|
154
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.6[issues resolved] |
|
155
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.6[git tag]
|
156
|
+
|
157
|
+
== 1.5.0.alpha.5 (2015-11-01) - @mojavelinux
|
158
|
+
|
159
|
+
* implement -o flag (output file) (#31) (@chloerei)
|
160
|
+
* implement the converter method for floating_title (#36)
|
161
|
+
* don't print kindlegen output if -q flag is used (#34)
|
162
|
+
* CLI now identifies as asciidoctor-epub3 (#32)
|
163
|
+
|
164
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.5[issues resolved] |
|
165
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.5[git tag]
|
166
|
+
|
167
|
+
== 1.5.0.alpha.4 (2014-11-28) - @mojavelinux
|
168
|
+
|
169
|
+
* set ebook-format-epub3 attribute (#16)
|
170
|
+
* add box drawing symbols to M+ 1mn font
|
171
|
+
* switch version to 1.5.0.x to align with core
|
172
|
+
|
173
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.4[issues resolved] |
|
174
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.4[git tag]
|
175
|
+
|
176
|
+
== 1.0.0.alpha.3 (2014-08-17) - @mojavelinux
|
177
|
+
|
178
|
+
* don't attempt to chdir to DATA_DIR; use full path; for compatibility with AsciidoctorJ
|
179
|
+
* fix BOM regexp in JRuby (again)
|
180
|
+
* switch sample png avatars to jpg
|
181
|
+
* don't install pygments.rb on JRuby
|
182
|
+
|
183
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.4[git tag]
|
184
|
+
|
185
|
+
== 1.0.0.alpha.2 (2014-08-15) - @mojavelinux
|
186
|
+
|
187
|
+
* upgrade to Asciidoctor 1.5.0
|
188
|
+
* use new functionality of doctitle method for splitting up doctitle
|
189
|
+
* don't put units on line-height in stylesheet
|
190
|
+
* use regexp to match the BOM character (used to fix text justification) in JRuby
|
191
|
+
|
192
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.2[git tag]
|
193
|
+
|
194
|
+
== 1.0.0.alpha.1 (2014-07-29) - @mojavelinux
|
195
|
+
|
196
|
+
* initial pre-release
|
197
|
+
|
198
|
+
{uri-repo}/issues?q=milestone%3Av1.0.0.alpha.1[issues resolved] |
|
199
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.1[git tag]
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Look in asciidoctor-epub3.gemspec for runtime and development dependencies.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'asciidoctor', ENV['ASCIIDOCTOR_VERSION'], require: false if ENV.key? 'ASCIIDOCTOR_VERSION'
|
9
|
+
|
10
|
+
group :optional do
|
11
|
+
gem 'pygments.rb', '1.2.1'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :docs do
|
15
|
+
gem 'yard', require: false
|
16
|
+
end
|
data/LICENSE.adoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
[[LICENSE]]
|
2
|
+
= LICENSE
|
3
|
+
|
4
|
+
.The MIT License
|
5
|
+
....
|
6
|
+
Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
25
|
+
....
|
data/NOTICE.adoc
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
[[NOTICE]]
|
2
|
+
= Asciidoctor EPUB3
|
3
|
+
|
4
|
+
Copyright (C) 2014-2016 OpenDevise Inc. and the Asciidoctor Project.
|
5
|
+
|
6
|
+
Please visit the Asciidoctor project site for more information:
|
7
|
+
|
8
|
+
- http://asciidoctor.org
|
9
|
+
|
10
|
+
OpenDevise Inc. and the Asciidoctor Project licenses this product to you under the MIT License (the "License").
|
11
|
+
You may not use this product except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at:
|
13
|
+
|
14
|
+
http://opensource.org/licenses/MIT
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and limitations under the License.
|
18
|
+
|
19
|
+
== Third-party licensed work
|
20
|
+
|
21
|
+
M+ OUTLINE FONTS (M+ TESTFLIGHT 058)::
|
22
|
+
The M+ OUTLINE FONTS are used for section titles, literal text and code annotation numbers and bundled in the EPUB3 archive.
|
23
|
+
These fonts are free software and are designed and maintained by Coji Morishita.
|
24
|
+
Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially.
|
25
|
+
THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
|
26
|
+
|
27
|
+
- http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html
|
28
|
+
|
29
|
+
Noto Serif font::
|
30
|
+
Noto is font family developed by the Google Internationalization Team that aims to support all the world's languages.
|
31
|
+
The Noto Serif font is used for body copy and bundled in the EPUB3 archive.
|
32
|
+
The Noto fonts are licensed under the Apache 2.0 License.
|
33
|
+
You may obtain a copy of the license at:
|
34
|
+
|
35
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
36
|
+
|
37
|
+
- https://code.google.com/p/noto/
|
38
|
+
|
39
|
+
Font Awesome icon font (v4.0.3)::
|
40
|
+
Font Awesome, the iconic font designed for Bootstrap by David Gandy, is used for the admonition icons and other icons in author's content and bundled in the EPUB3 archive.
|
41
|
+
Font Awesome is fully open source and GPL compatible.
|
42
|
+
The font is licensed under the SIL Open Font 1.1 License (OFL).
|
43
|
+
You may obtain a copy of the license at:
|
44
|
+
|
45
|
+
http://scripts.sil.org/OFL
|
46
|
+
|
47
|
+
- http://fontawesome.io
|
48
|
+
|
49
|
+
normalize.css (v3.0.1)::
|
50
|
+
A customized version of normalize.css is used to provide cross-reader consistency in the default styling of HTML elements.
|
51
|
+
The source of normalize.css is integrated into the default stylesheet that is bundled in the EPUB3 archive.
|
52
|
+
normalize.css is licensed under the MIT License.
|
53
|
+
|
54
|
+
- http://necolas.github.io/normalize.css
|
data/README.adoc
ADDED
@@ -0,0 +1,1001 @@
|
|
1
|
+
= {project-name}: A _native_ EPUB3 converter for AsciiDoc
|
2
|
+
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
+
v1.5.0.alpha.12, 2020-02-02
|
4
|
+
// Settings:
|
5
|
+
:experimental:
|
6
|
+
:idprefix:
|
7
|
+
:idseparator: -
|
8
|
+
:imagesdir: data/samples/images
|
9
|
+
ifdef::env-github,env-browser[]
|
10
|
+
:toc: preamble
|
11
|
+
:toclevels: 1
|
12
|
+
endif::[]
|
13
|
+
ifdef::env-github[]
|
14
|
+
:status:
|
15
|
+
:!toc-title:
|
16
|
+
:caution-caption: :fire:
|
17
|
+
:important-caption: :exclamation:
|
18
|
+
:note-caption: :paperclip:
|
19
|
+
:tip-caption: :bulb:
|
20
|
+
:warning-caption: :warning:
|
21
|
+
endif::[]
|
22
|
+
ifndef::env-github[]
|
23
|
+
:icons: font
|
24
|
+
endif::[]
|
25
|
+
// Aliases:
|
26
|
+
:project-name: Asciidoctor EPUB3
|
27
|
+
:project-handle: asciidoctor-epub3
|
28
|
+
// URIs:
|
29
|
+
:uri-project: https://github.com/asciidoctor/{project-handle}
|
30
|
+
:uri-gem: http://rubygems.org/gems/asciidoctor-epub3
|
31
|
+
:uri-repo: {uri-project}
|
32
|
+
:uri-issues: {uri-repo}/issues
|
33
|
+
:uri-ci: {uri-repo}/actions?query=workflow%3ACI
|
34
|
+
:uri-discuss: http://discuss.asciidoctor.org
|
35
|
+
:uri-rvm: https://rvm.io
|
36
|
+
:uri-asciidoctor: http://asciidoctor.org
|
37
|
+
:uri-idpf: http://www.idpf.org/
|
38
|
+
:uri-epub: http://www.idpf.org/epub/31/spec/epub-spec.html
|
39
|
+
:uri-epubcheck: https://github.com/idpf/epubcheck
|
40
|
+
:uri-kindlegen: http://www.amazon.com/gp/feature.html?docId=1000765211
|
41
|
+
:uri-kf8: http://www.amazon.com/gp/feature.html?docId=1000729511
|
42
|
+
:uri-send-to-kindle: https://www.amazon.com/gp/sendtokindle/
|
43
|
+
:uri-metadata-elem: http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-metadata-elem
|
44
|
+
:uri-dc: http://dublincore.org/documents/2004/12/20/dces
|
45
|
+
:uri-github-guides: https://guides.github.com
|
46
|
+
:uri-github-guides-fork: https://github.com/opendevise/github-guides-asciidoc
|
47
|
+
:uri-asciidoctor-i18n: http://asciidoctor.org/docs/user-manual/#builtin-attributes-i18n
|
48
|
+
:uri-epubreadingsystem: http://www.idpf.org/epub/301/spec/epub-contentdocs.html#app-epubReadingSystem
|
49
|
+
:uri-android-sdk: http://developer.android.com/sdk/index.html
|
50
|
+
|
51
|
+
ifdef::status[]
|
52
|
+
image:https://img.shields.io/gem/v/asciidoctor-epub3.svg[Latest Release,link={uri-gem}]
|
53
|
+
image:https://img.shields.io/badge/license-MIT-blue.svg[MIT License,link=#copyright]
|
54
|
+
image:{uri-repo}/workflows/CI/badge.svg[GitHub Actions,link={uri-ci}]
|
55
|
+
endif::[]
|
56
|
+
|
57
|
+
{project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI e-book formats.
|
58
|
+
|
59
|
+
== Introduction
|
60
|
+
|
61
|
+
{project-name} is not merely a converter from AsciiDoc to EPUB3 and KF8/MOBI.
|
62
|
+
Rather, it's a tool for creating highly aesthetic, professional, _easy-to-read_ e-books.
|
63
|
+
Let's face it, many of the technical e-books out there--especially those produced from software documentation--are *_hideous_*.
|
64
|
+
{project-name} is on a mission to disrupt the status quo.
|
65
|
+
|
66
|
+
ifdef::env-github[]
|
67
|
+
.An excerpt from an e-book produced by {project-name} shown in Day, Night and Sepia mode.
|
68
|
+
image::screenshots/text.png[]
|
69
|
+
endif::[]
|
70
|
+
|
71
|
+
=== Project Mission
|
72
|
+
|
73
|
+
The {project-name} project aims to produce EPUB3 documents that meet the following objectives:
|
74
|
+
|
75
|
+
[itemized,subject-stop=.]
|
76
|
+
Fully Semantic::
|
77
|
+
Produce deeply semantic XHTML5 documents, including use of the recommended `epub:type` attribute.
|
78
|
+
Exceptional Readability::
|
79
|
+
Readers should be drawn into the text so that they read and absorb it.
|
80
|
+
Maximize the readability of the text using carefully crafted styles that are focused on:
|
81
|
+
- Custom, readable fonts with strong UTF-8 character support
|
82
|
+
- Sufficient line spacing and margins
|
83
|
+
- Modular font size scale
|
84
|
+
- Subtle, pleasing colors with good contrast
|
85
|
+
- A responsive design that scales well from small to large screens
|
86
|
+
- Widowed and orphaned content avoided where possible
|
87
|
+
Complete and Accurate Metadata::
|
88
|
+
Fully populate the EPUB3 package metadata using information in the AsciiDoc source document.
|
89
|
+
Consistent Rendering::
|
90
|
+
Render consistently across a broad range of EPUB3 (and select EPUB2+) e-readers and respond to any size screen.
|
91
|
+
Polish, Polish, and More Polish::
|
92
|
+
Add polish to the final product such as font-based icons and callout numbers.
|
93
|
+
|
94
|
+
We believe that the e-books produced by {project-name} are the _very best_ output you can expect to find in digital publishing today.
|
95
|
+
Of course, there's always room for improvement, so we'll continue to work with you to achieve and maintain this goal.
|
96
|
+
|
97
|
+
=== Notable Features
|
98
|
+
|
99
|
+
* Direct AsciiDoc to EPUB3 conversion
|
100
|
+
* Direct AsciiDoc to KF8/MOBI conversion
|
101
|
+
* Highly-aesthetic and readable styles with optimized text legibility
|
102
|
+
* Respects font settings (if supported by the e-reader) without altering headings, code or icons
|
103
|
+
* EPUB3 metadata, manifest and spine (assembled by Gepub)
|
104
|
+
* Document metadata (title, authors, subject, keywords, etc.)
|
105
|
+
* Internal cross reference links
|
106
|
+
* Syntax highlighting with CodeRay or Pygments (must use inline styles)
|
107
|
+
* Unicode callout numbers
|
108
|
+
* Page breaks avoided in block content (so much as it's supported by the e-reader)
|
109
|
+
* Orphan section titles avoided (so much as it's supported by the e-reader)
|
110
|
+
* Table border settings honored
|
111
|
+
* Support for SVG images in the content
|
112
|
+
|
113
|
+
=== Project Status
|
114
|
+
|
115
|
+
CAUTION: {project-name} is currently _alpha_ software.
|
116
|
+
Use accordingly.
|
117
|
+
Although the bulk of AsciiDoc content is converted, there's still work needed to fill in gaps where conversion is incomplete or unstyled.
|
118
|
+
|
119
|
+
NOTE: {project-name} only produces variable layout (i.e., reflowable) EPUB3 documents since this layout is best suited for the types of documents typically written in AsciiDoc.
|
120
|
+
We may explore the use of fixed layout documents in the future if the need arises.
|
121
|
+
|
122
|
+
ifdef::env-github[]
|
123
|
+
=== Planned Features and Work In Progress
|
124
|
+
|
125
|
+
See <<WORKLOG#,WORKLOG.adoc>>.
|
126
|
+
endif::[]
|
127
|
+
|
128
|
+
== Converter Workflow
|
129
|
+
|
130
|
+
{project-name} takes an aggregate AsciiDoc document and any assets it references as input and produces an EPUB3 publication archive (often described as a “website in a box”).
|
131
|
+
|
132
|
+
{project-name} can also produce KF8/MOBI files, the format required for viewing on Amazon Kindle.
|
133
|
+
The conversion to KF8/MOBI is performed by generating a slightly modified EPUB3 publication, then passing it through the {uri-kindlegen}[KindleGen] application.
|
134
|
+
The EPUB3 publication, which can be thought of as the “digital master”, is altered to adhere to certain Amazon Kindle requirements.
|
135
|
+
|
136
|
+
== Structuring your Manuscript
|
137
|
+
|
138
|
+
An EPUB3 archive is composed of multiple files. The content of each “chapter” is typically stored in a dedicated XHTML file.
|
139
|
+
Therefore, the {project-name} converter “chunks” the AsciiDoc source document into multiple XHTML files to add to the EPUB3 archive.
|
140
|
+
While other converters handle this chunking task by automatically slicing up the XHTML output at predetermined heading levels, this converter takes a different approach, outlined next.
|
141
|
+
|
142
|
+
=== Composition Rules
|
143
|
+
|
144
|
+
There are several rules you must follow to successfully convert your AsciiDoc source documents into an EPUB3 publication archive.
|
145
|
+
These rules may be loosened in the future, but they are mandatory at the moment.
|
146
|
+
|
147
|
+
Rule 1::
|
148
|
+
Each chapter must begin in a dedicated file that resides at the root of the project.
|
149
|
+
It must be included into the main document using the AsciiDoc include directive.
|
150
|
+
The main document, which we call the “spine”, may only contain a document header and a sequence of include directives.
|
151
|
+
See <<Declaring the Spine>> for details.
|
152
|
+
+
|
153
|
+
TIP: The include directive may be used in the chapter files to include other files (even files in other folders).
|
154
|
+
|
155
|
+
Rule 2::
|
156
|
+
Each chapter must start with a document title (i.e., level-0 heading).
|
157
|
+
The document header must declare an ID that matches the chapter filename (minus its file extension).
|
158
|
+
|
159
|
+
Rule 3::
|
160
|
+
No sections in a chapter may have the same ID as the chapter ID.
|
161
|
+
|
162
|
+
Rule 4::
|
163
|
+
The cross reference (i.e., xref) from one chapter to another must be in the format `+xref:chapter-id#chapter-id[optional reftext]+` (or `+<<chapter-id#chapter-id,optional reftext>>+`).
|
164
|
+
If you want to reference a section in a chapter, update the fragment (i.e., the value that follows the hash) to match the target section ID.
|
165
|
+
The reftext is optional since the reftext of the target is used by default.
|
166
|
+
+
|
167
|
+
TIP: To assign reference text (i.e., reftext) for a chapter title, set the document attribute `docreftext` in the header for that chapter.
|
168
|
+
+
|
169
|
+
TIP: Rule 2 states that the chapter ID must match the basename of the chapter file.
|
170
|
+
In truth, the chapter ID can be a _derivative of_ the chapter filename.
|
171
|
+
In that case, an attribute reference can be used to prepend a prefix to an inter-document cross reference.
|
172
|
+
For example, if you want each chapter file to begin with `chapter-`, you'd write the xref as `+xref:{chapter-prefix}chapter-id#chapter-id[]+`.
|
173
|
+
You'd then assign an empty value to the `chapter-prefix` attribute when converting to an e-book and `chapter-` for all other formats.
|
174
|
+
|
175
|
+
The next section goes into more detail about how to set up the spine document and include the chapter files.
|
176
|
+
|
177
|
+
=== Declaring the Spine
|
178
|
+
|
179
|
+
The spine (or master document) must be well-formed.
|
180
|
+
Otherwise, {project-name} will not convert the document properly.
|
181
|
+
If your AsciiDoc documents are not structured as explained in this section, you'll need to change them.
|
182
|
+
|
183
|
+
Asciidoctor uses top-level include directives (i.e., include directives in the master document) to indicate where each chapter split should occur.
|
184
|
+
The chapter files should begin with an AsciiDoc document header, which consists of an ID, a document title (i.e., level-0 heading), an author name, and a set of attribute entries.
|
185
|
+
Only the document title is required.
|
186
|
+
|
187
|
+
The document title in the chapter file is used as the chapter title and the label for the chapter in the TOC.
|
188
|
+
The chapter ID, combined with the _.xhtml_ suffix, is used as the filename of the chapter inside the EPUB3 archive (though this could change in the future).
|
189
|
+
We recommend that you base the filename of the chapter on the chapter ID.
|
190
|
+
|
191
|
+
If you don't specify an ID for a chapter, one will be generated automatically from the document title.
|
192
|
+
The rules for generating a chapter ID from the document title are as follows:
|
193
|
+
|
194
|
+
* apply inline formatting, then remove XML elements
|
195
|
+
* remove the `\’` character reference (so `John\’s` becomes `Johns`)
|
196
|
+
* replace `\&` with the word `and` (so `John \& Jane` becomes `John and Jane`)
|
197
|
+
* expand all other character references
|
198
|
+
* lowercase all characters
|
199
|
+
* replace illegal ID characters with the character defined by the `idseparator` attribute
|
200
|
+
* prepend the value of the `idprefix` attribute
|
201
|
+
* prepend an underscore if the ID begins with a number
|
202
|
+
|
203
|
+
You can think of the master document as the spine of the book and the include directives the individual items being bound together.
|
204
|
+
The target of each include directive in the master document is parsed and converted as a separate AsciiDoc document, with certain options and attributes passed down from the master to ensure consistent behavior.
|
205
|
+
Each resulting XHTML document is then added to the EPUB3 archive as a chapter document and the master document becomes the navigation file (i.e, the table of contents).
|
206
|
+
|
207
|
+
Here's an example showing the structure of a spine document:
|
208
|
+
|
209
|
+
[source,asciidoc]
|
210
|
+
----
|
211
|
+
= Book Title
|
212
|
+
Author Name
|
213
|
+
:doctype: book
|
214
|
+
:imagesdir: images
|
215
|
+
\ifndef::ebook-format[:leveloffset: 1]
|
216
|
+
//...and so on
|
217
|
+
|
218
|
+
\include::chapter-one.adoc[]
|
219
|
+
|
220
|
+
\include::chapter-two.adoc[]
|
221
|
+
|
222
|
+
\include::chapter-three.adoc[]
|
223
|
+
----
|
224
|
+
|
225
|
+
IMPORTANT: The spine document cannot contain any content other than include directives.
|
226
|
+
|
227
|
+
Here's an example showing the structure of a chapter document:
|
228
|
+
|
229
|
+
[source,asciidoc]
|
230
|
+
----
|
231
|
+
[#chapter-one]
|
232
|
+
= Chapter One
|
233
|
+
|
234
|
+
chapter content
|
235
|
+
----
|
236
|
+
|
237
|
+
CAUTION: Although an explicit ID over the chapter title is not required, it's recommended for stability.
|
238
|
+
|
239
|
+
If your chapter files start with a level-1 section instead of a level-2 section, you need to make the opposite adjustment in the header of the spine document:
|
240
|
+
|
241
|
+
[source,asciidoc]
|
242
|
+
----
|
243
|
+
\ifndef::ebook-format[:leveloffset: -1]
|
244
|
+
----
|
245
|
+
|
246
|
+
If the master document does not contain any include directives, then the converter treats the document as the sole chapter in the EPUB3 archive and automatically produces a navigation file that references it.
|
247
|
+
(Currently broken. See issue {uri-issues}/47[#47]).
|
248
|
+
|
249
|
+
NOTE: Eventually, we envision introducing a dedicated block macro to represent a spine item so that we don't overload the meaning of the include directive.
|
250
|
+
However, for the time being, the include directive fills this role.
|
251
|
+
|
252
|
+
== Prerequisites
|
253
|
+
|
254
|
+
All that's needed to use {project-name} is Ruby 2.3 or newer and a few Ruby gems (including at least Asciidoctor 1.5.3), which we'll explain how to install in the next section.
|
255
|
+
|
256
|
+
To check if you have Ruby available, use the `ruby` command to query the installed version:
|
257
|
+
|
258
|
+
$ ruby --version
|
259
|
+
|
260
|
+
== Getting Started
|
261
|
+
|
262
|
+
You can get {project-name} by <<Install the Published Gem,installing the published gem>>.
|
263
|
+
ifndef::env-site[You can also <<Development,run the code from source>> if you want to use the development version or participate in development.]
|
264
|
+
|
265
|
+
=== Install the Published Gem
|
266
|
+
|
267
|
+
{project-name} is published as a pre-release on RubyGems.org.
|
268
|
+
You can install the published gem using the following command:
|
269
|
+
|
270
|
+
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install asciidoctor-epub3 --pre
|
271
|
+
|
272
|
+
This optional environment variable tells the gem installer to link against the C libraries on the system, if available, instead of compiling the libraries from scratch.
|
273
|
+
This speeds up the installation of Nokogiri considerably.
|
274
|
+
|
275
|
+
If you want to syntax highlight source listings, you'll also want to install CodeRay or Pygments.
|
276
|
+
Choose one (or more) of the following:
|
277
|
+
|
278
|
+
.CodeRay
|
279
|
+
$ gem install coderay
|
280
|
+
|
281
|
+
.Pygments
|
282
|
+
$ gem install pygments.rb
|
283
|
+
|
284
|
+
You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (CodeRay shown):
|
285
|
+
|
286
|
+
[source,asciidoc]
|
287
|
+
----
|
288
|
+
:source-highlighter: coderay
|
289
|
+
----
|
290
|
+
|
291
|
+
NOTE: At the moment, Pygments is automatically used if it's available.
|
292
|
+
If a style is not specified, the black and white theme (i.e., bw) is used.
|
293
|
+
This default is used so that the syntax highlighting is legibile regardless of which reading mode the reader selects (white, black, sepia, etc).
|
294
|
+
To override this default, you must pass a valid Pygments style name to the `pygments-style` attribute when invoking the `asciidoctor-epub3` script (e.g., `-a pygments-style=pastie`).
|
295
|
+
|
296
|
+
Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
|
297
|
+
|
298
|
+
$ asciidoctor-epub3 -v
|
299
|
+
|
300
|
+
If you see the version of {project-name} printed, you're ready to use {project-name}.
|
301
|
+
Let's get an AsciiDoc document ready to convert to EPUB3.
|
302
|
+
|
303
|
+
=== Prepare an AsciiDoc Document
|
304
|
+
|
305
|
+
If you don't already have an AsciiDoc document, you can use the [file]_sample-book.adoc_ file and its chapters found in the [path]_data/samples_ directory of this project.
|
306
|
+
|
307
|
+
.Master file named sample-book.adoc
|
308
|
+
```asciidoc
|
309
|
+
= Asciidoctor EPUB3: Sample Book
|
310
|
+
Author Name
|
311
|
+
v1.0, 2014-04-15
|
312
|
+
:doctype: book
|
313
|
+
:creator: {author}
|
314
|
+
:producer: Asciidoctor
|
315
|
+
:keywords: Asciidoctor, samples, e-book, EPUB3, KF8, MOBI, Asciidoctor.js
|
316
|
+
:copyright: CC-BY-SA 3.0
|
317
|
+
:imagesdir: images
|
318
|
+
|
319
|
+
\include::asciidoctor-epub3-readme.adoc[]
|
320
|
+
|
321
|
+
\include::sample-content.adoc[]
|
322
|
+
|
323
|
+
\include::asciidoctor-js-introduction.adoc[]
|
324
|
+
|
325
|
+
\include::asciidoctor-js-extension.adoc[]
|
326
|
+
```
|
327
|
+
|
328
|
+
=== EPUB-related AsciiDoc Attributes
|
329
|
+
|
330
|
+
The metadata in the generated EPUB3 file is populated from attributes in the AsciiDoc document.
|
331
|
+
The names of the attributes and the metadata elements to which they map are documented in this section.
|
332
|
+
|
333
|
+
The term [term]_package metadata_ in Table 1 is in reference to the {uri-metadata-elem}[<metadata> element] in the EPUB3 package document (e.g., [file]_package.opf_).
|
334
|
+
The `dc` namespace prefix is in reference to the {uri-dc}[Dublin Core Metadata Element Set].
|
335
|
+
|
336
|
+
.AsciiDoc attributes that control the EPUB3 metadata (i.e., package.opf)
|
337
|
+
[cols="1m,3"]
|
338
|
+
|===
|
339
|
+
|Name |Description
|
340
|
+
|
341
|
+
|uuid
|
342
|
+
|Populates the *required* unique identifier (`<dc:identifier>`) in the package metadata.
|
343
|
+
An id will be generated automatically from the doctitle if not specified.
|
344
|
+
The recommended practice is to identify the document by means of a string or number conforming to a formal identification system.
|
345
|
+
|
346
|
+
|lang
|
347
|
+
|Populates the content language / locale (`<dc:language>`) in the package metadata.
|
348
|
+
|
349
|
+
|scripts
|
350
|
+
|Controls the font subsets that are selected based on the specified scripts (e.g., alphabets).
|
351
|
+
(values: *latin*, latin-ext, latin-cyrillic or multilingual)
|
352
|
+
|
353
|
+
|revdate
|
354
|
+
|Populates the publication date (`<dc:date>`) in the package metadata.
|
355
|
+
The date should be specified in a parsable format, such as `2014-01-01`.
|
356
|
+
|
357
|
+
|doctitle
|
358
|
+
|Populates the title (`<dc:title>`) in the package metadata.
|
359
|
+
The title is added to the metadata in plain text format.
|
360
|
+
|
361
|
+
|author
|
362
|
+
|Populates the contributors (`<dc:contributor>`) in the package metadata.
|
363
|
+
The authors in each chapter document are aggregated together with the authors in the master file.
|
364
|
+
|
365
|
+
|username
|
366
|
+
|Used to resolve an avatar for the author that is displayed in the header of a chapter when the `publication-type` is set to a value other than `book`.
|
367
|
+
The avatar image should be located at the path _\{imagesdir}/avatars/\{username}.jpg_, where `\{username}` is the value of this attribute.
|
368
|
+
|
369
|
+
|producer
|
370
|
+
|Populates the publisher (`<dc:publisher>`) in the package metadata.
|
371
|
+
|
372
|
+
|creator
|
373
|
+
|Populates the creator (`<dc:creator>`) in the package metadata.
|
374
|
+
*If the creator is not specified, Asciidoctor is set as the creator with the role "mfr" (an abbreviation for manufacturer).*
|
375
|
+
|
376
|
+
|description
|
377
|
+
|Populates the description (`<dc:description>`) in the package metadata.
|
378
|
+
|
379
|
+
|keywords
|
380
|
+
|Populates the subjects (i.e., `<dc:subject>`) in the package metadata.
|
381
|
+
The keywords should be represented as comma-separated values (CSV).
|
382
|
+
|
383
|
+
|front-cover-image
|
384
|
+
|Populates the front cover image and the image on the cover page (EPUB3 only) in the package metadata.
|
385
|
+
The image is also added to the e-book archive.
|
386
|
+
The value may be specified as a path or inline image macro.
|
387
|
+
Using the inline image macro is preferred as it allows the height and width to be specified.
|
388
|
+
|
389
|
+
|copyright
|
390
|
+
|Populates the rights statement (`<dc:rights>`) in the package metadata.
|
391
|
+
|
392
|
+
|source
|
393
|
+
|Populates the source reference (`<dc:source>`) in the package metadata.
|
394
|
+
The recommended practice is to identify the referenced resource by means of a string or number conforming to a formal identification system.
|
395
|
+
|
396
|
+
|epub-properties
|
397
|
+
|An optional override of the properties attribute for this document's item in the manifest.
|
398
|
+
_Only applies to a chapter document._
|
399
|
+
|
400
|
+
|epub3-stylesdir
|
401
|
+
|The path to a directory that contains alternate epub3.css and epub3-css3-only.css files to customize the look and feel.
|
402
|
+
|
403
|
+
|doctype
|
404
|
+
|Effectively ignored.
|
405
|
+
The master document is assumed to be a book and each chapter an article.
|
406
|
+
|
407
|
+
|publication-type
|
408
|
+
|Used to control the inclusion of special content in the generated HTML.
|
409
|
+
If set to a value other than book, the byline information (author and avatar) is included below the chapter header and a typographic end mark is added at the end of the last paragraph.
|
410
|
+
Suggested values include: book (default), anthology, magazine, journal, article.
|
411
|
+
|===
|
412
|
+
|
413
|
+
When using the EPUB3 converter, the `ebook-format` attribute resolves to the name of the e-book format being generated (epub3 or kf8) and the corresponding attribute `ebook-format-<name>` is defined, where `<name>` is `epub3` or `kf8`.
|
414
|
+
You can use these attributes in a preprocessor directive if you only want to show certain content to readers using a particular device.
|
415
|
+
For instance, if you want to display a message to readers on Kindle, you can use:
|
416
|
+
|
417
|
+
[source,asciidoc]
|
418
|
+
----
|
419
|
+
\ifdef::ebook-format-kf8[Hello Kindle reader!]
|
420
|
+
----
|
421
|
+
|
422
|
+
With that out of the way, it's time to convert the AsciiDoc document directly to EPUB3.
|
423
|
+
|
424
|
+
== Performing the Conversion
|
425
|
+
|
426
|
+
You can convert AsciiDoc documents to EPUB3 and KF8/MOBI from the commandline using the `asciidoctor-epub3` script provided with the {project-name} project.
|
427
|
+
|
428
|
+
=== Convert AsciiDoc to EPUB3
|
429
|
+
|
430
|
+
Converting an AsciiDoc document to EPUB3 is as simple as passing your document to the `asciidoctor-epub3` command.
|
431
|
+
This command should be available on your PATH if you installed the `asciidoctor-epub3` gem.
|
432
|
+
Otherwise, you can find the command in the [path]_bin_ folder of the project.
|
433
|
+
We also recommend specifying an output directory using the `-D` option flag.
|
434
|
+
|
435
|
+
$ asciidoctor-epub3 -D output data/samples/sample-book.adoc
|
436
|
+
|
437
|
+
When the script completes, you'll see the file [file]_sample-book.epub_ appear in the [path]_output_ directory.
|
438
|
+
Open that file with an EPUB reader (aka e-reader) to view the result.
|
439
|
+
|
440
|
+
Below are several screenshots of this sample book as it appears on an Android phone.
|
441
|
+
|
442
|
+
.An example of a chapter title and abstract shown side-by-side in Day and Night mode
|
443
|
+
image::screenshots/chapter-title.png[]
|
444
|
+
|
445
|
+
.An example of a section title followed by paragraph text separated by a literal block
|
446
|
+
image::screenshots/section-title-paragraph.png[]
|
447
|
+
|
448
|
+
.An example of a figure and an admonition
|
449
|
+
image::screenshots/figure-admonition.png[]
|
450
|
+
|
451
|
+
.An example of a sidebar
|
452
|
+
image::screenshots/sidebar.png[]
|
453
|
+
|
454
|
+
.An example of a table
|
455
|
+
image::screenshots/table.png[]
|
456
|
+
|
457
|
+
NOTE: The `asciidoctor-epub3` command is a temporary solution for invoking the {project-name} converter.
|
458
|
+
We plan to remove this script once we have completed proper integration with the `asciidoctor` command.
|
459
|
+
|
460
|
+
TIP: As another example, point `asciidoctor-epub3` at the {uri-github-guides-fork}[GitHub Guides] that we've ported to AsciiDoc, then compare the output to the real {uri-github-guides}[GitHub Guides].
|
461
|
+
|
462
|
+
=== Validate the EPUB3 Archive
|
463
|
+
|
464
|
+
Next, let's validate the EPUB3 archive to ensure it built correctly.
|
465
|
+
|
466
|
+
.EPUB3 with validation
|
467
|
+
$ asciidoctor-epub3 -D output -a ebook-validate data/samples/sample-book.adoc
|
468
|
+
|
469
|
+
.Validation success
|
470
|
+
[.output]
|
471
|
+
....
|
472
|
+
Validating using EPUB version 3.0.1 rules.
|
473
|
+
No errors or warnings detected.
|
474
|
+
Messages: 0 fatal / 0 errors / 0 warnings / 0 info
|
475
|
+
EPUBCheck completed
|
476
|
+
....
|
477
|
+
|
478
|
+
If the EPUB3 archive contains any errors, they will be output in your terminal.
|
479
|
+
|
480
|
+
.EPUB Standard & Validator
|
481
|
+
****
|
482
|
+
The electronic publication (EPUB) standard is developed by the {uri-idpf}[International Digital Publishing Forum (IDPF)].
|
483
|
+
{uri-epub}[EPUB 3.1], released in January 2017, is the latest version of this standard.
|
484
|
+
|
485
|
+
An EPUB3 archive contains:
|
486
|
+
|
487
|
+
* a package document (metadata, file manifest, spine)
|
488
|
+
* a navigation document (table of contents)
|
489
|
+
* one or more content documents
|
490
|
+
* assets (images, fonts, stylesheets, etc.)
|
491
|
+
|
492
|
+
The IDPF also supports {uri-epubcheck}[EpubCheck].
|
493
|
+
EpubCheck parses and validates the file against the EPUB schema.
|
494
|
+
****
|
495
|
+
|
496
|
+
If you want to browse the contents of the EPUB3 file that is generated, or preview the XHTML files in a regular web browser, add the `-a ebook-extract` flag to the `asciidoctor-epub3` command.
|
497
|
+
The EPUB3 file will be extracted to a directory adjacent to the generated file, but without the file extension.
|
498
|
+
|
499
|
+
$ asciidoctor-epub3 -D output -a ebook-extract data/samples/sample-book.adoc
|
500
|
+
|
501
|
+
In this example, the contents of the EPUB3 will be extracted to the [path]_output/sample-book_ directory.
|
502
|
+
|
503
|
+
=== Convert AsciiDoc to KF8/MOBI
|
504
|
+
|
505
|
+
Creating a KF8/MOBI archive directly from an AsciiDoc document is done with the same generation script (`asciidoctor-epub3`).
|
506
|
+
You just need to specify the format (`-a ebook-format`) as `kf8`.
|
507
|
+
|
508
|
+
$ asciidoctor-epub3 -D output -a ebook-format=kf8 data/samples/sample-book.adoc
|
509
|
+
|
510
|
+
When the script completes, you'll see the file [file]_sample-book.mobi_ as well as [file]_sample-book-kf8.epub_ (the precursor) appear in the [path]_output_ directory.
|
511
|
+
|
512
|
+
KindleGen does mandatory validation so you don't need to run the `validate` command after converting to KF8/MOBI.
|
513
|
+
|
514
|
+
.What is KF8?
|
515
|
+
****
|
516
|
+
Kindle Format 8 (KF8) is Amazon's next generation file format offering a wide range of new features and enhancements--including HTML5 and CSS3 support--that publishers can use to create a broad range of books.
|
517
|
+
The format is close enough to EPUB3 that it's safe to think of it simply as an EPUB3 implementation under most circumstances.
|
518
|
+
You can read more about the format on the {uri-kf8}[Kindle Format 8 page].
|
519
|
+
|
520
|
+
Amazon continues to use the _.mobi_ file extension for KF8 archives, despite the fact that they've switched from the Mobipocket format to the EPUB3-like KF8 format.
|
521
|
+
That's why we refer to the format in this project as KF8/MOBI.
|
522
|
+
****
|
523
|
+
|
524
|
+
=== Tuning Listing Captions
|
525
|
+
|
526
|
+
Unlike the built-in converters, the EPUB3 converter is configured to add a signifier (e.g., `Listing`) at the start the caption for all listing and source blocks that have a title.
|
527
|
+
This behavior is triggered because the `listing-caption` attribute is set by default.
|
528
|
+
|
529
|
+
If you don't want the signifier to be included at the beginning of the caption on listing and source blocks, simply unset the `listing-caption` when invoking Asciidoctor EPUB3.
|
530
|
+
|
531
|
+
$ asciidoctor-epub3 -a listing-caption! book.adoc
|
532
|
+
|
533
|
+
Now the behavior will match that of the built-in converters.
|
534
|
+
For more information about this attribute and other related attributes, see {uri-asciidoctor-i18n}[internationalization and numbering].
|
535
|
+
|
536
|
+
=== Command Arguments
|
537
|
+
|
538
|
+
*-h, --help* ::
|
539
|
+
Show the usage message
|
540
|
+
|
541
|
+
*-D, --destination-dir* ::
|
542
|
+
Writes files to specified directory (defaults to the current directory)
|
543
|
+
|
544
|
+
*-a ebook-epubcheck-path=<path>*::
|
545
|
+
Specifies path to EPUBCheck executable to use with `-a ebook-validate`.
|
546
|
+
This attribute takes precedence over `EPUBCHECK` environment variable.
|
547
|
+
|
548
|
+
*-a ebook-extract* ::
|
549
|
+
Extracts the EPUB3 to a folder in the destination directory after the file is generated
|
550
|
+
|
551
|
+
*-a ebook-format=<format>* ::
|
552
|
+
Specifies the ebook format to generate (epub3 or kf8, default: epub3)
|
553
|
+
|
554
|
+
*-a ebook-kindlegen-path=<path>*::
|
555
|
+
Specifies path to KindleGen executable to use when producing KF8/Mobi.
|
556
|
+
This attribute takes precedence over `KINDLEGEN` environment variable.
|
557
|
+
|
558
|
+
*-a ebook-validate* ::
|
559
|
+
Runs {uri-epubcheck}[EPUBCheck] to validate output file against the EPUB3 specification
|
560
|
+
|
561
|
+
*-a ebook-compress=<0|1|2|none|standard|huffdic>* ::
|
562
|
+
Controls the compression type used by kindlegen (0=none [default if unset], 1=standard [default if empty], 2=huffdic)
|
563
|
+
|
564
|
+
*-v, --version* ::
|
565
|
+
Display the program version
|
566
|
+
|
567
|
+
=== Environment variables
|
568
|
+
|
569
|
+
*EPUBCHECK*::
|
570
|
+
Specifies path to EPUBCheck executable to use with `-a ebook-validate`.
|
571
|
+
Effect of this variable can be overriden with `-a ebook-epubcheck-path` attribute.
|
572
|
+
|
573
|
+
*KINDLEGEN*::
|
574
|
+
Specifies path to KindleGen executable to use when producing KF8/Mobi.
|
575
|
+
Effect of this variable can be overriden with `-a ebook-kindlegen-path` attribute.
|
576
|
+
|
577
|
+
=== EPUB3 Archive Structure
|
578
|
+
|
579
|
+
Here's a sample manifest of files found in an EPUB3 document produced by {project-name}.
|
580
|
+
|
581
|
+
....
|
582
|
+
META-INF/
|
583
|
+
container.xml
|
584
|
+
OEBPS/
|
585
|
+
fonts/
|
586
|
+
font-awesome.ttf
|
587
|
+
font-icons.ttf
|
588
|
+
mplus-1mn-latin-bold.ttf
|
589
|
+
mplus-1mn-latin-light.ttf
|
590
|
+
mplus-1mn-latin-medium.ttf
|
591
|
+
mplus-1mn-latin-regular.ttf
|
592
|
+
mplus-1p-latin-bold.ttf
|
593
|
+
mplus-1p-latin-light.ttf
|
594
|
+
mplus-1p-latin-regular.ttf
|
595
|
+
noto-serif-bold-italic.ttf
|
596
|
+
noto-serif-bold.ttf
|
597
|
+
noto-serif-italic.ttf
|
598
|
+
noto-serif-regular.ttf
|
599
|
+
images/
|
600
|
+
avatars/
|
601
|
+
default.png
|
602
|
+
figure-01.png
|
603
|
+
figure-02.png
|
604
|
+
styles/
|
605
|
+
epub3-css3-only.css
|
606
|
+
epub3.css
|
607
|
+
chapter-01.xhtml
|
608
|
+
chapter-02.xhtml
|
609
|
+
...
|
610
|
+
cover.xhtml
|
611
|
+
nav.xhtml
|
612
|
+
package.opf
|
613
|
+
toc.ncx
|
614
|
+
mimetype
|
615
|
+
....
|
616
|
+
|
617
|
+
== Working with Images
|
618
|
+
|
619
|
+
Images referenced in your AsciiDoc document must be stored in the images catalog.
|
620
|
+
The images catalog is defined by the `imagesdir` attribute.
|
621
|
+
If set, the value of this attribute is resolved relative to the spine document and must be at or below (i.e., within) the directory of that document.
|
622
|
+
(In other words, it cannot point to a location outside the document directory).
|
623
|
+
If this attribute is not set, the images catalog defaults to the directory of the spine document.
|
624
|
+
{project-name} will discover all local image references and insert those images into the EPUB3 archive at the same relative path.
|
625
|
+
|
626
|
+
WARNING: {project-name} does not currently discover and package inline images.
|
627
|
+
See issue {uri-issues}/30[#30].
|
628
|
+
|
629
|
+
=== Default Images
|
630
|
+
|
631
|
+
The sample book contains placeholder images for an author avatar and a book cover.
|
632
|
+
|
633
|
+
// TODO explain the avatar and book cover images
|
634
|
+
|
635
|
+
=== Adding the Cover Image
|
636
|
+
|
637
|
+
Ereaders have different image resolution and file size limits regarding a book's cover.
|
638
|
+
Kindle covers tend to be 1050x1600 (16:9 resolution).
|
639
|
+
To ensure your cover displays correctly, you'll want to review the documentation or publisher guidelines for the e-reading platform you're targeting.
|
640
|
+
|
641
|
+
WARNING: We've found that if the book cover is more than 1600px on any side, Aldiko will not render it and may even crash.
|
642
|
+
|
643
|
+
Feel free to use the SVG of the sample cover in the [path]_data/images_ folder as a template for creating your own cover.
|
644
|
+
Once your image is ready, you can set the cover image by defining the `front-cover-image` attribute in the header of the master document.
|
645
|
+
|
646
|
+
[source,asciidoc]
|
647
|
+
----
|
648
|
+
:front-cover-image: image:cover.png[Front Cover,1050,1600]
|
649
|
+
----
|
650
|
+
|
651
|
+
The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the directory of the spine document.
|
652
|
+
The image can be in any format, though we recommend using PNG, JPG, or SVG as they are the most portable formats.
|
653
|
+
|
654
|
+
IMPORTANT: *You should always specify the dimensions of the cover image.*
|
655
|
+
This ensures the viewer will preserve the aspect ratio if it needs to be scaled to fit the screen.
|
656
|
+
If you don't specify a width and height, then the dimensions are assumed to be 1050x1600.
|
657
|
+
|
658
|
+
=== How to Organize Images by Chapter
|
659
|
+
|
660
|
+
You can set the `imagesdir` attribute per chapter (as long as the attribute is not overridden by the API).
|
661
|
+
To do so, use an attribute entry to set the value of the `imagesdir` attribute on the line above the include directive for a chapter.
|
662
|
+
|
663
|
+
[source,asciidoc]
|
664
|
+
----
|
665
|
+
:imagesdir: chapter-one/images
|
666
|
+
\include::chapter-one.adoc[]
|
667
|
+
|
668
|
+
:imagesdir: chapter-two/images
|
669
|
+
\include::chapter-two.adoc[]
|
670
|
+
----
|
671
|
+
|
672
|
+
== About the Theme
|
673
|
+
|
674
|
+
EPUB3 and KF8/MOBI files are styled using CSS3.
|
675
|
+
However, each e-reading platform honors a reduced set of CSS3 styles, and the styles they allow and how they implement them are rarely documented.
|
676
|
+
All we've got to say is _thank goodness for CSS hacks, media queries and years of CSS experience!_
|
677
|
+
|
678
|
+
The theme provided with {project-name} has been crafted to display EPUB3 and KF8/MOBI files as consistently as possible across the most common EPUB3 platforms and to degrade gracefully in select EPUB2 platforms.
|
679
|
+
The theme maintains readability regardless of the reading mode (i.e., day, night or sepia) or the display device's pixel density and screen resolution.
|
680
|
+
|
681
|
+
The theme's CSS files are located in the [path]_data/style_ directory.
|
682
|
+
|
683
|
+
IMPORTANT: {project-name} only provides one theme, and, at this time, you can not replace it with a custom theme using the `stylesheet` attribute.
|
684
|
+
However, you can use your own [path]_epub3.css_ and [path]_epub3-css3-only.css_ files by specifying the directory where they are located using the `epub3-stylesdir` attribute.
|
685
|
+
|
686
|
+
=== Fonts
|
687
|
+
|
688
|
+
{project-name} embeds a set of fonts and font icons.
|
689
|
+
The theme's fonts are located in the [path]_data/fonts_ directory.
|
690
|
+
|
691
|
+
The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
|
692
|
+
The body text uses Noto Serif.
|
693
|
+
Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
|
694
|
+
Refer to the <<NOTICE#,NOTICE>> file for further information about the fonts.
|
695
|
+
|
696
|
+
// TODO document command to generate the M+ 1p latin fonts
|
697
|
+
|
698
|
+
=== Device-specific Styles
|
699
|
+
|
700
|
+
For readers that support JavaScript, {project-name} adds a CSS class to the body element of each chapter that corresponds to the name of the reader as reported by the {uri-epubreadingsystem}[epubReadingSystem] JavaScript object.
|
701
|
+
This enhancement allows you to use styles targeted specifically at that reader.
|
702
|
+
|
703
|
+
Below you can find the readers that are known to support this feature and the CSS class name that gets added to the body element.
|
704
|
+
|
705
|
+
,===
|
706
|
+
Reader,HTML Element,CSS Class Name
|
707
|
+
|
708
|
+
Gitden,body,gitden-reader
|
709
|
+
Namo PubTreeViewer,body,namo-epub-library
|
710
|
+
Readium,body,readium-js-viewer
|
711
|
+
iBooks,body,ibooks
|
712
|
+
Adobe RMSDK >= 11,body,rmsdk
|
713
|
+
Google Books,div,gb-reader-container
|
714
|
+
,===
|
715
|
+
|
716
|
+
NOTE: Kobo does not support the epubReadingSystem JavaScript object, despite the fact that it does support JavaScript.
|
717
|
+
|
718
|
+
== Pushing to Android
|
719
|
+
|
720
|
+
While it's certainly possible to view the EPUB3 on your desktop/laptop, you'll probably want to test it where it's most likely going to be read--on a reading device such as a smartphone or a tablet.
|
721
|
+
Assuming you have an Android device available, transferring the EPUB3 to the device is easy once you get a bit of setup out of the way.
|
722
|
+
|
723
|
+
You transfer files from your computer to an Android phone over a USB connection using a command from the Android SDK Tools called `adb`.
|
724
|
+
Follow these steps to get it setup:
|
725
|
+
|
726
|
+
. Download the Android SDK Tools zip from the table labeled *SDK Tools Only* on the {uri-android-sdk}[Get the Android SDK] page
|
727
|
+
. Extract the archive
|
728
|
+
. Locate the path to the `adb` command (Hint: Look in the platform-tools folder)
|
729
|
+
. Set the environment variable named ADB to the path of the `adb` command
|
730
|
+
|
731
|
+
$ export ADB=~/apps/android-sdk/platform-tools/adb
|
732
|
+
|
733
|
+
Now you can use the `adb-push-ebook` script provided by {project-name} to push the EPUB3 and KF8/MOBI files to your Android device.
|
734
|
+
|
735
|
+
.Publish both EPUB3 and KF8 files to Android device
|
736
|
+
$ adb-push-ebook output/sample-book
|
737
|
+
|
738
|
+
IMPORTANT: Don't include the file extension since the script will check for both the .epub and .mobi files.
|
739
|
+
|
740
|
+
The `adb-push-ebook` script copies the files to the following locations on the device:
|
741
|
+
|
742
|
+
,===
|
743
|
+
File type,Destination on Android device
|
744
|
+
|
745
|
+
*.epub,/sdcard/
|
746
|
+
*.mobi,/sdcard/Android/data/com.amazon.kindle/files/
|
747
|
+
,===
|
748
|
+
|
749
|
+
Amazon Kindle should immediately detect the new file and display it in your “On Device” library.
|
750
|
+
You'll have to manually import the EPUB3 into your e-reader of choice.
|
751
|
+
|
752
|
+
== E-book Reader Recommendations and Quirks
|
753
|
+
|
754
|
+
EPUB3 e-readers will provide the best reading experience when viewing the book generated by {project-name}.
|
755
|
+
Here's a list of some of the e-readers we know to have good EPUB3 support and the systems on which they run:
|
756
|
+
|
757
|
+
* http://www.amazon.com/gp/feature.html?docId=1000493771[Amazon Kindle] (most platforms)
|
758
|
+
* http://gitden.com/gitdenreader[Gitden] (Android and iOS)
|
759
|
+
* http://www.apple.com/ibooks[iBooks] (iOS, OSX)
|
760
|
+
* https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl?hl=en-US[Readium] (Chrome)
|
761
|
+
* http://www.kobo.com/apps[Kobo] (Android, iOS, OSX and Windows)
|
762
|
+
* http://www.namo.com/site/namo/menu/5074.do[Namo PubTreeViewer] (Android, iOS and Windows)
|
763
|
+
* http://calibre-ebook.com[Calibre (ebook-viewer)] (Linux, OSX, Windows)
|
764
|
+
|
765
|
+
IMPORTANT: To get the full experience, *ensure that the e-reader is configured to use the publisher's styles*.
|
766
|
+
Different e-readers word this setting in different ways.
|
767
|
+
Look for the option screen that allows you to set the fonts and font colors and disable it.
|
768
|
+
With publisher's styles active, you'll still be able to adjust the relative size of the fonts and margins and toggle between day, night and sepia mode.
|
769
|
+
|
770
|
+
When the book is viewed in EPUB2 e-readers and Kindle apps/devices which have reached their end-of-life (EOL), the e-book relies on the strong semantics of the HTML and some fallback styles to render properly.
|
771
|
+
EPUB2 e-readers, such as Aldiko, don't understand CSS3 styles and therefore miss out on some of subtleties in the formatting.
|
772
|
+
|
773
|
+
As mentioned in the <<About the Theme,theme section>>, the stylesheet attempts to provide as consistent a reading experience as possible in the common EPUB3 e-readers, despite the different CSS implementation rules and limitations unique to each e-book application.
|
774
|
+
Most of these obstacles were addressed using media queries or explicit classes.
|
775
|
+
Some we haven't conquered.
|
776
|
+
Yet.
|
777
|
+
|
778
|
+
The <<kindle-quirks,Kindle quirks list>> shows you just a few of the constraints we encountered.
|
779
|
+
To see all of the workarounds and why we chose certain style options, check out the code and comments in the [file]_epub3.css_ and [file]_epub3-css-only.css_ files.
|
780
|
+
|
781
|
+
// TODO add http://www.namo.com/site/namo/menu/5074.do[Namo PubTreeViewer] (iOS, Android & Windows) and http://www.kobo.com/apps[Kobo] (iOS, Android, OSX & Windows)
|
782
|
+
|
783
|
+
[#kindle-quirks]
|
784
|
+
.Kindle Quirks
|
785
|
+
* overrules margins and line heights like a medieval tyrant
|
786
|
+
* `font-family` can't be set on `<body>`
|
787
|
+
* requires `!important` on text-decoration
|
788
|
+
* `position: relative` isn't permitted
|
789
|
+
* strips (or unwraps) `<header>` tags
|
790
|
+
* `@page` isn't supported
|
791
|
+
* `page-break: avoid` isn't supported
|
792
|
+
* `page-break-*` cannot be applied using a compound or nested CSS selector; must be a simple ID or class
|
793
|
+
* `max-width` isn't supported
|
794
|
+
* `widows` are left in the cold
|
795
|
+
* won't style footers without an explicit class
|
796
|
+
* `-webkit-hyphens: auto` causes Kindle for Mac (and perhaps others) to crash
|
797
|
+
* `text-rendering: optimizeLegibility` causes file to be rejected by KFP (and causes the text to disappear in some previewers)
|
798
|
+
* Kindle Direct Publishing (KDP) strips out select font-related CSS rules (e.g., `font-family`) under certain conditions (for reasons that have proved nearly impossible to reverse engineer); the known workaround is to add a layer of indirection by using `@import` to hide the CSS files from the script
|
799
|
+
|
800
|
+
=== Kindle Direct Publishing
|
801
|
+
|
802
|
+
If you want to publish your book to the Amazon Kindle store, and have your styles and fonts preserved, you must use https://kdp.amazon.com[Kindle Direct Publishing].
|
803
|
+
No other method of publishing to the Amazon Kindle store will leave your book intact.
|
804
|
+
|
805
|
+
This workflow also allows you to preview the book the way your readers will see it.
|
806
|
+
So it's a good way to acceptance test your custom styles to discover which ones are honored and which ones are ignored.
|
807
|
+
|
808
|
+
==== Look Inside
|
809
|
+
|
810
|
+
The Amazon Kindle store offers a “Look Inside” feature for reader.
|
811
|
+
This so-called feature aims to gives readers a glimpse at the contents of the book.
|
812
|
+
Sadly, it does no such thing.
|
813
|
+
Instead, it shows pages from the legacy MOBI document that kindlegen adds to your e-book file, not the higher fidelity KF8 document.
|
814
|
+
This means the preview won't look at all like what the Kindle reader or application will actually show.
|
815
|
+
Custom fonts, font-based icons, and most styles will be missing.
|
816
|
+
|
817
|
+
This situation is unfortunate for authors.
|
818
|
+
What we recommend is to complain loudly to Amazon that they are hurting your sales by displaying a crippled version of your product.
|
819
|
+
Tell them that under no circumstances should they show an altered version of your product.
|
820
|
+
Another option is to contact Amazon to opt-out of this program.
|
821
|
+
|
822
|
+
=== Send to Kindle
|
823
|
+
|
824
|
+
WARNING: Don't use it!
|
825
|
+
|
826
|
+
{uri-send-to-kindle}[Send to Kindle] is a tempting choice for transferring MOBI files to a Kindle device.
|
827
|
+
However, it's utterly broken.
|
828
|
+
If you use this tool, don't be surprised if you see missing font-based icons, default fonts, and other font and style errors in your manuscript.
|
829
|
+
It's known to strip out all the font files and break the encoding of the document.
|
830
|
+
|
831
|
+
We *strongly* recommend you transfer the file to your device using either a USB cable or a sync service such as Dropbox.
|
832
|
+
Once transferred, Whispersync will detect the new file (usually looking in the Books folder) and add it to the “On Device” library.
|
833
|
+
|
834
|
+
It's important to note that “Send to Kindle” is not reflective of the experience readers will have when shopping in the Kindle store.
|
835
|
+
If you use Kindle Direct Publishing (KDP) to publish your book, the integrity of your book will be preserved (to the degree that Amazon allows).
|
836
|
+
|
837
|
+
////
|
838
|
+
head-stop (default '.')
|
839
|
+
stack-head role (run-in is default)
|
840
|
+
signature role (sets hardbreaks option)
|
841
|
+
|
842
|
+
subject-stop (default ':')
|
843
|
+
////
|
844
|
+
|
845
|
+
////
|
846
|
+
== Device and Application Testing
|
847
|
+
|
848
|
+
{project-name} has been tested on the following devices and applications.
|
849
|
+
|
850
|
+
.Computers
|
851
|
+
|===
|
852
|
+
|Device |OS |Resolution |ppi |Browsers |Readium |Gitden |Kindle
|
853
|
+
|
854
|
+
|Asus
|
855
|
+
|Fedora 17
|
856
|
+
|no x no
|
857
|
+
|
|
858
|
+
|Chrome x
|
859
|
+
|Readium
|
860
|
+
|
861
|
+
Asus, Fedora 20, display resolution, Chrome x, Readium
|
862
|
+
Ideapad Y460 |Fedora 20 |1366 x 768 (16:9) |
|
863
|
+
PC, Windows X,
|
864
|
+
|===
|
865
|
+
|
866
|
+
.Tablets
|
867
|
+
|===
|
868
|
+
Asus Transformer, Android x, display resolution, Aldiko, Kindle, Readium, Readmill
|
869
|
+
Nexus,
|
870
|
+
|===
|
871
|
+
|
872
|
+
.Phones
|
873
|
+
|===
|
874
|
+
HTC Sensation, Android x, display resolution, xxxx
|
875
|
+
Nexus ,
|
876
|
+
|===
|
877
|
+
|
878
|
+
////
|
879
|
+
|
880
|
+
ifndef::env-site[]
|
881
|
+
== Contributing
|
882
|
+
|
883
|
+
In the spirit of free software, _everyone_ is encouraged to help improve this project.
|
884
|
+
|
885
|
+
To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
|
886
|
+
|
887
|
+
Feel free to use the {uri-issues}[issue tracker] or {uri-discuss}[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
|
888
|
+
|
889
|
+
== Development
|
890
|
+
|
891
|
+
To help develop {project-name}, or to simply test drive the development version, you need to get the source from GitHub.
|
892
|
+
Follow the instructions below to learn how to clone the source and run it from your local copy.
|
893
|
+
|
894
|
+
=== Retrieve the Source Code
|
895
|
+
|
896
|
+
You can retrieve {project-name} in one of two ways:
|
897
|
+
|
898
|
+
. Clone the git repository
|
899
|
+
. Download a zip archive of the repository
|
900
|
+
|
901
|
+
==== Option 1: Fetch Using `git clone`
|
902
|
+
|
903
|
+
If you want to clone the git repository, simply copy the {uri-repo}[GitHub repository URL] and pass it to the `git clone` command:
|
904
|
+
|
905
|
+
[subs=attributes+]
|
906
|
+
$ git clone {uri-repo}
|
907
|
+
|
908
|
+
Next, change to the project directory:
|
909
|
+
|
910
|
+
[subs=attributes+]
|
911
|
+
$ cd {project-handle}
|
912
|
+
|
913
|
+
==== Option 2: Download the Archive
|
914
|
+
|
915
|
+
If you want to download a zip archive, click on the btn:[icon:cloud-download[\] Download Zip] button on the right-hand side of the repository page on GitHub.
|
916
|
+
Once the download finishes, extract the archive, open a console and change to that directory.
|
917
|
+
|
918
|
+
TIP: Instead of working out of the {project-handle} directory, you can simply add the absolute path of the [path]_bin_ directory to your `PATH` environment variable.
|
919
|
+
|
920
|
+
We'll leverage the project configuration to install the necessary dependencies.
|
921
|
+
|
922
|
+
=== Prepare RVM (optional step)
|
923
|
+
|
924
|
+
If you're using {uri-rvm}[RVM], we recommend creating a new gemset to work with {project-name}:
|
925
|
+
|
926
|
+
$ rvm use 2.2@asciidoctor-epub3-dev --create
|
927
|
+
|
928
|
+
We like RVM because it keeps the dependencies required by various projects isolated.
|
929
|
+
|
930
|
+
=== Install the Dependencies
|
931
|
+
|
932
|
+
The dependencies needed to use {project-name} are defined in the [file]_Gemfile_ at the root of the project.
|
933
|
+
We can use Bundler to install the dependencies for us.
|
934
|
+
|
935
|
+
To check if you have Bundler available, use the `bundle` command to query the version installed:
|
936
|
+
|
937
|
+
$ bundle --version
|
938
|
+
|
939
|
+
If it's not installed, use the `gem` command to install it.
|
940
|
+
|
941
|
+
$ gem install bundler
|
942
|
+
|
943
|
+
Then use the `bundle` command to install the project dependencies:
|
944
|
+
|
945
|
+
$ bundle
|
946
|
+
|
947
|
+
NOTE: You need to call `bundle` from the project directory so that it can find the [file]_Gemfile_.
|
948
|
+
|
949
|
+
=== Build and Install the Gem
|
950
|
+
|
951
|
+
Now that the dependencies are installed, you can build and install the gem.
|
952
|
+
|
953
|
+
Use the Rake build tool to build and install the gem (into the current RVM gemset or into the system if not using RVM):
|
954
|
+
|
955
|
+
$ rake install:local
|
956
|
+
|
957
|
+
The build will report that it built the gem into the [path]_pkg_ directory and that it installed the gem.
|
958
|
+
|
959
|
+
Once the development version of the gem is installed, you can run {project-name} by invoking the `asciidoctor-epub3` script:
|
960
|
+
|
961
|
+
$ asciidoctor-epub3 -v
|
962
|
+
|
963
|
+
If you see the version of {project-name} printed to your console, you're ready to use {project-name}!
|
964
|
+
|
965
|
+
=== Shortcut: Run the Launch Script Directly
|
966
|
+
|
967
|
+
Assuming all the required gems install properly, you can run the `asciidoctor-epub3` script directly out of the project folder using either:
|
968
|
+
|
969
|
+
$ bin/asciidoctor-epub3 -v
|
970
|
+
|
971
|
+
or
|
972
|
+
|
973
|
+
$ bundle exec bin/asciidoctor-epub3 -v
|
974
|
+
|
975
|
+
You're now ready to test drive the development version of {project-name}!
|
976
|
+
|
977
|
+
Jump back to <<Getting Started>> to learn how to create an AsciiDoc document and convert it to EPUB3.
|
978
|
+
endif::[]
|
979
|
+
|
980
|
+
== Authors
|
981
|
+
|
982
|
+
{project-name} was written by https://github.com/mojavelinux[Dan Allen] and https://github.com/graphitefriction[Sarah White] of OpenDevise on behalf of the Asciidoctor Project.
|
983
|
+
|
984
|
+
== Copyright
|
985
|
+
|
986
|
+
Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project.
|
987
|
+
Free use of this software is granted under the terms of the MIT License.
|
988
|
+
|
989
|
+
For the full text of the license, see the <<LICENSE#,LICENSE>> file.
|
990
|
+
Refer to the <<NOTICE#,NOTICE>> file for information about third-party Open Source software in use.
|
991
|
+
|
992
|
+
////
|
993
|
+
== Additional Points of Note
|
994
|
+
|
995
|
+
* uppercase chapter titles to work around line-height limitation in Kindle (1.4 minimum)
|
996
|
+
* using vw units crashes Aldiko
|
997
|
+
* circled numbers from M+ 1mn for annotation numbers in listing blocks
|
998
|
+
* avatars for authors
|
999
|
+
* document command to generate the M+ 1p latin fonts
|
1000
|
+
* recommended e-readers (Readium, Gitden, Kindle, etc)
|
1001
|
+
////
|