asciidoctor-epub3 1.5.0.alpha.19 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30d660ed4a7fc21dc01c61ae77515dbba77dd8bbbd7618e45709f7048745040c
4
- data.tar.gz: f3b2d04be71c163e9ed29ae907f2a2c2ab00ecd3e6ecb329775952b5853ebf9d
3
+ metadata.gz: 41b54ee8dc9d1be6beb0b1e120bbec6f1092844b857565c486bf4e7544a9d1f2
4
+ data.tar.gz: c19f9ca716e1bbfd51d1cb7c76956eebccfddbb5a44fd0741176e53664f9015e
5
5
  SHA512:
6
- metadata.gz: 06fb18e09b9ec33401e46168f85436c871accb1f3774b51a8f29373185ba1a538bb2f7a00663e37a43c778238b8bd55ac01883b58f8a173041b0fcb20acdea91
7
- data.tar.gz: 248b718e05d9e8750dbb44117de81a04cdde271da64f96b720f145e54de61a19cf79d29e7f2dd4b2664f84b9c534c38d94ca84e6e87982839a31144c0cf0a3f2
6
+ metadata.gz: 73bd3c80e9e1e25649abf4e6caa79e4c0a891e951d9667d5a0140bbcdcd0bd0399560d37086f35dafc06d3be8eae9d443d119606c55404cc82cdc144356ac446
7
+ data.tar.gz: fe37d04a7bacc742328dc817cb084c01b8b067a97bba864b343987876e9a7cb90c919b470337e69cddd5942b84d3030e52aea61c780e54a57473893fb4eccacd
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,15 @@
5
5
  This document provides a high-level view of the changes to the {project-name} by release.
6
6
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
7
 
8
+ == 1.5.0 (2021-04-29) - @slonopotamus
9
+
10
+ * update Font Awesome Solid to 5.15.1
11
+ * use CSS for image size scaling instead of `width` attribute (#382)
12
+ * use pygments.rb 2.0.0 in CI
13
+ * add support for `:back-cover-image:` document attribute (#396)
14
+ * reenable Kindlegen support (#363)
15
+ * drop support for Ruby 2.3
16
+
8
17
  == 1.5.0.alpha.19 (2020-10-21) - @slonopotamus
9
18
 
10
19
  * add title and id support for literal blocks (#357)
data/Gemfile CHANGED
@@ -13,5 +13,7 @@ end
13
13
 
14
14
  group :optional do
15
15
  # epubcheck-ruby might be safe to be converted into runtime dependency, but could have issues when packaged into asciidoctorj-epub3
16
- gem 'epubcheck-ruby', '~> 4.2.4.0'
16
+ gem 'epubcheck-ruby', '~> 4.2.5.0'
17
+ # Kindlegen is unavailable neither for 64-bit MacOS nor for ARM
18
+ gem 'kindlegen', '~> 3.1.0' unless RbConfig::CONFIG['host_os'] =~ /darwin/
17
19
  end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2020 OpenDevise Inc. and the Asciidoctor Project
3
+ Copyright (c) 2014-2021 OpenDevise Inc. and the Asciidoctor Project
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
18
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
19
  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
20
  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21
- OR OTHER DEALINGS IN THE SOFTWARE.
21
+ OR OTHER DEALINGS IN THE SOFTWARE.
data/NOTICE.adoc CHANGED
@@ -36,7 +36,7 @@ Noto Serif font::
36
36
 
37
37
  - https://code.google.com/p/noto/
38
38
 
39
- Font Awesome icon font (v5.12.0)::
39
+ Font Awesome icon font (v5.15.1)::
40
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
41
  Font Awesome is fully open source and GPL compatible.
42
42
  The font is licensed under the SIL Open Font 1.1 License (OFL).
data/README.adoc CHANGED
@@ -1,801 +1,69 @@
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
- v1.5.0.alpha.19, 2020-10-21
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:
3
+ v1.5.0, 2021-04-29
4
+ v1.5.0, 2021-04-29
26
5
  :project-name: Asciidoctor EPUB3
27
6
  :project-handle: asciidoctor-epub3
28
- // URIs:
29
7
  :uri-project: https://github.com/asciidoctor/{project-handle}
30
8
  :uri-gem: https://rubygems.org/gems/asciidoctor-epub3
31
- :uri-repo: {uri-project}
32
- :uri-issues: {uri-repo}/issues
33
- :uri-ci: {uri-repo}/actions?query=branch%3Amaster
34
- :uri-discuss: https://discuss.asciidoctor.org/
9
+ :uri-ci: {uri-project}/actions?query=branch%3Amaster
10
+ :uri-issues: {uri-project}/issues
35
11
  :uri-rvm: https://rvm.io
36
- :uri-asciidoctor: https://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/w3c/epubcheck
40
- :uri-kindlegen: https://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: https://www.dublincore.org/specifications/dublin-core/dces/2004-12-20/
45
- :uri-github-guides: https://guides.github.com
46
- :uri-github-guides-fork: https://github.com/opendevise/github-guides-asciidoc
47
- :uri-asciidoctor-i18n: https://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: https://developer.android.com/sdk/index.html
50
-
51
- ifdef::status[]
12
+
13
+ image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg[project chat,link=https://asciidoctor.zulipchat.com/]
52
14
  image:https://img.shields.io/gem/v/asciidoctor-epub3.svg[Latest Release,link={uri-gem}]
53
- image:{uri-repo}/workflows/CI/badge.svg?branch=master[GitHub Actions,link={uri-ci}]
54
- endif::[]
15
+ image:{uri-project}/workflows/CI/badge.svg?branch=master[GitHub Actions,link={uri-ci}]
55
16
 
56
17
  {project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI e-book formats.
57
18
 
58
- == Introduction
59
-
60
- {project-name} is not merely a converter from AsciiDoc to EPUB3 and KF8/MOBI.
61
- Rather, it's a tool for creating highly aesthetic, professional, _easy-to-read_ e-books.
62
- Let's face it, many of the technical e-books out there--especially those produced from software documentation--are *_hideous_*.
63
- {project-name} is on a mission to disrupt the status quo.
64
-
65
- ifdef::env-github[]
66
- .An excerpt from an e-book produced by {project-name} shown in Day, Night and Sepia mode.
67
- image::screenshots/text.png[]
68
- endif::[]
69
-
70
- === Project Mission
71
-
72
- The {project-name} project aims to produce EPUB3 documents that meet the following objectives:
73
-
74
- [itemized,subject-stop=.]
75
- Fully Semantic::
76
- Produce deeply semantic XHTML5 documents, including use of the recommended `epub:type` attribute.
77
- Exceptional Readability::
78
- Readers should be drawn into the text so that they read and absorb it.
79
- Maximize the readability of the text using carefully crafted styles that are focused on:
80
- - Custom, readable fonts with strong UTF-8 character support
81
- - Sufficient line spacing and margins
82
- - Modular font size scale
83
- - Subtle, pleasing colors with good contrast
84
- - A responsive design that scales well from small to large screens
85
- - Widowed and orphaned content avoided where possible
86
- Complete and Accurate Metadata::
87
- Fully populate the EPUB3 package metadata using information in the AsciiDoc source document.
88
- Consistent Rendering::
89
- Render consistently across a broad range of EPUB3 (and select EPUB2+) e-readers and respond to any size screen.
90
- Polish, Polish, and More Polish::
91
- Add polish to the final product such as font-based icons and callout numbers.
92
-
93
- We believe that the e-books produced by {project-name} are the _very best_ output you can expect to find in digital publishing today.
94
- Of course, there's always room for improvement, so we'll continue to work with you to achieve and maintain this goal.
95
-
96
- === Notable Features
97
-
98
- * Direct AsciiDoc to EPUB3 conversion
99
- * Direct AsciiDoc to KF8/MOBI conversion
100
- * Highly-aesthetic and readable styles with optimized text legibility
101
- * Respects font settings (if supported by the e-reader) without altering headings, code or icons
102
- * EPUB3 metadata, manifest and spine (assembled by Gepub)
103
- * Document metadata (title, authors, subject, keywords, etc.)
104
- * Internal cross reference links
105
- * Syntax highlighting with Rouge, CodeRay or Pygments
106
- * Unicode callout numbers
107
- * Page breaks avoided in block content (so much as it's supported by the e-reader)
108
- * Orphan section titles avoided (so much as it's supported by the e-reader)
109
- * Table border settings honored
110
- * Support for SVG images in the content
111
- * Stem blocks via AsciiMath
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 link: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
- Like other converters, Asciidoctor EPUB3 handles this chunking task by automatically slicing up the XHTML output at predetermined heading levels.
141
-
142
- When `doctype` attribute is set to `book`, each top-level section will become a separate ebook "chapter" file.
143
- This includes preface, bibliography, appendix, etc.
144
- This behavior can be configured via `epub-chapter-level` document attribute.
145
-
146
- Otherwise, whole document is converted to a single ebook chapter.
147
-
148
- You may specify custom chapter filenames by assigning IDs to sections:
149
-
150
- [source,asciidoc]
151
- -----
152
- [#custom-chapter-id]
153
- = Chapter
154
- -----
155
-
156
- Here's an example showing the structure of a book:
157
-
158
- [source,asciidoc]
159
- ----
160
- = Book Title
161
- Author Name
162
- :doctype: book
163
- :imagesdir: images
164
- //...and so on
165
-
166
- == Chapter One
167
-
168
- Some interesting text here.
169
-
170
- == Chapter Two
171
-
172
- Even more exciting stuff.
173
- ----
174
-
175
- In older Asciidoctor EPUB3 versions, there were strict rules on document organization: 'spine' master document with chapter includes.
176
- This is no longer the case. If you followed old rules, chances are your document will work with newer Asciidoctor EPUB3 either as-is or after minor adjustments.
177
-
178
- == Prerequisites
179
-
180
- 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.6), which we'll explain how to install in the next section.
181
-
182
- To check if you have Ruby available, use the `ruby` command to query the installed version:
183
-
184
- $ ruby --version
19
+ == Documentation
185
20
 
186
- == Getting Started
21
+ Detailed installation and usage instructions can be found on the https://docs.asciidoctor.org/asciidoctor-epub3/latest/[Asciidoctor Docs site].
187
22
 
188
- You can get {project-name} by <<Install the Published Gem,installing the published gem>>.
189
- ifndef::env-site[You can also <<Development,run the code from source>> if you want to use the development version or participate in development.]
23
+ == Installation
190
24
 
191
- === Install the Published Gem
192
-
193
- {project-name} is published as a pre-release on RubyGems.org.
25
+ {project-name} is published on RubyGems.org.
26
+ {project-name} requires Ruby 2.3 or newer.
194
27
  You can install the published gem using the following command:
195
28
 
196
- $ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install asciidoctor-epub3 --pre
197
-
198
- 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.
199
- This speeds up the installation of Nokogiri considerably.
200
-
201
- If you want to syntax highlight source listings, you'll also want to install Rouge, CodeRay or Pygments.
202
- Choose one (or more) of the following:
203
-
204
- .Rouge
205
- $ gem install rouge
206
-
207
- .CodeRay
208
- $ gem install coderay
209
-
210
- .Pygments
211
- $ gem install pygments.rb
212
-
213
- You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (Rouge shown):
214
-
215
- [source,asciidoc]
29
+ [source,shell script]
216
30
  ----
217
- :source-highlighter: rouge
31
+ $ gem install asciidoctor-epub3
218
32
  ----
219
33
 
220
- NOTE: If a style is not specified, the black and white theme (i.e., bw) is used.
221
- This default is used so that the syntax highlighting is legible regardless of which reading mode the reader selects (white, black, sepia, etc).
222
- To override this default, you must set `<highlighter>-style` document header attribute to a valid highlighter style name (e.g., `:rouge-style: pastie`).
223
-
224
- Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
225
-
226
- $ asciidoctor-epub3 -v
227
-
228
- If you see the version of {project-name} printed, you're ready to use {project-name}.
229
- Let's get an AsciiDoc document ready to convert to EPUB3.
230
-
231
- === EPUB-related AsciiDoc Attributes
232
-
233
- The metadata in the generated EPUB3 file is populated from attributes in the AsciiDoc document.
234
- The names of the attributes and the metadata elements to which they map are documented in this section.
235
-
236
- 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_).
237
- The `dc` namespace prefix is in reference to the {uri-dc}[Dublin Core Metadata Element Set].
238
-
239
- .AsciiDoc attributes that control the EPUB3 metadata (i.e., package.opf)
240
- [cols="1m,3"]
241
- |===
242
- |Name |Description
243
-
244
- |uuid
245
- |Populates the *required* unique identifier (`<dc:identifier>`) in the package metadata.
246
- An id will be generated automatically from the doctitle if not specified.
247
- The recommended practice is to identify the document by means of a string or number conforming to a formal identification system.
248
-
249
- |lang
250
- |Populates the content language / locale (`<dc:language>`) in the package metadata.
251
-
252
- |scripts
253
- |Controls the font subsets that are selected based on the specified scripts (e.g., alphabets).
254
- (values: *latin*, latin-ext, latin-cyrillic or multilingual)
255
-
256
- |revdate
257
- |Populates the publication date (`<dc:date>`) in the package metadata.
258
- The date should be specified in a parsable format, such as `2014-01-01`.
259
-
260
- |doctitle
261
- |Populates the title (`<dc:title>`) in the package metadata.
262
- The title is added to the metadata in plain text format.
263
-
264
- |author
265
- |Populates the contributors (`<dc:contributor>`) in the package metadata.
266
- The authors in each chapter document are aggregated together with the authors in the master file.
267
-
268
- |username
269
- |Used to resolve an avatar for the author that is displayed in the header of a chapter when the `doctype` is set to a value other than `book`.
270
- The avatar image should be located at the path _\{imagesdir}/avatars/\{username}.jpg_, where `\{username}` is the value of this attribute.
34
+ Assuming the gem and its dependencies install properly, verify you can run the `{project-handle}` script:
271
35
 
272
- |producer
273
- |Populates the publisher (`<dc:publisher>`) in the package metadata.
274
-
275
- |creator
276
- |Populates the creator (`<dc:creator>`) in the package metadata.
277
- *If the creator is not specified, Asciidoctor is set as the creator with the role "mfr" (an abbreviation for manufacturer).*
278
-
279
- |description
280
- |Populates the description (`<dc:description>`) in the package metadata.
281
-
282
- |keywords
283
- |Populates the subjects (i.e., `<dc:subject>`) in the package metadata.
284
- The keywords should be represented as comma-separated values (CSV).
285
-
286
- |front-cover-image
287
- |Populates the front cover image and the image on the cover page (EPUB3 only) in the package metadata.
288
- The image is also added to the e-book archive.
289
- The value may be specified as a path or inline image macro.
290
- Using the inline image macro is preferred as it allows the height and width to be specified.
291
-
292
- |copyright
293
- |Populates the rights statement (`<dc:rights>`) in the package metadata.
294
-
295
- |source
296
- |Populates the source reference (`<dc:source>`) in the package metadata.
297
- The recommended practice is to identify the referenced resource by means of a string or number conforming to a formal identification system.
298
-
299
- |epub-properties
300
- |An optional override of the properties attribute for this document's item in the manifest.
301
- _Only applies to a chapter document._
302
-
303
- |epub-chapter-level
304
- |Specify the section level at which to split the EPUB into separate "chapter" files.
305
- This attribute only affects documents with `:doctype: book`.
306
- The default is to split into chapters at level-1 sections.
307
- This attribute only affects the internal composition of the EPUB, not the way chapters and sections are displayed to users.
308
- Some readers may be slow if the chapter files are too large, so for large documents with few level-1 headings, one might want to use a chapter level of 2 or 3.
309
-
310
- |series-name, series-volume, series-id
311
- |Populates the series statements (`belongs-to-collection`) in the package metadata.
312
- Volume is a number, ID probably a UUID that is constant for all volumes in the series.
313
-
314
- |epub3-frontmatterdir
315
- |The path to a directory that contains frontmatter files. The file names must match `front-matter*.html` and will be included in alphabetic order. The files are expected to be valid EPUB HTML files. _If only one front matter page is
316
- required, the default 'front-matter.html' file can be used instead._
317
-
318
- |epub3-stylesdir
319
- |The path to a directory that contains alternate epub3.css and epub3-css3-only.css files to customize the look and feel.
320
-
321
- |doctype
322
- |Used to control the inclusion of special content in the generated HTML.
323
- 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.
324
- Suggested values include: book (default), article.
325
-
326
- |toc
327
- |Adds table of contents at the beginning of the book. Depth is controlled by `:toclevels:` attribute.
328
-
329
- |outlinelevels
330
- |Sets the depth of table of contents metadata. If not set, defaults to `:toclevels:`
331
- |===
332
-
333
- 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`.
334
- You can use these attributes in a preprocessor directive if you only want to show certain content to readers using a particular device.
335
- For instance, if you want to display a message to readers on Kindle, you can use:
336
-
337
- [source,asciidoc]
36
+ [source,shell script]
338
37
  ----
339
- \ifdef::ebook-format-kf8[Hello Kindle reader!]
38
+ $ asciidoctor-epub3 -v
340
39
  ----
341
40
 
342
- With that out of the way, it's time to convert the AsciiDoc document directly to EPUB3.
343
-
344
- == Performing the Conversion
345
-
346
- You can convert AsciiDoc documents to EPUB3 and KF8/MOBI from the commandline using the `asciidoctor-epub3` script provided with the {project-name} project.
41
+ If you see the version of {project-name} printed, you're ready to use {project-name}.
347
42
 
348
- === Convert AsciiDoc to EPUB3
43
+ == Usage
349
44
 
350
- Converting an AsciiDoc document to EPUB3 is as simple as passing your document to the `asciidoctor-epub3` command.
351
- This command should be available on your PATH if you installed the `asciidoctor-epub3` gem.
45
+ Converting an AsciiDoc document to EPUB3 is as simple as passing your document to the `{project-handle}` command.
46
+ This command should be available on your PATH if you installed the `{project-handle}` gem.
352
47
  Otherwise, you can find the command in the [path]_bin_ folder of the project.
353
48
  We also recommend specifying an output directory using the `-D` option flag.
354
49
 
355
- $ asciidoctor-epub3 -D output data/samples/sample-book.adoc
356
-
357
- When the script completes, you'll see the file [file]_sample-book.epub_ appear in the [path]_output_ directory.
358
- Open that file with an EPUB reader (aka e-reader) to view the result.
359
-
360
- Below are several screenshots of this sample book as it appears on an Android phone.
361
-
362
- .An example of a chapter title and abstract shown side-by-side in Day and Night mode
363
- image::screenshots/chapter-title.png[]
364
-
365
- .An example of a section title followed by paragraph text separated by a literal block
366
- image::screenshots/section-title-paragraph.png[]
367
-
368
- .An example of a figure and an admonition
369
- image::screenshots/figure-admonition.png[]
370
-
371
- .An example of a sidebar
372
- image::screenshots/sidebar.png[]
373
-
374
- .An example of a table
375
- image::screenshots/table.png[]
376
-
377
- NOTE: The `asciidoctor-epub3` command is a temporary solution for invoking the {project-name} converter.
378
- We plan to remove this script once we have completed proper integration with the `asciidoctor` command.
379
-
380
- 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].
381
-
382
- === Validate the EPUB3 Archive
383
-
384
- Next, let's validate the EPUB3 archive to ensure it built correctly.
385
-
386
- .EPUB3 with validation
387
- $ asciidoctor-epub3 -D output -a ebook-validate data/samples/sample-book.adoc
388
-
389
- .Validation success
390
- [.output]
391
- ....
392
- Validating using EPUB version 3.0.1 rules.
393
- No errors or warnings detected.
394
- Messages: 0 fatal / 0 errors / 0 warnings / 0 info
395
- EPUBCheck completed
396
- ....
397
-
398
- If the EPUB3 archive contains any errors, they will be output in your terminal.
399
-
400
- .EPUB Standard & Validator
401
- ****
402
- The electronic publication (EPUB) standard is developed by the {uri-idpf}[International Digital Publishing Forum (IDPF)].
403
- {uri-epub}[EPUB 3.1], released in January 2017, is the latest version of this standard.
404
-
405
- An EPUB3 archive contains:
406
-
407
- * a package document (metadata, file manifest, spine)
408
- * a navigation document (table of contents)
409
- * one or more content documents
410
- * assets (images, fonts, stylesheets, etc.)
411
-
412
- The IDPF also supports {uri-epubcheck}[EPUBCheck].
413
- EPUBCheck parses and validates the file against the EPUB schema.
414
- ****
415
-
416
- 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.
417
- The EPUB3 file will be extracted to a directory adjacent to the generated file, but without the file extension.
418
-
419
- $ asciidoctor-epub3 -D output -a ebook-extract data/samples/sample-book.adoc
420
-
421
- In this example, the contents of the EPUB3 will be extracted to the [path]_output/sample-book_ directory.
422
-
423
- === Convert AsciiDoc to KF8/MOBI
424
-
425
- Creating a KF8/MOBI archive directly from an AsciiDoc document is done with the same generation script (`asciidoctor-epub3`).
426
- You just need to specify the format (`-a ebook-format`) as `kf8`.
427
-
428
- $ asciidoctor-epub3 -D output -a ebook-format=kf8 data/samples/sample-book.adoc
429
-
430
- 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.
431
-
432
- KindleGen does mandatory validation so you don't need to run the `validate` command after converting to KF8/MOBI.
433
-
434
- .What is KF8?
435
- ****
436
- 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.
437
- The format is close enough to EPUB3 that it's safe to think of it simply as an EPUB3 implementation under most circumstances.
438
- You can read more about the format on the {uri-kf8}[Kindle Format 8 page].
439
-
440
- 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.
441
- That's why we refer to the format in this project as KF8/MOBI.
442
- ****
443
-
444
- === Tuning Listing Captions
445
-
446
- 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.
447
- This behavior is triggered because the `listing-caption` attribute is set by default.
448
-
449
- 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.
450
-
451
- $ asciidoctor-epub3 -a listing-caption! book.adoc
452
-
453
- Now the behavior will match that of the built-in converters.
454
- For more information about this attribute and other related attributes, see {uri-asciidoctor-i18n}[internationalization and numbering].
455
-
456
- === Command Arguments
457
-
458
- *-h, --help* ::
459
- Show the usage message
460
-
461
- *-D, --destination-dir* ::
462
- Writes files to specified directory (defaults to the current directory)
463
-
464
- *-a ebook-epubcheck-path=<path>*::
465
- Specifies path to EPUBCheck executable to use with `-a ebook-validate`.
466
- This attribute takes precedence over `EPUBCHECK` environment variable.
467
-
468
- *-a ebook-extract* ::
469
- Extracts the EPUB3 to a folder in the destination directory after the file is generated
470
-
471
- *-a ebook-format=<format>* ::
472
- Specifies the ebook format to generate (epub3 or kf8, default: epub3)
473
-
474
- *-a ebook-kindlegen-path=<path>*::
475
- Specifies path to KindleGen executable to use when producing KF8/Mobi.
476
- This attribute takes precedence over `KINDLEGEN` environment variable.
477
-
478
- *-a ebook-validate* ::
479
- Runs {uri-epubcheck}[EPUBCheck] to validate output file against the EPUB3 specification
480
-
481
- *-a ebook-compress=<0|1|2|none|standard|huffdic>* ::
482
- Controls the compression type used by kindlegen (0=none [default if unset], 1=standard [default if empty], 2=huffdic)
483
-
484
- *-v, --version* ::
485
- Display the program version
486
-
487
- === Environment variables
488
-
489
- *EPUBCHECK*::
490
- Specifies path to EPUBCheck executable to use with `-a ebook-validate`.
491
- Effect of this variable can be overriden with `-a ebook-epubcheck-path` attribute.
492
-
493
- *KINDLEGEN*::
494
- Specifies path to KindleGen executable to use when producing KF8/Mobi.
495
- Effect of this variable can be overriden with `-a ebook-kindlegen-path` attribute.
496
-
497
- === EPUB3 Archive Structure
498
-
499
- Here's a sample manifest of files found in an EPUB3 document produced by {project-name}.
500
-
501
- ....
502
- META-INF/
503
- container.xml
504
- EPUB/
505
- fonts/
506
- awesome/
507
- fa-solid-900.ttf
508
- font-icons.ttf
509
- mplus-1mn-latin-bold.ttf
510
- mplus-1mn-latin-light.ttf
511
- mplus-1mn-latin-medium.ttf
512
- mplus-1mn-latin-regular.ttf
513
- mplus-1p-latin-bold.ttf
514
- mplus-1p-latin-light.ttf
515
- mplus-1p-latin-regular.ttf
516
- noto-serif-bold-italic.ttf
517
- noto-serif-bold.ttf
518
- noto-serif-italic.ttf
519
- noto-serif-regular.ttf
520
- images/
521
- avatars/
522
- default.png
523
- figure-01.png
524
- figure-02.png
525
- styles/
526
- epub3-css3-only.css
527
- epub3.css
528
- chapter-01.xhtml
529
- chapter-02.xhtml
530
- ...
531
- cover.xhtml
532
- nav.xhtml
533
- package.opf
534
- toc.ncx
535
- mimetype
536
- ....
537
-
538
- == Working with Images
539
-
540
- Images referenced in your AsciiDoc document must be stored in the images catalog.
541
- The images catalog is defined by the `imagesdir` attribute.
542
- If set, the value of this attribute is resolved relative to the document and must be at or below (i.e., within) the directory of that document.
543
- (In other words, it cannot point to a location outside the document directory).
544
- If this attribute is not set, the images catalog defaults to the directory of the document.
545
- {project-name} will discover all local image references and insert those images into the EPUB3 archive at the same relative path.
546
-
547
- === Default Images
548
-
549
- The sample book contains placeholder image for an author avatar.
550
-
551
- // TODO explain the avatar and book cover images
552
-
553
- === Adding the Cover Image
554
-
555
- Ereaders have different image resolution and file size limits regarding a book's cover.
556
- Kindle covers tend to be 1050x1600 (16:9 resolution).
557
- To ensure your cover displays correctly, you'll want to review the documentation or publisher guidelines for the e-reading platform you're targeting.
558
-
559
- 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.
560
-
561
- Feel free to use the SVG of the sample cover in the [path]_data/images_ folder as a template for creating your own cover.
562
- 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.
563
-
564
- [source,asciidoc]
50
+ [source,shell script]
565
51
  ----
566
- :front-cover-image: image:cover.png[Front Cover,1050,1600]
52
+ $ asciidoctor-epub3 -D output path/to/book.adoc
567
53
  ----
568
54
 
569
- The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the directory of the3 document.
570
- The image can be in any format, though we recommend using PNG, JPG, or SVG as they are the most portable formats.
571
-
572
- IMPORTANT: *You should always specify the dimensions of the cover image.*
573
- This ensures the viewer will preserve the aspect ratio if it needs to be scaled to fit the screen.
574
- If you don't specify a width and height, then the dimensions are assumed to be 1050x1600.
55
+ When the script completes, you'll see the file [file]_book.epub_ appear in the [path]_output_ directory.
56
+ Open that file with an EPUB3 reader to view the result.
575
57
 
576
- === How to Organize Images by Chapter
58
+ You may also produce KF8/MOBI file by setting `ebook-format` attribute to `kf8`.
577
59
 
578
- You can set the `imagesdir` attribute per chapter (as long as the attribute is not overridden by the API).
579
- 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.
580
-
581
- [source,asciidoc]
60
+ [source,shell script]
582
61
  ----
583
- :imagesdir: chapter-one/images
584
- \include::chapter-one.adoc[]
585
-
586
- :imagesdir: chapter-two/images
587
- \include::chapter-two.adoc[]
62
+ $ asciidoctor-epub3 -D output -a ebook-format=kf8 path/to/book.adoc
588
63
  ----
589
64
 
590
- == About the Theme
591
-
592
- EPUB3 and KF8/MOBI files are styled using CSS3.
593
- 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.
594
- All we've got to say is _thank goodness for CSS hacks, media queries and years of CSS experience!_
595
-
596
- 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.
597
- 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.
598
-
599
- The theme's CSS files are located in the [path]_data/style_ directory.
600
-
601
- IMPORTANT: {project-name} only provides one theme, and, at this time, you can not replace it with a custom theme using the `stylesheet` attribute.
602
- 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.
603
-
604
- === Fonts
605
-
606
- {project-name} embeds a set of fonts and font icons.
607
- The theme's fonts are located in the [path]_data/fonts_ directory.
608
-
609
- The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
610
- The body text uses Noto Serif.
611
- Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
612
- Refer to the link:NOTICE.adoc[] file for further information about the fonts.
613
-
614
- // TODO document command to generate the M+ 1p latin fonts
615
-
616
- === Device-specific Styles
617
-
618
- 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.
619
- This enhancement allows you to use styles targeted specifically at that reader.
620
-
621
- 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.
622
-
623
- ,===
624
- Reader,HTML Element,CSS Class Name
625
-
626
- Gitden,body,gitden-reader
627
- Namo PubTreeViewer,body,namo-epub-library
628
- Readium,body,readium-js-viewer
629
- iBooks,body,ibooks
630
- Adobe RMSDK >= 11,body,rmsdk
631
- Google Books,div,gb-reader-container
632
- ,===
633
-
634
- NOTE: Kobo does not support the epubReadingSystem JavaScript object, despite the fact that it does support JavaScript.
65
+ When the script completes, the file [file]_book.mobi_ will appear in [path]_output_ directory.
635
66
 
636
- == Pushing to Android
637
-
638
- 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.
639
- 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.
640
-
641
- You transfer files from your computer to an Android phone over a USB connection using a command from the Android SDK Tools called `adb`.
642
- Follow these steps to get it setup:
643
-
644
- . Download the Android SDK Tools zip from the table labeled *SDK Tools Only* on the {uri-android-sdk}[Get the Android SDK] page
645
- . Extract the archive
646
- . Locate the path to the `adb` command (Hint: Look in the platform-tools folder)
647
- . Set the environment variable named ADB to the path of the `adb` command
648
-
649
- $ export ADB=~/apps/android-sdk/platform-tools/adb
650
-
651
- 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.
652
-
653
- .Publish both EPUB3 and KF8 files to Android device
654
- $ adb-push-ebook output/sample-book
655
-
656
- IMPORTANT: Don't include the file extension since the script will check for both the .epub and .mobi files.
657
-
658
- The `adb-push-ebook` script copies the files to the following locations on the device:
659
-
660
- ,===
661
- File type,Destination on Android device
662
-
663
- *.epub,/sdcard/
664
- *.mobi,/sdcard/Android/data/com.amazon.kindle/files/
665
- ,===
666
-
667
- Amazon Kindle should immediately detect the new file and display it in your “On Device” library.
668
- You'll have to manually import the EPUB3 into your e-reader of choice.
669
-
670
- == E-book Reader Recommendations and Quirks
671
-
672
- EPUB3 e-readers will provide the best reading experience when viewing the book generated by {project-name}.
673
- Here's a list of some of the e-readers we know to have good EPUB3 support and the systems on which they run:
674
-
675
- * http://www.amazon.com/gp/feature.html?docId=1000493771[Amazon Kindle] (most platforms)
676
- * http://gitden.com/gitdenreader[Gitden] (Android and iOS)
677
- * http://www.apple.com/ibooks[iBooks] (iOS, OSX)
678
- * https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl?hl=en-US[Readium] (Chrome)
679
- * http://www.kobo.com/apps[Kobo] (Android, iOS, OSX and Windows)
680
- * http://www.namo.com/site/namo/menu/5074.do[Namo PubTreeViewer] (Android, iOS and Windows)
681
- * http://calibre-ebook.com[Calibre (ebook-viewer)] (Linux, OSX, Windows)
682
-
683
- IMPORTANT: To get the full experience, *ensure that the e-reader is configured to use the publisher's styles*.
684
- Different e-readers word this setting in different ways.
685
- Look for the option screen that allows you to set the fonts and font colors and disable it.
686
- 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.
687
-
688
- 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.
689
- EPUB2 e-readers, such as Aldiko, don't understand CSS3 styles and therefore miss out on some of subtleties in the formatting.
690
-
691
- 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.
692
- Most of these obstacles were addressed using media queries or explicit classes.
693
- Some we haven't conquered.
694
- Yet.
695
-
696
- The <<kindle-quirks,Kindle quirks list>> shows you just a few of the constraints we encountered.
697
- 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.
698
-
699
- // 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)
700
-
701
- [#kindle-quirks]
702
- .Kindle Quirks
703
- * overrules margins and line heights like a medieval tyrant
704
- * `font-family` can't be set on `<body>`
705
- * requires `!important` on text-decoration
706
- * `position: relative` isn't permitted
707
- * strips (or unwraps) `<header>` tags
708
- * `@page` isn't supported
709
- * `page-break: avoid` isn't supported
710
- * `page-break-*` cannot be applied using a compound or nested CSS selector; must be a simple ID or class
711
- * `max-width` isn't supported
712
- * `widows` are left in the cold
713
- * won't style footers without an explicit class
714
- * `-webkit-hyphens: auto` causes Kindle for Mac (and perhaps others) to crash
715
- * `text-rendering: optimizeLegibility` causes file to be rejected by KFP (and causes the text to disappear in some previewers)
716
- * 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
717
-
718
- === Kindle Direct Publishing
719
-
720
- 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].
721
- No other method of publishing to the Amazon Kindle store will leave your book intact.
722
-
723
- This workflow also allows you to preview the book the way your readers will see it.
724
- So it's a good way to acceptance test your custom styles to discover which ones are honored and which ones are ignored.
725
-
726
- ==== Look Inside
727
-
728
- The Amazon Kindle store offers a “Look Inside” feature for reader.
729
- This so-called feature aims to gives readers a glimpse at the contents of the book.
730
- Sadly, it does no such thing.
731
- Instead, it shows pages from the legacy MOBI document that kindlegen adds to your e-book file, not the higher fidelity KF8 document.
732
- This means the preview won't look at all like what the Kindle reader or application will actually show.
733
- Custom fonts, font-based icons, and most styles will be missing.
734
-
735
- This situation is unfortunate for authors.
736
- What we recommend is to complain loudly to Amazon that they are hurting your sales by displaying a crippled version of your product.
737
- Tell them that under no circumstances should they show an altered version of your product.
738
- Another option is to contact Amazon to opt-out of this program.
739
-
740
- === Send to Kindle
741
-
742
- WARNING: Don't use it!
743
-
744
- {uri-send-to-kindle}[Send to Kindle] is a tempting choice for transferring MOBI files to a Kindle device.
745
- However, it's utterly broken.
746
- 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.
747
- It's known to strip out all the font files and break the encoding of the document.
748
-
749
- We *strongly* recommend you transfer the file to your device using either a USB cable or a sync service such as Dropbox.
750
- Once transferred, Whispersync will detect the new file (usually looking in the Books folder) and add it to the “On Device” library.
751
-
752
- It's important to note that “Send to Kindle” is not reflective of the experience readers will have when shopping in the Kindle store.
753
- 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).
754
-
755
- ////
756
- head-stop (default '.')
757
- stack-head role (run-in is default)
758
- signature role (sets hardbreaks option)
759
-
760
- subject-stop (default ':')
761
- ////
762
-
763
- ////
764
- == Device and Application Testing
765
-
766
- {project-name} has been tested on the following devices and applications.
767
-
768
- .Computers
769
- |===
770
- |Device |OS |Resolution |ppi |Browsers |Readium |Gitden |Kindle
771
-
772
- |Asus
773
- |Fedora 17
774
- |no x no
775
- |
776
- |Chrome x
777
- |Readium
778
-
779
- Asus, Fedora 20, display resolution, Chrome x, Readium
780
- Ideapad Y460 |Fedora 20 |1366 x 768 (16:9) |
781
- PC, Windows X,
782
- |===
783
-
784
- .Tablets
785
- |===
786
- Asus Transformer, Android x, display resolution, Aldiko, Kindle, Readium, Readmill
787
- Nexus,
788
- |===
789
-
790
- .Phones
791
- |===
792
- HTC Sensation, Android x, display resolution, xxxx
793
- Nexus ,
794
- |===
795
-
796
- ////
797
-
798
- ifndef::env-site[]
799
67
  == Contributing
800
68
 
801
69
  In the spirit of free software, _everyone_ is encouraged to help improve this project.
@@ -821,12 +89,12 @@ You can retrieve {project-name} in one of two ways:
821
89
  If you want to clone the git repository, simply copy the {uri-repo}[GitHub repository URL] and pass it to the `git clone` command:
822
90
 
823
91
  [subs=attributes+]
824
- $ git clone {uri-repo}
92
+ $ git clone {uri-repo}
825
93
 
826
94
  Next, change to the project directory:
827
95
 
828
96
  [subs=attributes+]
829
- $ cd {project-handle}
97
+ $ cd {project-handle}
830
98
 
831
99
  ==== Option 2: Download the Archive
832
100
 
@@ -893,7 +161,22 @@ or
893
161
  You're now ready to test drive the development version of {project-name}!
894
162
 
895
163
  Jump back to <<Getting Started>> to learn how to create an AsciiDoc document and convert it to EPUB3.
896
- endif::[]
164
+
165
+ === Fonts
166
+
167
+ {project-name} embeds a set of fonts and font icons.
168
+ The theme's fonts are located in the [path]_data/fonts_ directory.
169
+
170
+ The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
171
+ The body text uses Noto Serif.
172
+ Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
173
+ Refer to the link:NOTICE.adoc[] file for further information about the fonts.
174
+
175
+ // TODO document command to generate the M+ 1p latin fonts
176
+
177
+ == Planned Features and Work In Progress
178
+
179
+ See link:WORKLOG.adoc[].
897
180
 
898
181
  == Authors
899
182
 
@@ -901,19 +184,8 @@ endif::[]
901
184
 
902
185
  == Copyright
903
186
 
904
- Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project.
187
+ Copyright (C) 2014-2021 OpenDevise Inc. and the Asciidoctor Project.
905
188
  Free use of this software is granted under the terms of the MIT License.
906
189
 
907
190
  For the full text of the license, see the link:LICENSE[] file.
908
191
  Refer to the link:NOTICE.adoc[] file for information about third-party Open Source software in use.
909
-
910
- ////
911
- == Additional Points of Note
912
-
913
- * uppercase chapter titles to work around line-height limitation in Kindle (1.4 minimum)
914
- * using vw units crashes Aldiko
915
- * circled numbers from M+ 1mn for annotation numbers in listing blocks
916
- * avatars for authors
917
- * document command to generate the M+ 1p latin fonts
918
- * recommended e-readers (Readium, Gitden, Kindle, etc)
919
- ////