asciidoctor-epub3 1.5.0.alpha.6 → 1.5.0.alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +134 -0
- data/Gemfile +10 -0
- data/README.adoc +248 -172
- data/asciidoctor-epub3.gemspec +42 -0
- data/bin/adb-push-ebook +19 -10
- data/data/styles/epub3-css3-only.css +28 -11
- data/data/styles/epub3.css +40 -39
- data/lib/asciidoctor-epub3/converter.rb +188 -121
- data/lib/asciidoctor-epub3/core_ext/string.rb +1 -1
- data/lib/asciidoctor-epub3/font_icon_map.rb +1 -1
- data/lib/asciidoctor-epub3/packager.rb +240 -104
- data/lib/asciidoctor-epub3/spine_item_processor.rb +22 -11
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +24 -35
- data/data/samples/asciidoctor-epub3-readme.adoc +0 -849
- data/data/samples/asciidoctor-js-browser-extension.adoc +0 -46
- data/data/samples/asciidoctor-js-introduction.adoc +0 -91
- data/data/samples/i18n.adoc +0 -161
- data/data/samples/images/asciidoctor-js-chrome-extension.png +0 -0
- data/data/samples/images/avatars/graphitefriction.jpg +0 -0
- data/data/samples/images/avatars/mogztter.jpg +0 -0
- data/data/samples/images/avatars/mojavelinux.jpg +0 -0
- data/data/samples/images/correct-text-justification.png +0 -0
- data/data/samples/images/incorrect-text-justification.png +0 -0
- data/data/samples/images/screenshots/chapter-title-day.png +0 -0
- data/data/samples/images/screenshots/chapter-title.png +0 -0
- data/data/samples/images/screenshots/figure-admonition.png +0 -0
- data/data/samples/images/screenshots/section-title-paragraph.png +0 -0
- data/data/samples/images/screenshots/sidebar.png +0 -0
- data/data/samples/images/screenshots/table.png +0 -0
- data/data/samples/images/screenshots/text.png +0 -0
- data/data/samples/sample-book.adoc +0 -21
- data/data/samples/sample-content.adoc +0 -168
- data/scripts/generate-font-subsets.pe +0 -235
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d837e7c36f6d2e47ee9f436d1a7327e42b304aad
|
4
|
+
data.tar.gz: '02679c6c564034d4fefd752cd26ee1611ac8c3cc'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1284f2bca9f66a2a64d8625d812c83ccd29caac1cabd68c834376429632f0f41e0b443e40ebd03394e3ba846480ee092f8c13130061d50da3270d4d0c9ac29
|
7
|
+
data.tar.gz: ff5db3ebee66a7cafafc0ec294355c422c8cac597ec991d1db49166e064db59e7b81314b58c17adcda0926676358864fa0508b78a429e84f195366131a1bee7c
|
data/CHANGELOG.adoc
ADDED
@@ -0,0 +1,134 @@
|
|
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.7 (2017-04-18) - @mojavelinux
|
9
|
+
|
10
|
+
* generate TOC levels in navigation document based on toclevels attribute (#90)
|
11
|
+
* automatically resolve title of reference between documents (#87)
|
12
|
+
* fix xref between chapter files (#27)
|
13
|
+
* don't include byline in chapter header if the value of the publication-type attribute is book (#86)
|
14
|
+
* don't include avatars if value of publication-type attribute is book (#53)
|
15
|
+
* make a stronger statement in the README about the dangers of the “Send to Kindle” tool
|
16
|
+
* add ebook-compress flag to enable huffdic compression in kindlegen
|
17
|
+
* implement embedded to handle AsciiDoc table cell content (#69)
|
18
|
+
* go into more depth about how to structure the document in README (#45)
|
19
|
+
* explain how to adjust section level of chapters if they use level-2 headings
|
20
|
+
* don't add content image to archive more than once (#76)
|
21
|
+
* warn when xref cannot be resolved and text is provided (#103)
|
22
|
+
* built-in avatar location should respect imagesdir (#2)
|
23
|
+
* change admonition icons (#72) (@PrimaryFeather)
|
24
|
+
* fix broken refs in bibliography (#19)
|
25
|
+
* remove text justification hack (#92)
|
26
|
+
* reset @page for CSS3-capable readers
|
27
|
+
* detect Calibre, set class attribute on body to calibre-desktop, add page margins
|
28
|
+
* force preformatted text to wrap in Gitden
|
29
|
+
* add svg property to front matter only if reference to SVG is detected
|
30
|
+
* switch from word-wrap to standard overflow-wrap property in stylesheet
|
31
|
+
* loosen letter spacing in quote attribute context
|
32
|
+
* adjust font size and margins on Gitden; force margins to be set
|
33
|
+
* document in README that using vw units causes Aldiko to crash
|
34
|
+
* drop trailing semi-colon in value of inline style attributes
|
35
|
+
* use standard format (from core) for warning and error messages
|
36
|
+
* update terminology in README; use ebook instead of e-book; refer to application as ereader
|
37
|
+
* allow front-cover-image to be specified using block image macro (#3)
|
38
|
+
* clean auto-generated file names for chapters (#46)
|
39
|
+
* register chapter ID in references
|
40
|
+
* only wrap open block content in div if id or role is defined (@rvolz)
|
41
|
+
* link to EPUB 3.1 spec from README
|
42
|
+
* set ebook-format-kf8 attribute when ebook-format is specified as mobi
|
43
|
+
* document the front-cover-image attribute properly
|
44
|
+
* update adb-push-book script to honor file extension if specified
|
45
|
+
* document limitations of applying page-break-* property on Kindle
|
46
|
+
* document that Asciidoctor is added as creator if creator attribute is not specified (#68)
|
47
|
+
* group optional gems in the :optional group; remove from gemspec
|
48
|
+
* upgrade kindlegen gem to 3.0.3
|
49
|
+
* upgrade Pygments to 1.1.1 and allow JRuby to install it
|
50
|
+
* document that Pygments bw style is used by default
|
51
|
+
* honor explicit table width even when autowidth option is set
|
52
|
+
* use method_defined? instead of respond_to? to check if method is already defined
|
53
|
+
* fix README typo, strong tag misspelled (@neontapir)
|
54
|
+
* fix name of bundler gem; add NOKOGIRI_USE_SYSTEM_LIBRARIES to install command
|
55
|
+
* state in README that the spine document must only have include directives as content
|
56
|
+
|
57
|
+
== 1.5.0.alpha.6 (2016-01-05) - @mojavelinux
|
58
|
+
|
59
|
+
* disable text-rendering: optimizeLegibility on Kindle devices (#58)
|
60
|
+
* proxy CSS in KF8 format to work around KDP removing font-related CSS rules
|
61
|
+
* don't append source when generating mobi file
|
62
|
+
* disable -webkit-hyphens to prevent Kindle for Mac from crashing (#26)
|
63
|
+
* don't explicitly enable hyphenation
|
64
|
+
* disable hyphens in preformatted text
|
65
|
+
* don't fail if source block is empty
|
66
|
+
* hide style element in body from Aldiko
|
67
|
+
* enable Original (Publisher) font option in iBooks client
|
68
|
+
* preserve heading & monospaced fonts in Kindle Paperwhite/Voyage
|
69
|
+
* force left justification in listings (fix for Namo)
|
70
|
+
* fix documentation regarding uuid attribute (@chkal)
|
71
|
+
* add note that currently images must be placed in a directory called images (@chkal)
|
72
|
+
* fix file type of avatar image in docs (@chkal)
|
73
|
+
* document how to install the pre-release gem (#38)
|
74
|
+
* use built-in font names for mobi7 (#56)
|
75
|
+
* document the epub3-stylesdir attribute
|
76
|
+
* prevent ellipsis from being used in inline code
|
77
|
+
* don't include scoped icon CSS in KF8 format
|
78
|
+
* remove link color hack for Gitden since its already covered
|
79
|
+
* override heading and monospace fonts for non-Kindle epub3 readers
|
80
|
+
* wrap simple dd content in span to allow font to be controlled in iBooks
|
81
|
+
* enforce use of monospace font for preformatted elements
|
82
|
+
* upgrade kindlegen
|
83
|
+
* don't allow UI button to wrap
|
84
|
+
* remove amzn-mobi from media query in CSS3-only file
|
85
|
+
* use CSS property word-wrap instead of word-break
|
86
|
+
* remove charset declaration from CSS
|
87
|
+
* switch samples to modern AsciiDoc syntax
|
88
|
+
|
89
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.6[issues resolved] |
|
90
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.6[git tag]
|
91
|
+
|
92
|
+
== 1.5.0.alpha.5 (2015-11-01) - @mojavelinux
|
93
|
+
|
94
|
+
* implement -o flag (output file) (#31) (@chloerei)
|
95
|
+
* implement the converter method for floating_title (#36)
|
96
|
+
* don't print kindlegen output if -q flag is used (#34)
|
97
|
+
* CLI now identifies as asciidoctor-epub3 (#32)
|
98
|
+
|
99
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.5[issues resolved] |
|
100
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.5[git tag]
|
101
|
+
|
102
|
+
== 1.5.0.alpha.4 (2014-11-28) - @mojavelinux
|
103
|
+
|
104
|
+
* set ebook-format-epub3 attribute (#16)
|
105
|
+
* add box drawing symbols to M+ 1mn font
|
106
|
+
* switch version to 1.5.0.x to align with core
|
107
|
+
|
108
|
+
{uri-repo}/issues?q=milestone%3Av1.5.0.alpha.4[issues resolved] |
|
109
|
+
{uri-repo}/releases/tag/v1.5.0.alpha.4[git tag]
|
110
|
+
|
111
|
+
== 1.0.0.alpha.3 (2014-08-17) - @mojavelinux
|
112
|
+
|
113
|
+
* don't attempt to chdir to DATA_DIR; use full path; for compatibility with AsciidoctorJ
|
114
|
+
* fix BOM regexp in JRuby (again)
|
115
|
+
* switch sample png avatars to jpg
|
116
|
+
* don't install pygments.rb on JRuby
|
117
|
+
|
118
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.4[git tag]
|
119
|
+
|
120
|
+
== 1.0.0.alpha.2 (2014-08-15) - @mojavelinux
|
121
|
+
|
122
|
+
* upgrade to Asciidoctor 1.5.0
|
123
|
+
* use new functionality of doctitle method for splitting up doctitle
|
124
|
+
* don't put units on line-height in stylesheet
|
125
|
+
* use regexp to match the BOM character (used to fix text justification) in JRuby
|
126
|
+
|
127
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.2[git tag]
|
128
|
+
|
129
|
+
== 1.0.0.alpha.1 (2014-07-29) - @mojavelinux
|
130
|
+
|
131
|
+
* initial pre-release
|
132
|
+
|
133
|
+
{uri-repo}/issues?q=milestone%3Av1.0.0.alpha.1[issues resolved] |
|
134
|
+
{uri-repo}/releases/tag/v1.0.0.alpha.1[git tag]
|
data/Gemfile
ADDED
data/README.adoc
CHANGED
@@ -1,37 +1,57 @@
|
|
1
|
-
=
|
1
|
+
= {project-name}: A _native_ EPUB3 converter for AsciiDoc
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
|
4
|
-
:
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
|
10
|
-
:
|
11
|
-
:
|
12
|
-
|
3
|
+
v1.5.0.alpha.7, 2017-04-18
|
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
13
|
ifdef::env-github[]
|
14
|
-
:
|
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:
|
15
21
|
endif::[]
|
16
22
|
ifndef::env-github[]
|
17
|
-
:
|
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-discuss: http://discuss.asciidoctor.org
|
34
|
+
:uri-rvm: https://rvm.io
|
35
|
+
:uri-asciidoctor: http://asciidoctor.org
|
36
|
+
:uri-idpf: http://www.idpf.org/
|
37
|
+
:uri-epub: http://www.idpf.org/epub/31/spec/epub-spec.html
|
38
|
+
:uri-epubcheck: https://github.com/idpf/epubcheck
|
39
|
+
|
40
|
+
ifdef::status[]
|
41
|
+
image:https://img.shields.io/gem/v/asciidoctor-epub3.svg[Latest Release,link={uri-gem}]
|
42
|
+
image:https://img.shields.io/badge/license-MIT-blue.svg[MIT License,link=#copyright]
|
18
43
|
endif::[]
|
19
|
-
:notice-uri: {base-uri}NOTICE.adoc
|
20
|
-
:license-uri: {base-uri}LICENSE.adoc
|
21
|
-
:worklog-uri: {base-uri}WORKLOG.adoc
|
22
|
-
:imagesdir: data/samples/images
|
23
|
-
:experimental:
|
24
44
|
|
25
|
-
{project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI
|
45
|
+
{project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI ebook formats.
|
26
46
|
|
27
47
|
== Introduction
|
28
48
|
|
29
|
-
{project-name} is not merely a converter from AsciiDoc to EPUB3 and KF8/MOBI, but rather a tool to help you create aesthetic, professional, _easy-to-read_
|
30
|
-
Let's face it, many of the technical
|
49
|
+
{project-name} is not merely a converter from AsciiDoc to EPUB3 and KF8/MOBI, but rather a tool to help you create aesthetic, professional, _easy-to-read_ ebooks.
|
50
|
+
Let's face it, many of the technical ebooks out there--especially those produced from software documentation--are *_hideous_*.
|
31
51
|
The Asciidoctor project wants to disrupt the status quo.
|
32
52
|
|
33
53
|
ifdef::env-github[]
|
34
|
-
.An excerpt from an
|
54
|
+
.An excerpt from an ebook produced by {project-name} shown in Day, Night and Sepia mode.
|
35
55
|
image::screenshots/text.png[]
|
36
56
|
endif::[]
|
37
57
|
|
@@ -54,11 +74,11 @@ Exceptional Readability::
|
|
54
74
|
Complete & Accurate Metadata::
|
55
75
|
Fully populate the EPUB3 package metadata using information in the AsciiDoc source document.
|
56
76
|
Consistent Rendering::
|
57
|
-
Render consistently across a broad range of EPUB3 (and select EPUB2+)
|
77
|
+
Render consistently across a broad range of EPUB3 (and select EPUB2+) ereading platforms and respond to any size screen.
|
58
78
|
Polish, Polish & More Polish::
|
59
79
|
Add polish to the final product such as font-based icons and callout numbers.
|
60
80
|
|
61
|
-
We believe that the
|
81
|
+
We believe that the ebooks produced by {project-name} are the _very best_ output you can expect to find in digital publishing today.
|
62
82
|
Of course, there's always room for improvement, so we'll continue to work with you to achieve and maintain this goal.
|
63
83
|
|
64
84
|
=== Notable Features
|
@@ -66,14 +86,14 @@ Of course, there's always room for improvement, so we'll continue to work with y
|
|
66
86
|
* Direct AsciiDoc to EPUB3 conversion
|
67
87
|
* Direct AsciiDoc to KF8/MOBI conversion
|
68
88
|
* Highly-aesthetic and readable styles with optimized text legibility
|
69
|
-
* Respects font settings (if supported by the
|
89
|
+
* Respects font settings (if supported by the ereader) without altering headings, code or icons
|
70
90
|
* EPUB3 metadata, manifest and spine (assembled by Gepub)
|
71
91
|
* Document metadata (title, authors, subject, keywords, etc.)
|
72
92
|
* Internal cross reference links (not yet between chapters)
|
73
93
|
* Syntax highlighting with CodeRay or Pygments (must use inline styles)
|
74
94
|
* Unicode callout numbers
|
75
|
-
* Page breaks avoided in block content (so much as it's supported by the
|
76
|
-
* Orphan section titles avoided (so much as it's supported by the
|
95
|
+
* Page breaks avoided in block content (so much as it's supported by the ereader)
|
96
|
+
* Orphan section titles avoided (so much as it's supported by the ereader)
|
77
97
|
* Table border settings honored
|
78
98
|
* Support for SVG images in the content
|
79
99
|
|
@@ -88,41 +108,96 @@ We may explore the use of fixed layout documents in the future if the need arise
|
|
88
108
|
|
89
109
|
=== Planned Features and Work In Progress
|
90
110
|
|
91
|
-
See
|
111
|
+
See <<WORKLOG#,WORKLOG.adoc>>.
|
92
112
|
|
93
113
|
== Converter Workflow
|
94
114
|
|
95
|
-
{project-name} takes
|
96
|
-
Using the EPUB3 publication as the “digital master”, {project-name} then produces a KF8/MOBI file, the format required by Amazon Kindle.
|
97
|
-
The conversion to KF8/MOBI is performed by sending the EPUB3 through http://www.amazon.com/gp/feature.html?docId=1000765211[KindleGen].
|
115
|
+
{project-name} takes an aggregate AsciiDoc document and its referenced assets as input and converts them to an EPUB3 publication archive (often described as a “website in a box”).
|
98
116
|
|
99
|
-
|
100
|
-
The
|
101
|
-
|
102
|
-
|
117
|
+
{project-name} can also produce a KF8/MOBI file, the format required for viewing on Amazon Kindle, using the EPUB3 publication as the “digital master”.
|
118
|
+
The conversion to KF8/MOBI is performed by generating a slightly modified EPUB3 publication (necessary to adhere to Amazon Kindle requirements) and passing it through the http://www.amazon.com/gp/feature.html?docId=1000765211[KindleGen] application.
|
119
|
+
|
120
|
+
== Structuring your Manuscript
|
121
|
+
|
122
|
+
An EPUB3 archive is composed of multiple files. The content of each “chapter” is typically stored in a dedicated XHTML file.
|
123
|
+
Therefore, the {project-name} converter “chunks” the AsciiDoc source document into multiple XHTML files to add to the EPUB3 archive.
|
124
|
+
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.
|
125
|
+
|
126
|
+
=== Composition Rules
|
127
|
+
|
128
|
+
There are several rules you must follow to successfully convert your AsciiDoc source documents into an EPUB3 publication archive.
|
129
|
+
These rules may be loosened in the future, but they are mandatory at the moment.
|
130
|
+
|
131
|
+
Rule 1::
|
132
|
+
Each chapter must begin in a dedicated file that resides at the root of the project.
|
133
|
+
It must be included into the main document using the AsciiDoc include directive.
|
134
|
+
The main document, which we call the “spine”, may only contain a document header and a sequence of include directives.
|
135
|
+
See <<Declaring the Spine>> for details.
|
136
|
+
+
|
137
|
+
TIP: The include directive may be used in the chapter files to include other files (even files in other folders).
|
138
|
+
|
139
|
+
Rule 2::
|
140
|
+
Each chapter must start with a document title (i.e., level-0 heading).
|
141
|
+
The document header must declare an ID that matches the chapter filename (minus its file extension).
|
142
|
+
|
143
|
+
Rule 3::
|
144
|
+
No sections in a chapter may have the same ID as the chapter ID.
|
145
|
+
|
146
|
+
Rule 4::
|
147
|
+
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>>+`).
|
148
|
+
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.
|
149
|
+
The reftext is optional since the reftext of the target is used by default.
|
150
|
+
+
|
151
|
+
TIP: To assign reference text (i.e., reftext) to chapter title, use the document attribute named `docreftext`.
|
152
|
+
+
|
153
|
+
TIP: Rule 2 states that the chapter ID must match the basename of the chapter file.
|
154
|
+
In truth, the chapter ID can be a _derivative of_ the chapter filename.
|
155
|
+
In that case, an attribute reference can be used to prepend a prefix to an inter-document cross reference.
|
156
|
+
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[]+`.
|
157
|
+
You'd then assign an empty value to the `chapter-prefix` attribute when converting to an ebook and `chapter-` for all other formats.
|
158
|
+
|
159
|
+
The next section goes into more detail about how to set up the spine document and include the chapter files.
|
103
160
|
|
104
161
|
=== Declaring the Spine
|
105
162
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
Asciidoctor
|
111
|
-
|
163
|
+
The spine (or master document) must be well-formed.
|
164
|
+
Otherwise, {project-name} will not convert the document properly.
|
165
|
+
If your AsciiDoc documents are not structured as explained in this section, you'll need to change them.
|
166
|
+
|
167
|
+
Asciidoctor uses top-level include directives (i.e., include directives in the master document) to indicate where each chapter split should occur.
|
168
|
+
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.
|
169
|
+
Only the document title is required.
|
170
|
+
|
171
|
+
The document title in the chapter file is used as the chapter title and the label for the chapter in the TOC.
|
172
|
+
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).
|
173
|
+
We recommend that you base the filename of the chapter on the chapter ID.
|
174
|
+
|
175
|
+
If you don't specify an ID for a chapter, one will be generated automatically from the document title.
|
176
|
+
The rules for generating a chapter ID from the document title are as follows:
|
177
|
+
|
178
|
+
* apply inline formatting, then remove XML elements
|
179
|
+
* remove the `\’` character reference (so `John\’s` becomes `Johns`)
|
180
|
+
* replace `\&` with the word `and` (so `John \& Jane` becomes `John and Jane`)
|
181
|
+
* expand all other character references
|
182
|
+
* lowercase all characters
|
183
|
+
* replace illegal ID characters with the character defined by the `idseparator` attribute
|
184
|
+
* prepend the value of the `idprefix` attribute
|
185
|
+
* prepend an underscore if the ID begins with a number
|
112
186
|
|
113
187
|
You can think of the master document as the spine of the book and the include directives the individual items being bound together.
|
114
|
-
The target of each include directive in the master document is parsed and rendered as a separate AsciiDoc document, with certain options and attributes
|
188
|
+
The target of each include directive in the master document is parsed and rendered as a separate AsciiDoc document, with certain options and attributes passed down from the master to ensure consistent behavior.
|
115
189
|
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).
|
116
190
|
|
117
191
|
Here's an example showing the structure of a spine document:
|
118
192
|
|
193
|
+
[source,asciidoc]
|
119
194
|
----
|
120
195
|
= Book Title
|
121
196
|
Author Name
|
122
197
|
:doctype: book
|
123
198
|
:imagesdir: images
|
124
|
-
//...and so on
|
125
199
|
\ifndef::ebook-format[:leveloffset: 1]
|
200
|
+
//...and so on
|
126
201
|
|
127
202
|
\include::chapter-one.adoc[]
|
128
203
|
|
@@ -131,22 +206,32 @@ Author Name
|
|
131
206
|
\include::chapter-three.adoc[]
|
132
207
|
----
|
133
208
|
|
209
|
+
IMPORTANT: The spine document cannot contain any content other than include directives.
|
210
|
+
|
134
211
|
Here's an example showing the structure of a chapter document:
|
135
212
|
|
213
|
+
[source,asciidoc]
|
136
214
|
----
|
137
|
-
[
|
215
|
+
[#chapter-one]
|
138
216
|
= Chapter One
|
139
217
|
|
140
218
|
chapter content
|
141
219
|
----
|
142
220
|
|
143
|
-
CAUTION: Although an explicit ID over the chapter title is not required, it
|
144
|
-
See issue https://github.com/asciidoctor/asciidoctor-epub3/issues/46[#46] for details.
|
221
|
+
CAUTION: Although an explicit ID over the chapter title is not required, it's recommended for stability.
|
145
222
|
|
146
|
-
If
|
223
|
+
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:
|
147
224
|
|
148
|
-
|
149
|
-
|
225
|
+
[source,asciidoc]
|
226
|
+
----
|
227
|
+
\ifndef::ebook-format[:leveloffset: -1]
|
228
|
+
----
|
229
|
+
|
230
|
+
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.
|
231
|
+
(Currently broken. See issue {uri-issues}/47[#47]).
|
232
|
+
|
233
|
+
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.
|
234
|
+
However, for the time being, the include directive fills this role.
|
150
235
|
|
151
236
|
== Prerequisites
|
152
237
|
|
@@ -158,15 +243,15 @@ To check if you have Ruby available, use the `ruby` command to query the install
|
|
158
243
|
|
159
244
|
== Getting Started
|
160
245
|
|
161
|
-
You can get {project-name} by <<
|
246
|
+
You can get {project-name} by <<Install the Published Gem,installing the published gem>> or <<Development,running the code from source>>.
|
162
247
|
|
163
248
|
=== Install the Published Gem
|
164
249
|
|
165
250
|
{project-name} is published as a pre-release on RubyGems.org.
|
166
251
|
You can install the published gem using the following command:
|
167
252
|
|
168
|
-
$ gem install asciidoctor-epub3 --pre
|
169
|
-
|
253
|
+
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install asciidoctor-epub3 --pre
|
254
|
+
|
170
255
|
If you want to syntax highlight source listings, you'll also want to install CodeRay or Pygments.
|
171
256
|
Choose one (or more) of the following:
|
172
257
|
|
@@ -175,15 +260,18 @@ Choose one (or more) of the following:
|
|
175
260
|
|
176
261
|
.Pygments
|
177
262
|
$ gem install pygments.rb
|
178
|
-
|
263
|
+
|
179
264
|
You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (CodeRay shown):
|
180
265
|
|
181
266
|
[source,asciidoc]
|
182
267
|
----
|
183
|
-
:source-highlighter: coderay
|
268
|
+
:source-highlighter: coderay
|
184
269
|
----
|
185
270
|
|
186
271
|
NOTE: At the moment, Pygments is automatically used if it's available.
|
272
|
+
If a style is not specified, the black and white theme (i.e., bw) is used.
|
273
|
+
This default is used so that the syntax highlighting is legibile regardless of which reading mode the reader selects (white, black, sepia, etc).
|
274
|
+
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`).
|
187
275
|
|
188
276
|
Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
|
189
277
|
|
@@ -202,8 +290,9 @@ If you don't already have an AsciiDoc document, you can use the [file]_sample-bo
|
|
202
290
|
Author Name
|
203
291
|
v1.0, 2014-04-15
|
204
292
|
:doctype: book
|
293
|
+
:creator: {author}
|
205
294
|
:producer: Asciidoctor
|
206
|
-
:keywords: Asciidoctor, samples,
|
295
|
+
:keywords: Asciidoctor, samples, ebook, EPUB3, KF8, MOBI, Asciidoctor.js
|
207
296
|
:copyright: CC-BY-SA 3.0
|
208
297
|
:imagesdir: images
|
209
298
|
|
@@ -232,13 +321,14 @@ The `dc` namespace prefix is in reference to the http://dublincore.org/documents
|
|
232
321
|
|uuid
|
233
322
|
|Populates the *required* unique identifier (`<dc:identifier>`) in the package metadata.
|
234
323
|
An id will be generated automatically from the doctitle if not specified.
|
235
|
-
The recommended practice is to identify the document by means of a string or number conforming to a formal identification system.
|
324
|
+
The recommended practice is to identify the document by means of a string or number conforming to a formal identification system.
|
236
325
|
|
237
326
|
|lang
|
238
327
|
|Populates the content language / locale (`<dc:language>`) in the package metadata.
|
239
328
|
|
240
329
|
|scripts
|
241
|
-
|Controls the font subsets that are selected based on the specified scripts (e.g., alphabets).
|
330
|
+
|Controls the font subsets that are selected based on the specified scripts (e.g., alphabets).
|
331
|
+
(values: *latin*, latin-ext, latin-cyrillic or multilingual)
|
242
332
|
|
243
333
|
|revdate
|
244
334
|
|Populates the publication date (`<dc:date>`) in the package metadata.
|
@@ -253,16 +343,15 @@ The title is added to the metadata in plain text format.
|
|
253
343
|
The authors in each chapter document are aggregated together with the authors in the master file.
|
254
344
|
|
255
345
|
|username
|
256
|
-
|Used to resolve
|
257
|
-
The avatar image should be located at the path _
|
258
|
-
`{username}` is the value of this attribute.
|
346
|
+
|Used to resolve the 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`.
|
347
|
+
The avatar image should be located at the path _\{imagesdir}/avatars/\{username}.jpg_, where `\{username}` is the value of this attribute.
|
259
348
|
|
260
349
|
|producer
|
261
350
|
|Populates the publisher (`<dc:publisher>`) in the package metadata.
|
262
351
|
|
263
352
|
|creator
|
264
353
|
|Populates the creator (`<dc:creator>`) in the package metadata.
|
265
|
-
If the creator is not specified, the
|
354
|
+
*If the creator is not specified, Asciidoctor is added as the creator with the role "mfr" (an abbreviation for manufacturer).*
|
266
355
|
|
267
356
|
|description
|
268
357
|
|Populates the description (`<dc:description>`) in the package metadata.
|
@@ -273,8 +362,8 @@ The keywords should be represented as comma-separated values (CSV).
|
|
273
362
|
|
274
363
|
|front-cover-image
|
275
364
|
|Populates the front cover image and the image on the cover page (EPUB3 only) in the package metadata.
|
276
|
-
The image is also added to the
|
277
|
-
|
365
|
+
The image is also added to the ebook archive.
|
366
|
+
The value may be specified as a path or inline image macro.
|
278
367
|
Using the inline image macro is preferred as it allows the height and width to be specified.
|
279
368
|
|
280
369
|
|copyright
|
@@ -294,12 +383,18 @@ _Only applies to a chapter document._
|
|
294
383
|
|doctype
|
295
384
|
|Effectively ignored.
|
296
385
|
The master document is assumed to be a book and each chapter an article.
|
386
|
+
|
387
|
+
|publication-type
|
388
|
+
|Used to control the inclusion of special content in the generated HTML.
|
389
|
+
If set to a value other than book, the byline information (author and avatar) is included below the chapter header.
|
390
|
+
Suggested values include: book (default), anthology, magazine, journal, article.
|
297
391
|
|===
|
298
392
|
|
299
|
-
When using the EPUB3 converter, the `ebook-format` attribute resolves to the name of the
|
393
|
+
When using the EPUB3 converter, the `ebook-format` attribute resolves to the name of the ebook format being generated (epub3 or kf8) and the corresponding attribute `ebook-format-<name>` is defined, where `<name>` is `epub3` or `kf8`.
|
300
394
|
You can use these attributes in a preprocessor directive if you only want to show certain content to readers using a particular device.
|
301
395
|
For instance, if you want to display a message to readers on Kindle, you can use:
|
302
396
|
|
397
|
+
[source,asciidoc]
|
303
398
|
----
|
304
399
|
\ifdef::ebook-format-kf8[Hello Kindle reader!]
|
305
400
|
----
|
@@ -320,7 +415,7 @@ We also recommend specifying an output directory using the `-D` option flag.
|
|
320
415
|
$ asciidoctor-epub3 -D output data/samples/sample-book.adoc
|
321
416
|
|
322
417
|
When the script completes, you'll see the file [file]_sample-book.epub_ appear in the [path]_output_ directory.
|
323
|
-
Open that file with an
|
418
|
+
Open that file with an EPUB reader (aka ereader) to view the result.
|
324
419
|
|
325
420
|
Below are several screenshots of this sample book as it appears on an Android phone.
|
326
421
|
|
@@ -352,19 +447,20 @@ Next, let's validate the EPUB3 archive to ensure it built correctly.
|
|
352
447
|
$ asciidoctor-epub3 -D output -a ebook-validate data/samples/sample-book.adoc
|
353
448
|
|
354
449
|
.Validation success
|
355
|
-
|
450
|
+
[.output]
|
451
|
+
....
|
356
452
|
Epubcheck Version 3.0.1
|
357
453
|
|
358
454
|
Validating against EPUB version 3.0
|
359
455
|
No errors or warnings detected.
|
360
|
-
|
456
|
+
....
|
361
457
|
|
362
458
|
If the EPUB3 archive contains any errors, they will be output in your terminal.
|
363
459
|
|
364
460
|
.EPUB Standard & Validator
|
365
461
|
****
|
366
|
-
The electronic publication (EPUB) standard is developed by the {idpf
|
367
|
-
{epub
|
462
|
+
The electronic publication (EPUB) standard is developed by the {uri-idpf}[International Digital Publishing Forum (IDPF)].
|
463
|
+
{uri-epub}[EPUB 3.1], released in January 2017, is the latest version of this standard.
|
368
464
|
|
369
465
|
An EPUB3 archive contains:
|
370
466
|
|
@@ -373,7 +469,7 @@ An EPUB3 archive contains:
|
|
373
469
|
* one or more content documents
|
374
470
|
* assets (images, fonts, stylesheets, etc.)
|
375
471
|
|
376
|
-
The IDPF also supports {epubcheck
|
472
|
+
The IDPF also supports {uri-epubcheck}[EpubCheck].
|
377
473
|
EpubCheck parses and validates the file against the EPUB schema.
|
378
474
|
****
|
379
475
|
|
@@ -392,7 +488,7 @@ You just need to specify the format (`-a ebook-format`) as `kf8`.
|
|
392
488
|
$ asciidoctor-epub3 -D output -a ebook-format=kf8 data/samples/sample-book.adoc
|
393
489
|
|
394
490
|
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.
|
395
|
-
|
491
|
+
|
396
492
|
KindleGen does mandatory validation so you don't need to run the `validate` command after converting to KF8/MOBI.
|
397
493
|
|
398
494
|
.What is KF8?
|
@@ -417,17 +513,20 @@ That's why we refer to the format in this project as KF8/MOBI.
|
|
417
513
|
Extracts the EPUB3 to a folder in the destination directory after the file is generated
|
418
514
|
|
419
515
|
*-a ebook-format=<format>* ::
|
420
|
-
Specifies the
|
516
|
+
Specifies the ebook format to generate (epub3 or kf8, default: epub3)
|
421
517
|
|
422
518
|
*-a ebook-validate* ::
|
423
519
|
Runs Epubcheck 3.0.1 to validate output file against the EPUB3 specification
|
424
520
|
|
521
|
+
*-a ebook-compress=<0|1|2|none|standard|huffdic>* ::
|
522
|
+
Controls the compression type used by kindlegen (0=none [default if unset], 1=standard [default if empty], 2=huffdic)
|
523
|
+
|
425
524
|
*-v, --version* ::
|
426
525
|
Display the program version
|
427
526
|
|
428
527
|
=== EPUB3 Archive Structure
|
429
528
|
|
430
|
-
Here's a sample manifest of files found in an EPUB3 document produced by
|
529
|
+
Here's a sample manifest of files found in an EPUB3 document produced by {project-name}.
|
431
530
|
|
432
531
|
....
|
433
532
|
META-INF/
|
@@ -467,10 +566,17 @@ mimetype
|
|
467
566
|
|
468
567
|
== Working with Images
|
469
568
|
|
470
|
-
Images
|
471
|
-
|
569
|
+
Images referenced in your AsciiDoc document must be stored in the images catalog.
|
570
|
+
The images catalog is defined by the `imagesdir` attribute.
|
571
|
+
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.
|
572
|
+
(In other words, it cannot point to a location outside the document directory).
|
573
|
+
If this attribute is not set, the images catalog defaults to the directory of the spine document.
|
574
|
+
{project-name} will discover all local image references and insert those images into the EPUB3 archive at the same relative path.
|
575
|
+
|
576
|
+
WARNING: {project-name} does not currently discover and package inline images.
|
577
|
+
See issue {uri-issues}/30[#30].
|
472
578
|
|
473
|
-
|
579
|
+
=== Default Images
|
474
580
|
|
475
581
|
The sample book contains placeholder images for an author avatar and a book cover.
|
476
582
|
|
@@ -478,34 +584,49 @@ The sample book contains placeholder images for an author avatar and a book cove
|
|
478
584
|
|
479
585
|
=== Changing the Cover Image
|
480
586
|
|
481
|
-
|
587
|
+
Ereaders have different image resolution and file size limits regarding a book's cover.
|
482
588
|
Kindle covers tend to be 1050x1600 (16:9 resolution), which is the size of the sample cover provided with {project-name}.
|
483
|
-
To ensure your cover displays correctly, you'll want to review the documentation or publisher guidelines for the
|
589
|
+
To ensure your cover displays correctly, you'll want to review the documentation or publisher guidelines for the reading platform you're targeting.
|
484
590
|
|
485
591
|
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.
|
486
592
|
|
487
593
|
Feel free to use the SVG of the sample cover in the [path]_data/images_ folder as a template for creating your own cover.
|
488
594
|
Once your image is ready, you can replace the placeholder cover image by defining the `front-cover-image` attribute in the header of the master document.
|
489
595
|
|
596
|
+
[source,asciidoc]
|
490
597
|
----
|
491
|
-
:front-cover-image: image:cover.png[
|
598
|
+
:front-cover-image: image:cover.png[Front Cover,1050,1600]
|
492
599
|
----
|
493
600
|
|
494
|
-
The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the document
|
495
|
-
The image can be in any format, though we recommend using PNG or
|
601
|
+
The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the directory of the spine document.
|
602
|
+
The image can be in any format, though we recommend using PNG, JPG, or SVG as they are the most portable formats.
|
496
603
|
|
497
|
-
IMPORTANT: You should always specify the dimensions of the cover image
|
604
|
+
IMPORTANT: *You should always specify the dimensions of the cover image.*
|
498
605
|
This ensures the viewer will preserve the aspect ratio if it needs to be scaled to fit the screen.
|
499
606
|
If you don't specify a width and height, then the dimensions are assumed to be 1050x1600.
|
500
607
|
|
608
|
+
=== How to Organize Images by Chapter
|
609
|
+
|
610
|
+
You can set the `imagesdir` attribute per chapter (as long as the attribute is not overridden by the API).
|
611
|
+
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.
|
612
|
+
|
613
|
+
[source,asciidoc]
|
614
|
+
----
|
615
|
+
:imagesdir: chapter-one/images
|
616
|
+
\include::chapter-one.adoc[]
|
617
|
+
|
618
|
+
:imagesdir: chapter-two/images
|
619
|
+
\include::chapter-two.adoc[]
|
620
|
+
----
|
621
|
+
|
501
622
|
== About the Theme
|
502
623
|
|
503
624
|
EPUB3 and KF8/MOBI files are styled using CSS3.
|
504
|
-
However, each
|
625
|
+
However, each ereading platform honors a reduced set of CSS3 styles, and the styles they allow and how they implement them are rarely documented.
|
505
626
|
All we've got to say is _thank goodness for CSS hacks, media queries and years of CSS experience!_
|
506
627
|
|
507
|
-
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
|
508
|
-
The theme maintains readability regardless of the
|
628
|
+
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.
|
629
|
+
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.
|
509
630
|
|
510
631
|
The theme's CSS files are located in the [path]_data/style_ directory.
|
511
632
|
|
@@ -520,66 +641,10 @@ The theme's fonts are located in the [path]_data/fonts_ directory.
|
|
520
641
|
The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
|
521
642
|
The body text uses Noto Serif.
|
522
643
|
Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
|
523
|
-
Refer to the
|
644
|
+
Refer to the <<NOTICE#,NOTICE>> file for further information about the fonts.
|
524
645
|
|
525
646
|
// TODO document command to generate the M+ 1p latin fonts
|
526
647
|
|
527
|
-
=== Text Justification Hack
|
528
|
-
|
529
|
-
Many of the EPUB3 readers use the http://webkit.org[WebKit browser engine] to render the content and apply the CSS formatting and styles.
|
530
|
-
Generally speaking, WebKit is a great engine that brings a lot of consistency and power to the e-book reader landscape.
|
531
|
-
It also brings along the same set of bugs present in browsers that are based on it.
|
532
|
-
|
533
|
-
One particular bug in WebKit causes rich text to be justified incorrectly.
|
534
|
-
Specifically, when the value of the `text-align` property is `justify`, WebKit drops the space between formatted text (bold, italic, hyperlink, etc) and non-formatted text, causing the words to be unevenly spaced across the line.
|
535
|
-
You can see an example of this problem in the screenshot below.
|
536
|
-
|
537
|
-
.WebKit justifying rich text incorrectly
|
538
|
-
image::incorrect-text-justification.png[]
|
539
|
-
|
540
|
-
It's not terrible, but just enough to disrupt a reader's flow.
|
541
|
-
Here's how we expect the text to look:
|
542
|
-
|
543
|
-
.WebKit justifying rich text correctly after the “word joiner hack” is applied
|
544
|
-
image::correct-text-justification.png[]
|
545
|
-
|
546
|
-
After some time in the tech lab and some dumb luck, we found a way to trick WebKit into justifying the text correctly!
|
547
|
-
We call it the “word joiner hack”.
|
548
|
-
|
549
|
-
Here's the HTML source of the first sentence from the screenshots:
|
550
|
-
|
551
|
-
```xml
|
552
|
-
<strong><a href="...">Fork</a> the repository</srtong> <span>and clone it locally.</span>
|
553
|
-
```
|
554
|
-
|
555
|
-
WebKit treats the space following an inline element as insignificant and thus fails to account for it when justifying the text.
|
556
|
-
|
557
|
-
At first glance, you might think to add a normal space character before the closing tag of the inline element (e.g., `+<a href="...">Fork </a>+`).
|
558
|
-
However, that would cause any underline beneath links to extend past the end of the word.
|
559
|
-
|
560
|
-
At second glance, you might think to add a zero-width space character immediately following the element (e.g., `+<a href="...">Fork</a>​+`).
|
561
|
-
However, that's problematic if the next character is a period or other punctuation because it introduces a wrap opportunity where there shouldn't be one.
|
562
|
-
|
563
|
-
Reflecting on the problem of the zero-width space brings us to either the http://www.fileformat.info/info/unicode/char/FEFF/index.htm[zero-width no-break space] character (e.g., `+<a href="...">Fork</a>+`) or the http://www.fileformat.info/info/unicode/char/2060/index.htm[word joiner] character (e.g., `+<a href="...">Fork</a>⁠+`).
|
564
|
-
Like the zero-width space, these characters occupy no space.
|
565
|
-
However, instead of introducing a wrap opportunity, they prevent one.
|
566
|
-
|
567
|
-
But here's the clincher.
|
568
|
-
If the character following a zero-width non-break space or a word joiner is a normal space (e.g., `+<a href="...">Fork</a> the+`), then it behaves just like a regular space.
|
569
|
-
We've covered all the scenarios!
|
570
|
-
Hey WebKit, you've been Unicode punked!
|
571
|
-
|
572
|
-
*UPDATE:* The zero-width no-break space was deprecated in favor of the word joiner.
|
573
|
-
However, as we've discovered, font support for the word joiner is abysmal, whereas the zero-width no-break space is supported everywhere we've checked.
|
574
|
-
Therefore, we've decided to go with the zero-width no-break space to avoid nasty rectangle outlines from font bombing your content.
|
575
|
-
|
576
|
-
_By adding the +++<del>word joiner</del>+++ zero-width no-break space character immediately after any inline element, we can trick WebKit into justifying the text properly, as shown in the second screenshot above._
|
577
|
-
|
578
|
-
NOTE: You won't see `` anywhere in the HTML source.
|
579
|
-
That's because we use the actual Unicode character so that any regular expressions being applied to the text still work as expected.
|
580
|
-
|
581
|
-
Although the fix may seem minor enhancement, it plays an important role in reaching one of the core objectives of this converter: to make the text in the EPUB3 as readable as possible.
|
582
|
-
|
583
648
|
=== Device-specific Styles
|
584
649
|
|
585
650
|
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 http://www.idpf.org/epub/301/spec/epub-contentdocs.html#app-epubReadingSystem[epubReadingSystem] JavaScript object.
|
@@ -632,12 +697,12 @@ File type,Destination on Android device
|
|
632
697
|
,===
|
633
698
|
|
634
699
|
Amazon Kindle should immediately detect the new file and display it in your “On Device” library.
|
635
|
-
You'll have to manually import the EPUB3 into your
|
636
|
-
|
700
|
+
You'll have to manually import the EPUB3 into your ereader of choice.
|
701
|
+
|
637
702
|
== E-book Reader Recommendations and Quirks
|
638
703
|
|
639
|
-
EPUB3
|
640
|
-
Here's a list of some of the
|
704
|
+
EPUB3 ereaders will provide the best reading experience when viewing the book generated by {project-name}.
|
705
|
+
Here's a list of some of the ereaders we know to have good EPUB3 support and the systems on which they run:
|
641
706
|
|
642
707
|
* http://www.amazon.com/gp/feature.html?docId=1000493771[Amazon Kindle] (most platforms)
|
643
708
|
* http://gitden.com/gitdenreader[Gitden] (Android and iOS)
|
@@ -647,25 +712,25 @@ Here's a list of some of the readers we know to have good EPUB3 support and the
|
|
647
712
|
* http://www.namo.com/site/namo/menu/5074.do[Namo PubTreeViewer] (Android, iOS and Windows)
|
648
713
|
* http://calibre-ebook.com[Calibre ebook-viewer] (Linux, OSX, Windows)
|
649
714
|
|
650
|
-
IMPORTANT: To get the full experience, ensure that the
|
651
|
-
Different
|
715
|
+
IMPORTANT: To get the full experience, *ensure that the ereader is configured to use the publisher's styles*.
|
716
|
+
Different ereaders word this setting in different ways.
|
652
717
|
Look for the option screen that allows you to set the fonts and font colors and disable it.
|
653
718
|
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.
|
654
719
|
|
655
|
-
When the book is viewed in EPUB2
|
656
|
-
EPUB2
|
720
|
+
When the book is viewed in EPUB2 ereaders and Kindle apps/devices which have reached their end-of-life (EOL), the ebook relies on the strong semantics of the HTML and some fallback styles to render properly.
|
721
|
+
EPUB2 ereaders, such as Aldiko, don't understand CSS3 styles and therefore miss out on some of subtleties in the formatting.
|
657
722
|
|
658
|
-
As mentioned in the <<
|
723
|
+
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 ereaders, despite the different CSS implementation rules and limitations unique to each ebook application.
|
659
724
|
Most of these obstacles were addressed using media queries or explicit classes.
|
660
|
-
Some we haven't conquered.
|
725
|
+
Some we haven't conquered.
|
661
726
|
Yet.
|
662
727
|
|
663
|
-
The <<
|
728
|
+
The <<kindle-quirks,Kindle quirks list>> shows you just a few of the constraints we encountered.
|
664
729
|
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.
|
665
730
|
|
666
731
|
// 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)
|
667
732
|
|
668
|
-
[
|
733
|
+
[#kindle-quirks]
|
669
734
|
.Kindle Quirks
|
670
735
|
* overrules margins and line heights like a medieval tyrant
|
671
736
|
* `font-family` can't be set on `<body>`
|
@@ -674,6 +739,7 @@ To see all of the workarounds and why we chose certain style options, check out
|
|
674
739
|
* strips (or unwraps) `<header>` tags
|
675
740
|
* `@page` isn't supported
|
676
741
|
* `page-break: avoid` isn't supported
|
742
|
+
* `page-break-*` cannot be applied using a compound or nested CSS selector; must be a simple ID or class
|
677
743
|
* `max-width` isn't supported
|
678
744
|
* `widows` are left in the cold
|
679
745
|
* won't style footers without an explicit class
|
@@ -683,9 +749,16 @@ To see all of the workarounds and why we chose certain style options, check out
|
|
683
749
|
|
684
750
|
=== Send to Kindle
|
685
751
|
|
686
|
-
|
687
|
-
|
688
|
-
|
752
|
+
WARNING: Don't use it!
|
753
|
+
|
754
|
+
The “Send to Kindle” feature, a convenient tool for transferring a MOBI file to a Kindle device, is utterly broken.
|
755
|
+
It's known to strip out all the font files and break the encoding of the document.
|
756
|
+
|
757
|
+
If you use this feature, don't be surprised if you see default fonts, missing font-based icons, and other font and style errors.
|
758
|
+
We *strongly* recommend that you transfer the file to your device using other means, such as a USB cable or sync service like Dropbox.
|
759
|
+
|
760
|
+
It's also important to know that “Send to Kindle” is not indicative of the experience readers will have when shopping in the Kindle store.
|
761
|
+
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).
|
689
762
|
|
690
763
|
////
|
691
764
|
head-stop (default '.')
|
@@ -702,7 +775,7 @@ subject-stop (default ':')
|
|
702
775
|
|
703
776
|
.Computers
|
704
777
|
|===
|
705
|
-
|Device |OS |Resolution |ppi |Browsers |Readium |Gitden |Kindle
|
778
|
+
|Device |OS |Resolution |ppi |Browsers |Readium |Gitden |Kindle
|
706
779
|
|
707
780
|
|Asus
|
708
781
|
|Fedora 17
|
@@ -713,7 +786,7 @@ subject-stop (default ':')
|
|
713
786
|
|
714
787
|
Asus, Fedora 20, display resolution, Chrome x, Readium
|
715
788
|
Ideapad Y460 |Fedora 20 |1366 x 768 (16:9) |
|
716
|
-
PC, Windows X,
|
789
|
+
PC, Windows X,
|
717
790
|
|===
|
718
791
|
|
719
792
|
.Tablets
|
@@ -724,8 +797,8 @@ Nexus,
|
|
724
797
|
|
725
798
|
.Phones
|
726
799
|
|===
|
727
|
-
HTC Sensation, Android x, display resolution, xxxx
|
728
|
-
Nexus ,
|
800
|
+
HTC Sensation, Android x, display resolution, xxxx
|
801
|
+
Nexus ,
|
729
802
|
|===
|
730
803
|
|
731
804
|
////
|
@@ -736,11 +809,11 @@ In the spirit of free software, _everyone_ is encouraged to help improve this pr
|
|
736
809
|
|
737
810
|
To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
|
738
811
|
|
739
|
-
Feel free to use the {
|
812
|
+
Feel free to use the {uri-issues}[issue tracker] or {uri-discuss}[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
|
740
813
|
|
741
814
|
== Development
|
742
815
|
|
743
|
-
To help develop
|
816
|
+
To help develop {project-name}, or to simply test drive the development version, you need to get the source from GitHub.
|
744
817
|
Follow the instructions below to learn how to clone the source and run it from your local copy.
|
745
818
|
|
746
819
|
=== Retrieve the Source Code
|
@@ -752,13 +825,15 @@ You can retrieve {project-name} in one of two ways:
|
|
752
825
|
|
753
826
|
==== Option 1: Fetch Using `git clone`
|
754
827
|
|
755
|
-
If you want to clone the git repository, simply copy the {
|
828
|
+
If you want to clone the git repository, simply copy the {uri-repo}[GitHub repository URL] and pass it to the `git clone` command:
|
756
829
|
|
757
|
-
|
830
|
+
[subs=attributes+]
|
831
|
+
$ git clone {uri-repo}
|
758
832
|
|
759
833
|
Next, change to the project directory:
|
760
834
|
|
761
|
-
|
835
|
+
[subs=attributes+]
|
836
|
+
$ cd {project-handle}
|
762
837
|
|
763
838
|
==== Option 2: Download the Archive
|
764
839
|
|
@@ -771,7 +846,7 @@ We'll leverage the project configuration to install the necessary dependencies.
|
|
771
846
|
|
772
847
|
=== Prepare RVM (optional step)
|
773
848
|
|
774
|
-
If you're using {rvm
|
849
|
+
If you're using {uri-rvm}[RVM], we recommend creating a new gemset to work with {project-name}:
|
775
850
|
|
776
851
|
$ rvm use 2.2@asciidoctor-epub3-dev --create
|
777
852
|
|
@@ -788,7 +863,7 @@ To check if you have Bundler available, use the `bundle` command to query the ve
|
|
788
863
|
|
789
864
|
If it's not installed, use the `gem` command to install it.
|
790
865
|
|
791
|
-
$ gem install
|
866
|
+
$ gem install bundler
|
792
867
|
|
793
868
|
Then use the `bundle` command to install the project dependencies:
|
794
869
|
|
@@ -832,18 +907,19 @@ Jump back to <<Getting Started>> to learn how to create an AsciiDoc document and
|
|
832
907
|
|
833
908
|
== Copyright
|
834
909
|
|
835
|
-
Copyright (C) 2014-
|
910
|
+
Copyright (C) 2014-2017 OpenDevise Inc. and the Asciidoctor Project.
|
836
911
|
Free use of this software is granted under the terms of the MIT License.
|
837
912
|
|
838
|
-
For the full text of the license, see the
|
839
|
-
Refer to the
|
913
|
+
For the full text of the license, see the <<LICENSE#,LICENSE>> file.
|
914
|
+
Refer to the <<NOTICE#,NOTICE>> file for information about third-party Open Source software in use.
|
840
915
|
|
841
916
|
////
|
842
917
|
== Additional Points of Note
|
843
918
|
|
844
919
|
* uppercase chapter titles to work around line-height limitation in Kindle (1.4 minimum)
|
920
|
+
* using vw units crashes Aldiko
|
845
921
|
* circled numbers from M+ 1mn for annotation numbers in listing blocks
|
846
922
|
* avatars for authors
|
847
923
|
* document command to generate the M+ 1p latin fonts
|
848
|
-
* recommended
|
924
|
+
* recommended ereaders (Readium, Gitden, Kindle, etc)
|
849
925
|
////
|