asciidoctor-epub3 1.5.0.alpha.13 → 1.5.0.alpha.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +63 -0
- data/Gemfile +6 -7
- data/LICENSE +21 -0
- data/NOTICE.adoc +3 -3
- data/README.adoc +80 -162
- data/asciidoctor-epub3.gemspec +10 -4
- data/data/fonts/awesome/LICENSE.txt +34 -0
- data/data/fonts/awesome/fa-solid-900.ttf +0 -0
- data/data/fonts/awesome/icons.yml +20935 -0
- data/data/fonts/awesome/shims.yml +298 -0
- data/data/styles/color-palette.css +7 -10
- data/data/styles/epub3-css3-only.css +1 -56
- data/data/styles/epub3-fonts.css +1 -1
- data/data/styles/epub3.css +93 -74
- data/lib/asciidoctor-epub3.rb +0 -1
- data/lib/asciidoctor-epub3/converter.rb +1163 -271
- data/lib/asciidoctor-epub3/ext/asciidoctor.rb +1 -0
- data/lib/asciidoctor-epub3/ext/asciidoctor/document.rb +19 -0
- data/lib/asciidoctor-epub3/font_icon_map.rb +22 -371
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +104 -13
- data/.yardopts +0 -12
- data/LICENSE.adoc +0 -25
- data/data/fonts/fontawesome-icons.ttf +0 -0
- data/lib/asciidoctor-epub3/packager.rb +0 -722
- data/lib/asciidoctor-epub3/spine_item_processor.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352b650ba19d840c6f0eb7cdcc1f6abe941d05316b4d92d220faf2e21b63ba87
|
4
|
+
data.tar.gz: fd2a164d0c20c9ee6415e47d9d77db71f6ba09500219778508794e6210b93130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be30f10eaa7309066230c86e3f124cda27a9668a0b1eac7ac2d68f70eddacb2ab9886dadcd96ac292845d4da28c52ffefa63ded60282cbf0d55c39fa8efbf0df
|
7
|
+
data.tar.gz: 3e1ec0eef64136a609d402a5cae8b4bb03007ea462a362f2e33df55ed0b84bdc624c61b9813cafca1a35d81401c31859fef28f487505aaaaa036944134f7ad77
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,69 @@
|
|
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.alpha.18 (2020-07-27) - @slonopotamus
|
9
|
+
|
10
|
+
* remove <b> from chapter subtitle (#123)
|
11
|
+
* improve tables support: cell content alignment, column width (#350)
|
12
|
+
* fix chapter titles to actually be chapter titles instead of document title (#343)
|
13
|
+
* store syntax highlighter CSS in a separate file (#339)
|
14
|
+
* initial landmarks support: appendix, bibliography, bodymatter, cover, frontmatter, glossary, index, preface, toc (#174)
|
15
|
+
* add support for in-document table of contents via `:toc:` document attribute (#174)
|
16
|
+
* add support for MathML (#10)
|
17
|
+
* rescale color palette to use darker shades of gray (#338)
|
18
|
+
* gracefully handle invalid `:front-cover-image:` value (#353)
|
19
|
+
|
20
|
+
== 1.5.0.alpha.17 (2020-05-25) - @slonopotamus
|
21
|
+
|
22
|
+
* support remote URLs for audio/video/image (#333, #334)
|
23
|
+
|
24
|
+
== 1.5.0.alpha.16 (2020-04-26) - @slonopotamus
|
25
|
+
|
26
|
+
* add basic audio and video support (#9)
|
27
|
+
* add support for `[horizontal]` definition list (#165)
|
28
|
+
* add proper handling of `:data-uri:` document attribute (#324)
|
29
|
+
* add support for customizable document splitting into chapters via `epub-chapter-level` attribute (#327)
|
30
|
+
* avoid outputting 'true' for unsupported blocks (#332)
|
31
|
+
|
32
|
+
== 1.5.0.alpha.15 (2020-03-11) - @slonopotamus
|
33
|
+
|
34
|
+
* support section numbering and captions (#20)
|
35
|
+
* fix `\<<anchor,link text>>` to show link text (#317)
|
36
|
+
* add xref ids to paragraphs (#317)
|
37
|
+
* support syntax highlighting with CodeRay and Rouge (#262)
|
38
|
+
* pygments.rb is no longer auto-activated
|
39
|
+
* add series metadata (#307)
|
40
|
+
* fix Sony Reader crash (#152)
|
41
|
+
|
42
|
+
== 1.5.0.alpha.14 (2020-02-29) - @slonopotamus
|
43
|
+
|
44
|
+
* support conversion of article documents to a single-chapter file
|
45
|
+
* stop requiring specific include file scheme (#47)
|
46
|
+
* support special chapters like bibliography (#205)
|
47
|
+
* `basedir` now points to main document directory when processing chapter files (#190)
|
48
|
+
* fix image and listing numbers being reset in each chapter (#178)
|
49
|
+
* fix xref resolving between sub-includes of chapter files (#166)
|
50
|
+
* add support for contentless include files (#151)
|
51
|
+
* drop nonstandard `<<chapter#>>` xref syntax and instead support vanilla `<<anchor>>` or `<<file#anchor>>` syntax (#136)
|
52
|
+
* properly include bibliography generated by asciidoctor-bibtex (#206)
|
53
|
+
* require Asciidoctor 1.5.6+
|
54
|
+
* add support for book preamble (#303)
|
55
|
+
* add basic support for multi-part books (#304)
|
56
|
+
* do not include current date if `:reproducible:` attribute is set (#203)
|
57
|
+
* respect `SOURCE_DATE_EPOCH` environment variable for reproducible builds
|
58
|
+
* fix invalid markup produced for tables with footer (#295)
|
59
|
+
* add support for image width/height attributes (#183)
|
60
|
+
* log KindleGen warnings with WARNING log level (#291)
|
61
|
+
* convert stem blocks to `<code>$stem_text</code>` (#10)
|
62
|
+
* use imagedir from an image's context during packaging (#282)
|
63
|
+
* fix images in tables not included in epub archive (#169)
|
64
|
+
* search for `front-matter.html` in document dir instead of CWD (#300)
|
65
|
+
* fix inline images not being included in epub archive (#30)
|
66
|
+
* add support for Font Awesome Solid 5.12.0 (#155)
|
67
|
+
* fix inline anchors missing their ids (#201)
|
68
|
+
* support multiple front-matter files via `epub3-frontmatterdir` attribute
|
69
|
+
* add support for multiple authors in book metadata
|
70
|
+
|
8
71
|
== 1.5.0.alpha.13 (2020-02-04) - @slonopotamus
|
9
72
|
|
10
73
|
* remove kindlegen and epubcheck-ruby from runtime dependencies (#288)
|
data/Gemfile
CHANGED
@@ -5,17 +5,16 @@ source 'https://rubygems.org'
|
|
5
5
|
# Look in asciidoctor-epub3.gemspec for runtime and development dependencies.
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
8
|
+
if ENV.key? 'ASCIIDOCTOR_VERSION'
|
9
|
+
gem 'asciidoctor', ENV['ASCIIDOCTOR_VERSION'], require: false
|
10
|
+
# Newer asciidoctor-diagram 1.5.x require asciidoctor >=1.5.7
|
11
|
+
gem 'asciidoctor-diagram', '1.5.16', require: false if Gem::Version.new(ENV['ASCIIDOCTOR_VERSION']) < Gem::Version.new('2.0.0')
|
12
|
+
end
|
9
13
|
|
10
14
|
group :optional do
|
11
15
|
# epubcheck-ruby might be safe to be converted into runtime dependency, but could have issues when packaged into asciidoctorj-epub3
|
12
|
-
gem 'epubcheck-ruby', '~> 4.2.
|
16
|
+
gem 'epubcheck-ruby', '~> 4.2.4.0'
|
13
17
|
# We would like to make kindlegen a runtime dependency, but can't because of the way asciidoctorj-epub3 packaging works
|
14
18
|
# See https://github.com/asciidoctor/asciidoctor-epub3/issues/288
|
15
19
|
gem 'kindlegen', '~> 3.0.3'
|
16
|
-
gem 'pygments.rb', '1.2.1'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :docs do
|
20
|
-
gem 'yard', require: false
|
21
20
|
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2014-2020 OpenDevise Inc. and the Asciidoctor Project
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
18
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
19
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
20
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
21
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
data/NOTICE.adoc
CHANGED
@@ -36,15 +36,15 @@ Noto Serif font::
|
|
36
36
|
|
37
37
|
- https://code.google.com/p/noto/
|
38
38
|
|
39
|
-
Font Awesome icon font (
|
39
|
+
Font Awesome icon font (v5.12.0)::
|
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).
|
43
43
|
You may obtain a copy of the license at:
|
44
44
|
|
45
|
-
|
45
|
+
https://scripts.sil.org/OFL
|
46
46
|
|
47
|
-
-
|
47
|
+
- https://fontawesome.io
|
48
48
|
|
49
49
|
normalize.css (v3.0.1)::
|
50
50
|
A customized version of normalize.css is used to provide cross-reader consistency in the default styling of HTML elements.
|
data/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
v1.5.0.alpha.18, 2020-07-27
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -27,31 +27,30 @@ endif::[]
|
|
27
27
|
:project-handle: asciidoctor-epub3
|
28
28
|
// URIs:
|
29
29
|
:uri-project: https://github.com/asciidoctor/{project-handle}
|
30
|
-
:uri-gem:
|
30
|
+
:uri-gem: https://rubygems.org/gems/asciidoctor-epub3
|
31
31
|
:uri-repo: {uri-project}
|
32
32
|
:uri-issues: {uri-repo}/issues
|
33
|
-
:uri-ci: {uri-repo}/actions?query=
|
34
|
-
:uri-discuss:
|
33
|
+
:uri-ci: {uri-repo}/actions?query=branch%3Amaster
|
34
|
+
:uri-discuss: https://discuss.asciidoctor.org/
|
35
35
|
:uri-rvm: https://rvm.io
|
36
|
-
:uri-asciidoctor:
|
36
|
+
:uri-asciidoctor: https://asciidoctor.org/
|
37
37
|
:uri-idpf: http://www.idpf.org/
|
38
38
|
:uri-epub: http://www.idpf.org/epub/31/spec/epub-spec.html
|
39
|
-
:uri-epubcheck: https://github.com/
|
40
|
-
:uri-kindlegen:
|
39
|
+
:uri-epubcheck: https://github.com/w3c/epubcheck
|
40
|
+
:uri-kindlegen: https://www.amazon.com/gp/feature.html?docId=1000765211
|
41
41
|
:uri-kf8: http://www.amazon.com/gp/feature.html?docId=1000729511
|
42
42
|
:uri-send-to-kindle: https://www.amazon.com/gp/sendtokindle/
|
43
43
|
:uri-metadata-elem: http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-metadata-elem
|
44
|
-
:uri-dc:
|
44
|
+
:uri-dc: https://www.dublincore.org/specifications/dublin-core/dces/2004-12-20/
|
45
45
|
:uri-github-guides: https://guides.github.com
|
46
46
|
:uri-github-guides-fork: https://github.com/opendevise/github-guides-asciidoc
|
47
|
-
:uri-asciidoctor-i18n:
|
47
|
+
:uri-asciidoctor-i18n: https://asciidoctor.org/docs/user-manual/#builtin-attributes-i18n
|
48
48
|
:uri-epubreadingsystem: http://www.idpf.org/epub/301/spec/epub-contentdocs.html#app-epubReadingSystem
|
49
|
-
:uri-android-sdk:
|
49
|
+
:uri-android-sdk: https://developer.android.com/sdk/index.html
|
50
50
|
|
51
51
|
ifdef::status[]
|
52
52
|
image:https://img.shields.io/gem/v/asciidoctor-epub3.svg[Latest Release,link={uri-gem}]
|
53
|
-
image:
|
54
|
-
image:{uri-repo}/workflows/CI/badge.svg[GitHub Actions,link={uri-ci}]
|
53
|
+
image:{uri-repo}/workflows/CI/badge.svg?branch=master[GitHub Actions,link={uri-ci}]
|
55
54
|
endif::[]
|
56
55
|
|
57
56
|
{project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI e-book formats.
|
@@ -103,12 +102,13 @@ Of course, there's always room for improvement, so we'll continue to work with y
|
|
103
102
|
* EPUB3 metadata, manifest and spine (assembled by Gepub)
|
104
103
|
* Document metadata (title, authors, subject, keywords, etc.)
|
105
104
|
* Internal cross reference links
|
106
|
-
* Syntax highlighting with CodeRay or Pygments
|
105
|
+
* Syntax highlighting with Rouge, CodeRay or Pygments
|
107
106
|
* Unicode callout numbers
|
108
107
|
* Page breaks avoided in block content (so much as it's supported by the e-reader)
|
109
108
|
* Orphan section titles avoided (so much as it's supported by the e-reader)
|
110
109
|
* Table border settings honored
|
111
110
|
* Support for SVG images in the content
|
111
|
+
* Stem blocks via AsciiMath
|
112
112
|
|
113
113
|
=== Project Status
|
114
114
|
|
@@ -122,7 +122,7 @@ We may explore the use of fixed layout documents in the future if the need arise
|
|
122
122
|
ifdef::env-github[]
|
123
123
|
=== Planned Features and Work In Progress
|
124
124
|
|
125
|
-
See
|
125
|
+
See link:WORKLOG.adoc[].
|
126
126
|
endif::[]
|
127
127
|
|
128
128
|
== Converter Workflow
|
@@ -137,121 +137,47 @@ The EPUB3 publication, which can be thought of as the “digital master”, is a
|
|
137
137
|
|
138
138
|
An EPUB3 archive is composed of multiple files. The content of each “chapter” is typically stored in a dedicated XHTML file.
|
139
139
|
Therefore, the {project-name} converter “chunks” the AsciiDoc source document into multiple XHTML files to add to the EPUB3 archive.
|
140
|
-
|
141
|
-
|
142
|
-
=== Composition Rules
|
143
|
-
|
144
|
-
There are several rules you must follow to successfully convert your AsciiDoc source documents into an EPUB3 publication archive.
|
145
|
-
These rules may be loosened in the future, but they are mandatory at the moment.
|
146
|
-
|
147
|
-
Rule 1::
|
148
|
-
Each chapter must begin in a dedicated file that resides at the root of the project.
|
149
|
-
It must be included into the main document using the AsciiDoc include directive.
|
150
|
-
The main document, which we call the “spine”, may only contain a document header and a sequence of include directives.
|
151
|
-
See <<Declaring the Spine>> for details.
|
152
|
-
+
|
153
|
-
TIP: The include directive may be used in the chapter files to include other files (even files in other folders).
|
154
|
-
|
155
|
-
Rule 2::
|
156
|
-
Each chapter must start with a document title (i.e., level-0 heading).
|
157
|
-
The document header must declare an ID that matches the chapter filename (minus its file extension).
|
158
|
-
|
159
|
-
Rule 3::
|
160
|
-
No sections in a chapter may have the same ID as the chapter ID.
|
161
|
-
|
162
|
-
Rule 4::
|
163
|
-
The cross reference (i.e., xref) from one chapter to another must be in the format `+xref:chapter-id#chapter-id[optional reftext]+` (or `+<<chapter-id#chapter-id,optional reftext>>+`).
|
164
|
-
If you want to reference a section in a chapter, update the fragment (i.e., the value that follows the hash) to match the target section ID.
|
165
|
-
The reftext is optional since the reftext of the target is used by default.
|
166
|
-
+
|
167
|
-
TIP: To assign reference text (i.e., reftext) for a chapter title, set the document attribute `docreftext` in the header for that chapter.
|
168
|
-
+
|
169
|
-
TIP: Rule 2 states that the chapter ID must match the basename of the chapter file.
|
170
|
-
In truth, the chapter ID can be a _derivative of_ the chapter filename.
|
171
|
-
In that case, an attribute reference can be used to prepend a prefix to an inter-document cross reference.
|
172
|
-
For example, if you want each chapter file to begin with `chapter-`, you'd write the xref as `+xref:{chapter-prefix}chapter-id#chapter-id[]+`.
|
173
|
-
You'd then assign an empty value to the `chapter-prefix` attribute when converting to an e-book and `chapter-` for all other formats.
|
174
|
-
|
175
|
-
The next section goes into more detail about how to set up the spine document and include the chapter files.
|
176
|
-
|
177
|
-
=== Declaring the Spine
|
178
|
-
|
179
|
-
The spine (or master document) must be well-formed.
|
180
|
-
Otherwise, {project-name} will not convert the document properly.
|
181
|
-
If your AsciiDoc documents are not structured as explained in this section, you'll need to change them.
|
182
|
-
|
183
|
-
Asciidoctor uses top-level include directives (i.e., include directives in the master document) to indicate where each chapter split should occur.
|
184
|
-
The chapter files should begin with an AsciiDoc document header, which consists of an ID, a document title (i.e., level-0 heading), an author name, and a set of attribute entries.
|
185
|
-
Only the document title is required.
|
186
|
-
|
187
|
-
The document title in the chapter file is used as the chapter title and the label for the chapter in the TOC.
|
188
|
-
The chapter ID, combined with the _.xhtml_ suffix, is used as the filename of the chapter inside the EPUB3 archive (though this could change in the future).
|
189
|
-
We recommend that you base the filename of the chapter on the chapter ID.
|
190
|
-
|
191
|
-
If you don't specify an ID for a chapter, one will be generated automatically from the document title.
|
192
|
-
The rules for generating a chapter ID from the document title are as follows:
|
193
|
-
|
194
|
-
* apply inline formatting, then remove XML elements
|
195
|
-
* remove the `\’` character reference (so `John\’s` becomes `Johns`)
|
196
|
-
* replace `\&` with the word `and` (so `John \& Jane` becomes `John and Jane`)
|
197
|
-
* expand all other character references
|
198
|
-
* lowercase all characters
|
199
|
-
* replace illegal ID characters with the character defined by the `idseparator` attribute
|
200
|
-
* prepend the value of the `idprefix` attribute
|
201
|
-
* prepend an underscore if the ID begins with a number
|
202
|
-
|
203
|
-
You can think of the master document as the spine of the book and the include directives the individual items being bound together.
|
204
|
-
The target of each include directive in the master document is parsed and converted as a separate AsciiDoc document, with certain options and attributes passed down from the master to ensure consistent behavior.
|
205
|
-
Each resulting XHTML document is then added to the EPUB3 archive as a chapter document and the master document becomes the navigation file (i.e, the table of contents).
|
206
|
-
|
207
|
-
Here's an example showing the structure of a spine document:
|
140
|
+
Like other converters, Asciidoctor EPUB3 handles this chunking task by automatically slicing up the XHTML output at predetermined heading levels.
|
208
141
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
Author Name
|
213
|
-
:doctype: book
|
214
|
-
:imagesdir: images
|
215
|
-
\ifndef::ebook-format[:leveloffset: 1]
|
216
|
-
//...and so on
|
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.
|
217
145
|
|
218
|
-
|
219
|
-
|
220
|
-
\include::chapter-two.adoc[]
|
146
|
+
Otherwise, whole document is converted to a single ebook chapter.
|
221
147
|
|
222
|
-
|
223
|
-
----
|
148
|
+
You may specify custom chapter filenames by assigning IDs to sections:
|
224
149
|
|
225
|
-
|
150
|
+
[source,asciidoc]
|
151
|
+
-----
|
152
|
+
[#custom-chapter-id]
|
153
|
+
= Chapter
|
154
|
+
-----
|
226
155
|
|
227
|
-
Here's an example showing the structure of a
|
156
|
+
Here's an example showing the structure of a book:
|
228
157
|
|
229
158
|
[source,asciidoc]
|
230
159
|
----
|
231
|
-
|
232
|
-
|
160
|
+
= Book Title
|
161
|
+
Author Name
|
162
|
+
:doctype: book
|
163
|
+
:imagesdir: images
|
164
|
+
//...and so on
|
233
165
|
|
234
|
-
|
235
|
-
----
|
166
|
+
== Chapter One
|
236
167
|
|
237
|
-
|
168
|
+
Some interesting text here.
|
238
169
|
|
239
|
-
|
170
|
+
== Chapter Two
|
240
171
|
|
241
|
-
|
242
|
-
----
|
243
|
-
\ifndef::ebook-format[:leveloffset: -1]
|
172
|
+
Even more exciting stuff.
|
244
173
|
----
|
245
174
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
NOTE: Eventually, we envision introducing a dedicated block macro to represent a spine item so that we don't overload the meaning of the include directive.
|
250
|
-
However, for the time being, the include directive fills this role.
|
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.
|
251
177
|
|
252
178
|
== Prerequisites
|
253
179
|
|
254
|
-
All that's needed to use {project-name} is Ruby 2.3 or newer and a few Ruby gems (including at least Asciidoctor 1.5.
|
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.
|
255
181
|
|
256
182
|
To check if you have Ruby available, use the `ruby` command to query the installed version:
|
257
183
|
|
@@ -272,26 +198,28 @@ You can install the published gem using the following command:
|
|
272
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.
|
273
199
|
This speeds up the installation of Nokogiri considerably.
|
274
200
|
|
275
|
-
If you want to syntax highlight source listings, you'll also want to install CodeRay or Pygments.
|
201
|
+
If you want to syntax highlight source listings, you'll also want to install Rouge, CodeRay or Pygments.
|
276
202
|
Choose one (or more) of the following:
|
277
203
|
|
204
|
+
.Rouge
|
205
|
+
$ gem install rouge
|
206
|
+
|
278
207
|
.CodeRay
|
279
208
|
$ gem install coderay
|
280
209
|
|
281
210
|
.Pygments
|
282
211
|
$ gem install pygments.rb
|
283
212
|
|
284
|
-
You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (
|
213
|
+
You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (Rouge shown):
|
285
214
|
|
286
215
|
[source,asciidoc]
|
287
216
|
----
|
288
|
-
:source-highlighter:
|
217
|
+
:source-highlighter: rouge
|
289
218
|
----
|
290
219
|
|
291
|
-
NOTE:
|
292
|
-
|
293
|
-
|
294
|
-
To override this default, you must pass a valid Pygments style name to the `pygments-style` attribute when invoking the `asciidoctor-epub3` script (e.g., `-a pygments-style=pastie`).
|
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`).
|
295
223
|
|
296
224
|
Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
|
297
225
|
|
@@ -300,31 +228,6 @@ Assuming all the required gems install properly, verify you can run the `asciido
|
|
300
228
|
If you see the version of {project-name} printed, you're ready to use {project-name}.
|
301
229
|
Let's get an AsciiDoc document ready to convert to EPUB3.
|
302
230
|
|
303
|
-
=== Prepare an AsciiDoc Document
|
304
|
-
|
305
|
-
If you don't already have an AsciiDoc document, you can use the [file]_sample-book.adoc_ file and its chapters found in the [path]_data/samples_ directory of this project.
|
306
|
-
|
307
|
-
.Master file named sample-book.adoc
|
308
|
-
```asciidoc
|
309
|
-
= Asciidoctor EPUB3: Sample Book
|
310
|
-
Author Name
|
311
|
-
v1.0, 2014-04-15
|
312
|
-
:doctype: book
|
313
|
-
:creator: {author}
|
314
|
-
:producer: Asciidoctor
|
315
|
-
:keywords: Asciidoctor, samples, e-book, EPUB3, KF8, MOBI, Asciidoctor.js
|
316
|
-
:copyright: CC-BY-SA 3.0
|
317
|
-
:imagesdir: images
|
318
|
-
|
319
|
-
\include::asciidoctor-epub3-readme.adoc[]
|
320
|
-
|
321
|
-
\include::sample-content.adoc[]
|
322
|
-
|
323
|
-
\include::asciidoctor-js-introduction.adoc[]
|
324
|
-
|
325
|
-
\include::asciidoctor-js-extension.adoc[]
|
326
|
-
```
|
327
|
-
|
328
231
|
=== EPUB-related AsciiDoc Attributes
|
329
232
|
|
330
233
|
The metadata in the generated EPUB3 file is populated from attributes in the AsciiDoc document.
|
@@ -363,7 +266,7 @@ The title is added to the metadata in plain text format.
|
|
363
266
|
The authors in each chapter document are aggregated together with the authors in the master file.
|
364
267
|
|
365
268
|
|username
|
366
|
-
|Used to resolve an avatar for the author that is displayed in the header of a chapter when the `
|
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`.
|
367
270
|
The avatar image should be located at the path _\{imagesdir}/avatars/\{username}.jpg_, where `\{username}` is the value of this attribute.
|
368
271
|
|
369
272
|
|producer
|
@@ -397,17 +300,34 @@ The recommended practice is to identify the referenced resource by means of a st
|
|
397
300
|
|An optional override of the properties attribute for this document's item in the manifest.
|
398
301
|
_Only applies to a chapter document._
|
399
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
|
+
|
400
318
|
|epub3-stylesdir
|
401
319
|
|The path to a directory that contains alternate epub3.css and epub3-css3-only.css files to customize the look and feel.
|
402
320
|
|
403
321
|
|doctype
|
404
|
-
|Effectively ignored.
|
405
|
-
The master document is assumed to be a book and each chapter an article.
|
406
|
-
|
407
|
-
|publication-type
|
408
322
|
|Used to control the inclusion of special content in the generated HTML.
|
409
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.
|
410
|
-
Suggested values include: book (default),
|
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:`
|
411
331
|
|===
|
412
332
|
|
413
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`.
|
@@ -581,9 +501,10 @@ Here's a sample manifest of files found in an EPUB3 document produced by {projec
|
|
581
501
|
....
|
582
502
|
META-INF/
|
583
503
|
container.xml
|
584
|
-
|
504
|
+
EPUB/
|
585
505
|
fonts/
|
586
|
-
|
506
|
+
awesome/
|
507
|
+
fa-solid-900.ttf
|
587
508
|
font-icons.ttf
|
588
509
|
mplus-1mn-latin-bold.ttf
|
589
510
|
mplus-1mn-latin-light.ttf
|
@@ -618,17 +539,14 @@ mimetype
|
|
618
539
|
|
619
540
|
Images referenced in your AsciiDoc document must be stored in the images catalog.
|
620
541
|
The images catalog is defined by the `imagesdir` attribute.
|
621
|
-
If set, the value of this attribute is resolved relative to the
|
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.
|
622
543
|
(In other words, it cannot point to a location outside the document directory).
|
623
|
-
If this attribute is not set, the images catalog defaults to the directory of the
|
544
|
+
If this attribute is not set, the images catalog defaults to the directory of the document.
|
624
545
|
{project-name} will discover all local image references and insert those images into the EPUB3 archive at the same relative path.
|
625
546
|
|
626
|
-
WARNING: {project-name} does not currently discover and package inline images.
|
627
|
-
See issue {uri-issues}/30[#30].
|
628
|
-
|
629
547
|
=== Default Images
|
630
548
|
|
631
|
-
The sample book contains placeholder
|
549
|
+
The sample book contains placeholder image for an author avatar.
|
632
550
|
|
633
551
|
// TODO explain the avatar and book cover images
|
634
552
|
|
@@ -648,7 +566,7 @@ Once your image is ready, you can set the cover image by defining the `front-cov
|
|
648
566
|
:front-cover-image: image:cover.png[Front Cover,1050,1600]
|
649
567
|
----
|
650
568
|
|
651
|
-
The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the directory of
|
569
|
+
The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the directory of the3 document.
|
652
570
|
The image can be in any format, though we recommend using PNG, JPG, or SVG as they are the most portable formats.
|
653
571
|
|
654
572
|
IMPORTANT: *You should always specify the dimensions of the cover image.*
|
@@ -691,7 +609,7 @@ The theme's fonts are located in the [path]_data/fonts_ directory.
|
|
691
609
|
The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
|
692
610
|
The body text uses Noto Serif.
|
693
611
|
Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
|
694
|
-
Refer to the
|
612
|
+
Refer to the link:NOTICE.adoc[] file for further information about the fonts.
|
695
613
|
|
696
614
|
// TODO document command to generate the M+ 1p latin fonts
|
697
615
|
|
@@ -986,8 +904,8 @@ endif::[]
|
|
986
904
|
Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project.
|
987
905
|
Free use of this software is granted under the terms of the MIT License.
|
988
906
|
|
989
|
-
For the full text of the license, see the
|
990
|
-
Refer to the
|
907
|
+
For the full text of the license, see the link:LICENSE[] file.
|
908
|
+
Refer to the link:NOTICE.adoc[] file for information about third-party Open Source software in use.
|
991
909
|
|
992
910
|
////
|
993
911
|
== Additional Points of Note
|