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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +134 -0
  3. data/Gemfile +10 -0
  4. data/README.adoc +248 -172
  5. data/asciidoctor-epub3.gemspec +42 -0
  6. data/bin/adb-push-ebook +19 -10
  7. data/data/styles/epub3-css3-only.css +28 -11
  8. data/data/styles/epub3.css +40 -39
  9. data/lib/asciidoctor-epub3/converter.rb +188 -121
  10. data/lib/asciidoctor-epub3/core_ext/string.rb +1 -1
  11. data/lib/asciidoctor-epub3/font_icon_map.rb +1 -1
  12. data/lib/asciidoctor-epub3/packager.rb +240 -104
  13. data/lib/asciidoctor-epub3/spine_item_processor.rb +22 -11
  14. data/lib/asciidoctor-epub3/version.rb +1 -1
  15. metadata +24 -35
  16. data/data/samples/asciidoctor-epub3-readme.adoc +0 -849
  17. data/data/samples/asciidoctor-js-browser-extension.adoc +0 -46
  18. data/data/samples/asciidoctor-js-introduction.adoc +0 -91
  19. data/data/samples/i18n.adoc +0 -161
  20. data/data/samples/images/asciidoctor-js-chrome-extension.png +0 -0
  21. data/data/samples/images/avatars/graphitefriction.jpg +0 -0
  22. data/data/samples/images/avatars/mogztter.jpg +0 -0
  23. data/data/samples/images/avatars/mojavelinux.jpg +0 -0
  24. data/data/samples/images/correct-text-justification.png +0 -0
  25. data/data/samples/images/incorrect-text-justification.png +0 -0
  26. data/data/samples/images/screenshots/chapter-title-day.png +0 -0
  27. data/data/samples/images/screenshots/chapter-title.png +0 -0
  28. data/data/samples/images/screenshots/figure-admonition.png +0 -0
  29. data/data/samples/images/screenshots/section-title-paragraph.png +0 -0
  30. data/data/samples/images/screenshots/sidebar.png +0 -0
  31. data/data/samples/images/screenshots/table.png +0 -0
  32. data/data/samples/images/screenshots/text.png +0 -0
  33. data/data/samples/sample-book.adoc +0 -21
  34. data/data/samples/sample-content.adoc +0 -168
  35. data/scripts/generate-font-subsets.pe +0 -235
@@ -8,35 +8,39 @@ class SpineItemProcessor < Extensions::IncludeProcessor
8
8
  # NOTE only fires for includes in spine document if registered directly on the instance of the spine document
9
9
  def process doc, reader, target, attributes
10
10
  spine_doc = doc
11
- unless ::File.exist?(include_file = (spine_doc.normalize_system_path target, reader.dir, nil, target_name: 'include file'))
11
+ # TODO allow URI value
12
+ unless ::File.file?(include_file = (spine_doc.normalize_system_path target, reader.dir, nil, target_name: 'include file'))
12
13
  warn %(asciidoctor: WARNING: #{reader.line_info}: include file not found: #{include_file})
13
14
  return
14
15
  end
15
- inherited_attributes = spine_doc.attributes.dup
16
- %w(spine doctitle docfile docdir docname).each {|key| inherited_attributes.delete key }
16
+ inherited_attrs = spine_doc.attributes.dup
17
+ # QUESTION should we keep backend-epub3 for convenience?
18
+ %w(backend-epub3 backend-epub3-doctype-book docdir docfile docname doctitle outfilesuffix spine).each {|key| inherited_attrs.delete key }
17
19
 
18
20
  # parse header to get author information
19
21
  spine_item_doc_meta = ::Asciidoctor.load_file include_file,
20
22
  safe: spine_doc.safe,
21
23
  backend: 'epub3-xhtml5',
22
24
  doctype: :article,
23
- parse_header_only: true
25
+ parse_header_only: true
24
26
 
25
27
  # blank out author information if present in sub-document
26
28
  # FIXME this is a huge hack...we need a cleaner way to do this; perhaps an API method that retrieves all the author attribute names
27
29
  if spine_item_doc_meta.attr? 'author'
28
- %w(author firstname lastname email authorinitials authors authorcount).each {|key| inherited_attributes.delete key }
30
+ %w(author firstname lastname email authorinitials authors authorcount).each {|key| inherited_attrs.delete key }
29
31
  idx = 1
30
- while inherited_attributes.key? %(author_#{idx})
31
- %W(author_#{idx} firstname_#{idx} lastname_#{idx} email_#{idx} authorinitials_#{idx}).each {|key| inherited_attributes.delete key }
32
+ while inherited_attrs.key? %(author_#{idx})
33
+ %W(author_#{idx} firstname_#{idx} lastname_#{idx} email_#{idx} authorinitials_#{idx}).each {|key| inherited_attrs.delete key }
32
34
  idx += 1
33
35
  end
34
36
  end
35
37
 
36
38
  # REVIEW reaching into converter to resolve document id feels like a hack; should happen in Asciidoctor parser
37
39
  # also, strange that "id" doesn't work here
38
- inherited_attributes['css-signature'] = DocumentIdGenerator.generate_id spine_item_doc_meta
39
- inherited_attributes['docreldir'] = ::File.dirname target
40
+ idprefix = (spine_doc.attr 'idprefix') || (spine_item_doc_meta.attr 'idprefix')
41
+ idseparator = (spine_doc.attr 'idseparator') || (spine_item_doc_meta.attr 'idseparator')
42
+ inherited_attrs['css-signature'] = DocumentIdGenerator.generate_id spine_item_doc_meta, idprefix, idseparator
43
+ inherited_attrs['docreldir'] = ::File.dirname target
40
44
 
41
45
  # NOTE can't assign spine document as parent since there's too many assumptions in the Asciidoctor processor
42
46
  spine_item_doc = ::Asciidoctor.load_file include_file,
@@ -47,15 +51,22 @@ class SpineItemProcessor < Extensions::IncludeProcessor
47
51
  backend: 'epub3-xhtml5',
48
52
  doctype: :article,
49
53
  header_footer: true,
50
- attributes: inherited_attributes
54
+ attributes: inherited_attrs
51
55
 
52
56
  # restore attributes to those defined in the document header
53
57
  spine_item_doc.restore_attributes
54
58
 
55
- (spine_doc.references[:spine_items] ||= []) << spine_item_doc
59
+ # FIXME core should register document ID if specified
60
+ unless (refs = spine_item_doc.references)[:ids].include? spine_item_doc.id
61
+ spine_item_doc.register :ids, [spine_item_doc.id, (spine_item_doc.attr 'docreftext') || spine_item_doc.doctitle]
62
+ end
63
+
64
+ refs[:spine] = spine_doc
65
+ refs[:spine_items] = ((spine_doc.references[:spine_items] ||= []) << spine_item_doc)
56
66
  # NOTE if there are attribute assignments between the include directives,
57
67
  # then this ordered list is not continguous, so bailing on the idea
58
68
  #reader.replace_line %(. link:#{::File.basename(spine_item_doc.attr 'outfile')}[#{spine_item_doc.doctitle}])
69
+ nil
59
70
  end
60
71
 
61
72
  # handles? should get the attributes on include directive as the second argument
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Epub3
3
- VERSION = '1.5.0.alpha.6'
3
+ VERSION = '1.5.0.alpha.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-epub3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.alpha.6
4
+ version: 1.5.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-05 00:00:00.000000000 Z
12
+ date: 2017-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '10.0'
20
+ version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '10.0'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: asciidoctor
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,30 +59,36 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.3.5
62
+ version: 0.3.6
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.3.5
70
- description: |
71
- An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book archives.
72
- email: dan@opendevise.io
69
+ version: 0.3.6
70
+ description: 'An extension for Asciidoctor that converts AsciiDoc documents to EPUB3
71
+ and KF8/MOBI (Kindle) e-book archives.
72
+
73
+ '
74
+ email: dan@opendevise.com
73
75
  executables:
74
76
  - asciidoctor-epub3
75
77
  - adb-push-ebook
76
78
  extensions: []
77
79
  extra_rdoc_files:
78
- - README.adoc
80
+ - CHANGELOG.adoc
79
81
  - LICENSE.adoc
80
82
  - NOTICE.adoc
83
+ - README.adoc
81
84
  files:
85
+ - CHANGELOG.adoc
86
+ - Gemfile
82
87
  - LICENSE.adoc
83
88
  - NOTICE.adoc
84
89
  - README.adoc
85
90
  - Rakefile
91
+ - asciidoctor-epub3.gemspec
86
92
  - bin/adb-push-ebook
87
93
  - bin/asciidoctor-epub3
88
94
  - data/fonts/assorted-icons.ttf
@@ -127,25 +133,6 @@ files:
127
133
  - data/images/default-cover.svg
128
134
  - data/images/default-headshot.jpg
129
135
  - data/images/default-headshot.png
130
- - data/samples/asciidoctor-epub3-readme.adoc
131
- - data/samples/asciidoctor-js-browser-extension.adoc
132
- - data/samples/asciidoctor-js-introduction.adoc
133
- - data/samples/i18n.adoc
134
- - data/samples/images/asciidoctor-js-chrome-extension.png
135
- - data/samples/images/avatars/graphitefriction.jpg
136
- - data/samples/images/avatars/mogztter.jpg
137
- - data/samples/images/avatars/mojavelinux.jpg
138
- - data/samples/images/correct-text-justification.png
139
- - data/samples/images/incorrect-text-justification.png
140
- - data/samples/images/screenshots/chapter-title-day.png
141
- - data/samples/images/screenshots/chapter-title.png
142
- - data/samples/images/screenshots/figure-admonition.png
143
- - data/samples/images/screenshots/section-title-paragraph.png
144
- - data/samples/images/screenshots/sidebar.png
145
- - data/samples/images/screenshots/table.png
146
- - data/samples/images/screenshots/text.png
147
- - data/samples/sample-book.adoc
148
- - data/samples/sample-content.adoc
149
136
  - data/styles/color-palette.css
150
137
  - data/styles/epub3-css3-only.css
151
138
  - data/styles/epub3-fonts.css
@@ -157,21 +144,23 @@ files:
157
144
  - lib/asciidoctor-epub3/packager.rb
158
145
  - lib/asciidoctor-epub3/spine_item_processor.rb
159
146
  - lib/asciidoctor-epub3/version.rb
160
- - scripts/generate-font-subsets.pe
161
147
  homepage: https://github.com/asciidoctor/asciidoctor-epub3
162
148
  licenses:
163
149
  - MIT
164
150
  metadata: {}
165
151
  post_install_message:
166
152
  rdoc_options:
167
- - --charset=UTF-8 --title="Asciidoctor EPUB3" --main=README.adoc -ri
153
+ - "--charset=UTF-8"
154
+ - --title="Asciidoctor EPUB3"
155
+ - "--main=README.adoc"
156
+ - "-ri"
168
157
  require_paths:
169
158
  - lib
170
159
  required_ruby_version: !ruby/object:Gem::Requirement
171
160
  requirements:
172
161
  - - ">="
173
162
  - !ruby/object:Gem::Version
174
- version: '1.9'
163
+ version: 1.9.3
175
164
  required_rubygems_version: !ruby/object:Gem::Requirement
176
165
  requirements:
177
166
  - - ">"
@@ -179,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
168
  version: 1.3.1
180
169
  requirements: []
181
170
  rubyforge_project:
182
- rubygems_version: 2.4.8
171
+ rubygems_version: 2.6.8
183
172
  signing_key:
184
173
  specification_version: 4
185
174
  summary: Converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book formats
@@ -1,849 +0,0 @@
1
- = Asciidoctor EPUB3: A _native_ EPUB3 converter for AsciiDoc
2
- Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
- :project-name: Asciidoctor EPUB3
4
- :project-handle: asciidoctor-epub3
5
- :project-uri: https://github.com/asciidoctor/{project-handle}
6
- :project-repo-uri: {project-uri}
7
- :project-issues-uri: {project-repo-uri}/issues
8
- :rvm-uri: http://rvm.io
9
- :asciidoctor-uri: http://asciidoctor.org
10
- :idpf-uri: http://www.idpf.org/
11
- :epub-uri: http://www.idpf.org/epub/30/spec/epub30-overview.html
12
- :epubcheck-uri: https://github.com/idpf/epubcheck
13
- ifdef::env-github[]
14
- :base-uri: link:
15
- endif::[]
16
- ifndef::env-github[]
17
- :base-uri: {project-repo-uri}/blob/master/
18
- 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
-
25
- {project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI e-book formats.
26
-
27
- == Introduction
28
-
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_ e-books.
30
- Let's face it, many of the technical e-books out there--especially those produced from software documentation--are *_hideous_*.
31
- The Asciidoctor project wants to disrupt the status quo.
32
-
33
- ifdef::env-github[]
34
- .An excerpt from an e-book produced by {project-name} shown in Day, Night and Sepia mode.
35
- image::screenshots/text.png[]
36
- endif::[]
37
-
38
- === Project Mission
39
-
40
- The {project-name} project aims to produce EPUB3 documents that meet the following objectives:
41
-
42
- [itemized,subject-stop=.]
43
- Fully Semantic::
44
- Produce deeply semantic XHTML5 documents, including use of the recommended `epub:type` attribute.
45
- Exceptional Readability::
46
- Readers should be drawn into the text so that they read and absorb it, not scared away from it.
47
- Maximize the readability of the text using carefully crafted styles, focusing on:
48
- - Custom, readable fonts with strong UTF-8 character support
49
- - Sufficient line spacing and margins
50
- - Modular font size scale
51
- - Subtle, pleasing colors with good contrast
52
- - A responsive design that scales well from small to large screens
53
- - Widowed and orphaned content avoided where possible
54
- Complete & Accurate Metadata::
55
- Fully populate the EPUB3 package metadata using information in the AsciiDoc source document.
56
- Consistent Rendering::
57
- Render consistently across a broad range of EPUB3 (and select EPUB2+) readers and respond to any size screen.
58
- Polish, Polish & More Polish::
59
- Add polish to the final product such as font-based icons and callout numbers.
60
-
61
- We believe that the e-books produced by {project-name} are the _very best_ output you can expect to find in digital publishing today.
62
- Of course, there's always room for improvement, so we'll continue to work with you to achieve and maintain this goal.
63
-
64
- === Notable Features
65
-
66
- * Direct AsciiDoc to EPUB3 conversion
67
- * Direct AsciiDoc to KF8/MOBI conversion
68
- * Highly-aesthetic and readable styles with optimized text legibility
69
- * Respects font settings (if supported by the reader) without altering headings, code or icons
70
- * EPUB3 metadata, manifest and spine (assembled by Gepub)
71
- * Document metadata (title, authors, subject, keywords, etc.)
72
- * Internal cross reference links (not yet between chapters)
73
- * Syntax highlighting with CodeRay or Pygments (must use inline styles)
74
- * Unicode callout numbers
75
- * Page breaks avoided in block content (so much as it's supported by the reader)
76
- * Orphan section titles avoided (so much as it's supported by the reader)
77
- * Table border settings honored
78
- * Support for SVG images in the content
79
-
80
- === Project Status
81
-
82
- CAUTION: {project-name} is currently _alpha_ software.
83
- Use accordingly.
84
- Although the bulk of AsciiDoc content is converted, there's still work needed to fill in gaps where conversion is incomplete or unstyled.
85
-
86
- 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.
87
- We may explore the use of fixed layout documents in the future if the need arises.
88
-
89
- === Planned Features and Work In Progress
90
-
91
- See {worklog-uri}[WORKLOG.adoc].
92
-
93
- == Converter Workflow
94
-
95
- {project-name} takes a single, logical AsciiDoc document as input and converts it to an EPUB3 publication archive (often described as a “website in a box”).
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].
98
-
99
- An EPUB3 archive is typically structured with the contents of each “chapter” in a separate XHTML file.
100
- The converter must therefore “chunk” the source document into multiple XHTML files to put in the EPUB3 archive.
101
- Other converters tend to handle this task by automatically slicing up the XHTML output at predetermined heading levels.
102
- Asciidoctor takes a different approach.
103
-
104
- === Declaring the Spine
105
-
106
- Asciidoctor relies on top-level include directives (i.e., include directives in the master document) to indicate where the chapter splits should occur.
107
- Each chapter must start with a single-line, level-0 section.
108
- The section title becomes the chapter title and TOC entry and the section id determines the chapter file name in the EPUB3 archive.
109
- In other words, you must be explicit.
110
- Asciidoctor will not try to guess.
111
- If your AsciiDoc document is not structured in this way, you'll need to change it to use the {project-name} converter properly.
112
-
113
- 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 being passed down from the master to ensure consistent behavior.
115
- 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
-
117
- Here's an example showing the structure of a spine document:
118
-
119
- ----
120
- = Book Title
121
- Author Name
122
- :doctype: book
123
- :imagesdir: images
124
- //...and so on
125
- \ifndef::ebook-format[:leveloffset: 1]
126
-
127
- \include::chapter-one.adoc[]
128
-
129
- \include::chapter-two.adoc[]
130
-
131
- \include::chapter-three.adoc[]
132
- ----
133
-
134
- Here's an example showing the structure of a chapter document:
135
-
136
- ----
137
- [[chapter-one]]
138
- = Chapter One
139
-
140
- chapter content
141
- ----
142
-
143
- CAUTION: Although an explicit ID over the chapter title is not required, it is recommended.
144
- See issue https://github.com/asciidoctor/asciidoctor-epub3/issues/46[#46] for details.
145
-
146
- 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. (Currently broken. See issue https://github.com/asciidoctor/asciidoctor-epub3/issues/47[#47]).
147
-
148
- 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.
149
- However, for the time being, the include directive will suit this purpose.
150
-
151
- == Prerequisites
152
-
153
- All that's needed to use {project-name} is Ruby (1.9.3 or above; 2.2.x recommended) and a few Ruby gems, which we'll explain how to install in the next section.
154
-
155
- To check if you have Ruby available, use the `ruby` command to query the installed version:
156
-
157
- $ ruby --version
158
-
159
- == Getting Started
160
-
161
- You can get {project-name} by <<_install_the_published_gem,installing the published gem>> or <<_development,running the code from source>>.
162
-
163
- === Install the Published Gem
164
-
165
- {project-name} is published as a pre-release on RubyGems.org.
166
- You can install the published gem using the following command:
167
-
168
- $ gem install asciidoctor-epub3 --pre
169
-
170
- If you want to syntax highlight source listings, you'll also want to install CodeRay or Pygments.
171
- Choose one (or more) of the following:
172
-
173
- .CodeRay
174
- $ gem install coderay
175
-
176
- .Pygments
177
- $ gem install pygments.rb
178
-
179
- You then activate syntax highlighting for a given document by adding the `source-highlighter` attribute to the document header (CodeRay shown):
180
-
181
- [source,asciidoc]
182
- ----
183
- :source-highlighter: coderay
184
- ----
185
-
186
- NOTE: At the moment, Pygments is automatically used if it's available.
187
-
188
- Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
189
-
190
- $ asciidoctor-epub3 -v
191
-
192
- If you see the version of {project-name} printed, you're ready to use {project-name}.
193
- Let's get an AsciiDoc document ready to convert to EPUB3.
194
-
195
- === Prepare an AsciiDoc Document
196
-
197
- 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.
198
-
199
- .Master file named sample-book.adoc
200
- ```asciidoc
201
- = Asciidoctor EPUB3: Sample Book
202
- Author Name
203
- v1.0, 2014-04-15
204
- :doctype: book
205
- :producer: Asciidoctor
206
- :keywords: Asciidoctor, samples, e-book, EPUB3, KF8, MOBI, Asciidoctor.js
207
- :copyright: CC-BY-SA 3.0
208
- :imagesdir: images
209
-
210
- \include::asciidoctor-epub3-readme.adoc[]
211
-
212
- \include::sample-content.adoc[]
213
-
214
- \include::asciidoctor-js-introduction.adoc[]
215
-
216
- \include::asciidoctor-js-extension.adoc[]
217
- ```
218
-
219
- === EPUB-related AsciiDoc Attributes
220
-
221
- The metadata in the generated EPUB3 file is populated from attributes in the AsciiDoc document.
222
- The names of the attributes and the metadata elements to which they map are documented in this section.
223
-
224
- The term [term]_package metadata_ in Table 1 is in reference to the http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-metadata-elem[<metadata> element] in the EPUB3 package document (e.g., [file]_package.opf_).
225
- The `dc` namespace prefix is in reference to the http://dublincore.org/documents/2004/12/20/dces[Dublin Core Metadata Element Set].
226
-
227
- .AsciiDoc attributes that control the EPUB3 metadata (i.e., package.opf)
228
- [cols="1m,3"]
229
- |===
230
- |Name |Description
231
-
232
- |uuid
233
- |Populates the *required* unique identifier (`<dc:identifier>`) in the package metadata.
234
- 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.
236
-
237
- |lang
238
- |Populates the content language / locale (`<dc:language>`) in the package metadata.
239
-
240
- |scripts
241
- |Controls the font subsets that are selected based on the specified scripts (e.g., alphabets). (values: *latin*, latin-ext, latin-cyrillic or multilingual)
242
-
243
- |revdate
244
- |Populates the publication date (`<dc:date>`) in the package metadata.
245
- The date should be specified in a parsable format, such as `2014-01-01`.
246
-
247
- |doctitle
248
- |Populates the title (`<dc:title>`) in the package metadata.
249
- The title is added to the metadata in plain text format.
250
-
251
- |author
252
- |Populates the contributors (`<dc:contributor>`) in the package metadata.
253
- The authors in each chapter document are aggregated together with the authors in the master file.
254
-
255
- |username
256
- |Used to resolve an avatar for the author that is displayed in the header of a chapter.
257
- The avatar image should be located at the path _$${imagesdir}/avatars/{username}.jpg$$_, where
258
- `{username}` is the value of this attribute.
259
-
260
- |producer
261
- |Populates the publisher (`<dc:publisher>`) in the package metadata.
262
-
263
- |creator
264
- |Populates the creator (`<dc:creator>`) in the package metadata.
265
- If the creator is not specified, the value of the producer attribute is used.
266
-
267
- |description
268
- |Populates the description (`<dc:description>`) in the package metadata.
269
-
270
- |keywords
271
- |Populates the subjects (i.e., `<dc:subject>`) in the package metadata.
272
- The keywords should be represented as comma-separated values (CSV).
273
-
274
- |front-cover-image
275
- |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 e-book archive.
277
- May be specified as a path or inline image macro.
278
- Using the inline image macro is preferred as it allows the height and width to be specified.
279
-
280
- |copyright
281
- |Populates the rights statement (`<dc:rights>`) in the package metadata.
282
-
283
- |source
284
- |Populates the source reference (`<dc:source>`) in the package metadata.
285
- The recommended practice is to identify the referenced resource by means of a string or number conforming to a formal identification system.
286
-
287
- |epub-properties
288
- |An optional override of the properties attribute for this document's item in the manifest.
289
- _Only applies to a chapter document._
290
-
291
- |epub3-stylesdir
292
- |The path to a directory that contains alternate epub3.css and epub3-css3-only.css files to customize the look and feel.
293
-
294
- |doctype
295
- |Effectively ignored.
296
- The master document is assumed to be a book and each chapter an article.
297
- |===
298
-
299
- 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`.
300
- You can use these attributes in a preprocessor directive if you only want to show certain content to readers using a particular device.
301
- For instance, if you want to display a message to readers on Kindle, you can use:
302
-
303
- ----
304
- \ifdef::ebook-format-kf8[Hello Kindle reader!]
305
- ----
306
-
307
- With that out of the way, it's time to convert the AsciiDoc document directly to EPUB3.
308
-
309
- == Performing the Conversion
310
-
311
- You can convert AsciiDoc documents to EPUB3 and KF8/MOBI from the commandline using the `asciidoctor-epub3` script provided with the {project-name} project.
312
-
313
- === Convert AsciiDoc to EPUB3
314
-
315
- Converting an AsciiDoc document to EPUB3 is as simple as passing your document to the `asciidoctor-epub3` command.
316
- This command should be available on your PATH if you installed the `asciidoctor-epub3` gem.
317
- Otherwise, you can find the command in the [path]_bin_ folder of the project.
318
- We also recommend specifying an output directory using the `-D` option flag.
319
-
320
- $ asciidoctor-epub3 -D output data/samples/sample-book.adoc
321
-
322
- 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 EPUB3 reader to view the result.
324
-
325
- Below are several screenshots of this sample book as it appears on an Android phone.
326
-
327
- .An example of a chapter title and abstract shown side-by-side in Day and Night mode
328
- image::screenshots/chapter-title.png[]
329
-
330
- .An example of a section title followed by paragraph text separated by a literal block
331
- image::screenshots/section-title-paragraph.png[]
332
-
333
- .An example of a figure and an admonition
334
- image::screenshots/figure-admonition.png[]
335
-
336
- .An example of a sidebar
337
- image::screenshots/sidebar.png[]
338
-
339
- .An example of a table
340
- image::screenshots/table.png[]
341
-
342
- NOTE: The `asciidoctor-epub3` command is a temporary solution for invoking the {project-name} converter.
343
- We plan to remove this script once we have completed proper integration with the `asciidoctor` command.
344
-
345
- TIP: As another example, point `asciidoctor-epub3` at the https://github.com/opendevise/github-guides-asciidoc[GitHub Guides] that we've ported to AsciiDoc, then compare the output to the real https://guides.github.com[GitHub Guides].
346
-
347
- === Validate the EPUB3 Archive
348
-
349
- Next, let's validate the EPUB3 archive to ensure it built correctly.
350
-
351
- .EPUB3 with validation
352
- $ asciidoctor-epub3 -D output -a ebook-validate data/samples/sample-book.adoc
353
-
354
- .Validation success
355
- ----
356
- Epubcheck Version 3.0.1
357
-
358
- Validating against EPUB version 3.0
359
- No errors or warnings detected.
360
- ----
361
-
362
- If the EPUB3 archive contains any errors, they will be output in your terminal.
363
-
364
- .EPUB Standard & Validator
365
- ****
366
- The electronic publication (EPUB) standard is developed by the {idpf-uri}[International Digital Publishing Forum (IDPF)].
367
- {epub-uri}[EPUB 3.0], released in October 2011, is the latest version of this standard.
368
-
369
- An EPUB3 archive contains:
370
-
371
- * a package document (metadata, file manifest, spine)
372
- * a navigation document (table of contents)
373
- * one or more content documents
374
- * assets (images, fonts, stylesheets, etc.)
375
-
376
- The IDPF also supports {epubcheck-uri}[EpubCheck].
377
- EpubCheck parses and validates the file against the EPUB schema.
378
- ****
379
-
380
- 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.
381
- The EPUB3 file will be extracted to a directory adjacent to the generated file, but without the file extension.
382
-
383
- $ asciidoctor-epub3 -D output -a ebook-extract data/samples/sample-book.adoc
384
-
385
- In this example, the contents of the EPUB3 will be extracted to the [path]_output/sample-book_ directory.
386
-
387
- === Convert AsciiDoc to KF8/MOBI
388
-
389
- Creating a KF8/MOBI archive directly from an AsciiDoc document is done with the same generation script (`asciidoctor-epub3`).
390
- You just need to specify the format (`-a ebook-format`) as `kf8`.
391
-
392
- $ asciidoctor-epub3 -D output -a ebook-format=kf8 data/samples/sample-book.adoc
393
-
394
- 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
-
396
- KindleGen does mandatory validation so you don't need to run the `validate` command after converting to KF8/MOBI.
397
-
398
- .What is KF8?
399
- ****
400
- 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.
401
- The format is close enough to EPUB3 that it's safe to think of it simply as an EPUB3 implementation under most circumstances.
402
- You can read more about the format on the http://www.amazon.com/gp/feature.html?docId=1000729511[Kindle Format 8 page].
403
-
404
- 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.
405
- That's why we refer to the format in this project as KF8/MOBI.
406
- ****
407
-
408
- === Command Arguments
409
-
410
- *-h, --help* ::
411
- Show the usage message
412
-
413
- *-D, --destination-dir* ::
414
- Writes files to specified directory (defaults to the current directory)
415
-
416
- *-a ebook-extract* ::
417
- Extracts the EPUB3 to a folder in the destination directory after the file is generated
418
-
419
- *-a ebook-format=<format>* ::
420
- Specifies the e-book format to generate (epub3 or kf8, default: epub3)
421
-
422
- *-a ebook-validate* ::
423
- Runs Epubcheck 3.0.1 to validate output file against the EPUB3 specification
424
-
425
- *-v, --version* ::
426
- Display the program version
427
-
428
- === EPUB3 Archive Structure
429
-
430
- Here's a sample manifest of files found in an EPUB3 document produced by Asciidoctor EPUB3.
431
-
432
- ....
433
- META-INF/
434
- container.xml
435
- OEBPS/
436
- fonts/
437
- font-awesome.ttf
438
- font-icons.ttf
439
- mplus-1mn-latin-bold.ttf
440
- mplus-1mn-latin-light.ttf
441
- mplus-1mn-latin-medium.ttf
442
- mplus-1mn-latin-regular.ttf
443
- mplus-1p-latin-bold.ttf
444
- mplus-1p-latin-light.ttf
445
- mplus-1p-latin-regular.ttf
446
- noto-serif-bold-italic.ttf
447
- noto-serif-bold.ttf
448
- noto-serif-italic.ttf
449
- noto-serif-regular.ttf
450
- images/
451
- avatars/
452
- default.png
453
- figure-01.png
454
- figure-02.png
455
- styles/
456
- epub3-css3-only.css
457
- epub3.css
458
- chapter-01.xhtml
459
- chapter-02.xhtml
460
- ...
461
- cover.xhtml
462
- nav.xhtml
463
- package.opf
464
- toc.ncx
465
- mimetype
466
- ....
467
-
468
- == Working with Images
469
-
470
- Images that your AsciiDoc document references should be saved in the directory defined in the `imagesdir` attribute, which defaults to the directory of the document.
471
- {project-name} will discover all local image references and insert the images into the EPUB3 archive at the same relative path.
472
-
473
- WARNING: Currently including images only works correctly if you set `imagesdir` to the directory `images` like in the example shown above. This will be fixed in future versions.
474
-
475
- The sample book contains placeholder images for an author avatar and a book cover.
476
-
477
- // TODO explain the avatar and book cover images
478
-
479
- === Changing the Cover Image
480
-
481
- E-book readers have different image resolution and file size limits regarding a book's cover.
482
- 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 application you're targeting.
484
-
485
- 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
-
487
- 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
- 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
-
490
- ----
491
- :front-cover-image: image:cover.png[width=1050,height=1600]
492
- ----
493
-
494
- The image is resolved relative to the directory specified in the `imagesdir` attribute, which defaults to the document directory.
495
- The image can be in any format, though we recommend using PNG or JPG as they are the most portable formats.
496
-
497
- IMPORTANT: You should always specify the dimensions of the cover image.
498
- This ensures the viewer will preserve the aspect ratio if it needs to be scaled to fit the screen.
499
- If you don't specify a width and height, then the dimensions are assumed to be 1050x1600.
500
-
501
- == About the Theme
502
-
503
- EPUB3 and KF8/MOBI files are styled using CSS3.
504
- However, each e-book reader honors a reduced set of CSS3 styles, and the styles they allow and how they implement them are rarely documented.
505
- All we've got to say is _thank goodness for CSS hacks, media queries and years of CSS experience!_
506
-
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 reader applications and to degrade gracefully in select EPUB2 readers.
508
- The theme maintains readability regardless of the e-book reader's background mode (i.e., day, night or sepia) or the display device's pixel density and screen resolution.
509
-
510
- The theme's CSS files are located in the [path]_data/style_ directory.
511
-
512
- IMPORTANT: {project-name} only provides one theme, and, at this time, you can not replace it with a custom theme using the `stylesheet` attribute.
513
- 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.
514
-
515
- === Fonts
516
-
517
- {project-name} embeds a set of fonts and font icons.
518
- The theme's fonts are located in the [path]_data/fonts_ directory.
519
-
520
- The M+ Outline fonts are used for titles, headings, literal (monospace) text, and annotation numbers.
521
- The body text uses Noto Serif.
522
- Admonition icons and the end-of-chapter mark are from the Font Awesome icon font.
523
- Refer to the {notice-uri}[NOTICE.adoc] file for further information about the fonts.
524
-
525
- // TODO document command to generate the M+ 1p latin fonts
526
-
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>&#x200b;+`).
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>&#xfeff+`) or the http://www.fileformat.info/info/unicode/char/2060/index.htm[word joiner] character (e.g., `+<a href="...">Fork</a>&#x2060;+`).
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>&#xfeff; 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 `&#xfeff;` 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
- === Device-specific Styles
584
-
585
- 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.
586
- This enhancement allows you to use styles targeted specifically at that reader.
587
-
588
- 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.
589
-
590
- ,===
591
- Reader,HTML Element,CSS Class Name
592
-
593
- Gitden,body,gitden-reader
594
- Namo PubTreeViewer,body,namo-epub-library
595
- Readium,body,readium-js-viewer
596
- iBooks,body,ibooks
597
- Adobe RMSDK >= 11,body,rmsdk
598
- Google Books,div,gb-reader-container
599
- ,===
600
-
601
- NOTE: Kobo does not support the epubReadingSystem JavaScript object, despite the fact that it does support JavaScript.
602
-
603
- == Pushing to Android
604
-
605
- 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.
606
- 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.
607
-
608
- You transfer files from your computer to an Android phone over a USB connection using a command from the Android SDK Tools called `adb`.
609
- Follow these steps to get it setup:
610
-
611
- . Download the Android SDK Tools zip from the table labeled *SDK Tools Only* on the http://developer.android.com/sdk/index.html[Get the Android SDK] page
612
- . Extract the archive
613
- . Locate the path to the `adb` command (Hint: Look in the platform-tools folder)
614
- . Set the environment variable named ADB to the path of the `adb` command
615
-
616
- $ export ADB=~/apps/android-sdk/platform-tools/adb
617
-
618
- 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.
619
-
620
- .Publish both EPUB3 and KF8 files to Android device
621
- $ adb-push-ebook output/sample-book
622
-
623
- IMPORTANT: Don't include the file extension since the script will check for both the .epub and .mobi files.
624
-
625
- The `adb-push-ebook` script copies the files to the following locations on the device:
626
-
627
- ,===
628
- File type,Destination on Android device
629
-
630
- *.epub,/sdcard/
631
- *.mobi,/sdcard/Android/data/com.amazon.kindle/files/
632
- ,===
633
-
634
- 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 reader application of choice.
636
-
637
- == E-book Reader Recommendations and Quirks
638
-
639
- EPUB3 readers will provide the best reading experience when viewing the book generated by {project-name}.
640
- Here's a list of some of the readers we know to have good EPUB3 support and the systems on which they run:
641
-
642
- * http://www.amazon.com/gp/feature.html?docId=1000493771[Amazon Kindle] (most platforms)
643
- * http://gitden.com/gitdenreader[Gitden] (Android and iOS)
644
- * http://www.apple.com/ibooks[iBooks] (iOS, OSX)
645
- * https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl?hl=en-US[Readium] (Chrome)
646
- * http://www.kobo.com/apps[Kobo] (Android, iOS, OSX and Windows)
647
- * http://www.namo.com/site/namo/menu/5074.do[Namo PubTreeViewer] (Android, iOS and Windows)
648
- * http://calibre-ebook.com[Calibre ebook-viewer] (Linux, OSX, Windows)
649
-
650
- IMPORTANT: To get the full experience, ensure that the reader is configured to use the publisher's styles.
651
- Different readers word this setting in different ways.
652
- Look for the option screen that allows you to set the fonts and font colors and disable it.
653
- 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
-
655
- When the book is viewed in EPUB2 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.
656
- EPUB2 readers, such as Aldiko, don't understand CSS3 styles and therefore miss out on some of subtleties in the formatting.
657
-
658
- 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 readers, despite the different CSS implementation rules and limitations unique to each e-book application.
659
- Most of these obstacles were addressed using media queries or explicit classes.
660
- Some we haven't conquered.
661
- Yet.
662
-
663
- The <<_kindle_quirks,Kindle quirks list>> shows you just a few of the constraints we encountered.
664
- 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
-
666
- // 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
-
668
- [[_kindle_quirks]]
669
- .Kindle Quirks
670
- * overrules margins and line heights like a medieval tyrant
671
- * `font-family` can't be set on `<body>`
672
- * requires `!important` on text-decoration
673
- * `position: relative` isn't permitted
674
- * strips (or unwraps) `<header>` tags
675
- * `@page` isn't supported
676
- * `page-break: avoid` isn't supported
677
- * `max-width` isn't supported
678
- * `widows` are left in the cold
679
- * won't style footers without an explicit class
680
- * `-webkit-hyphens: auto` causes Kindle for Mac (and perhaps others) to crash
681
- * `text-rendering: optimizeLegibility` causes file to be rejected by KFP (and causes the text to disappear in some previewers)
682
- * 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
683
-
684
- === Send to Kindle
685
-
686
- The “Send to Kindle” feature, used for transferring a MOBI file to a Kindle device, is known to strip out all the font files.
687
- Therefore, if you use this feature, don't be surprised to see default fonts and missing font-based icons.
688
- We recommend that you transfer the file using other means, such as a USB cable or a sync service like Dropbox.
689
-
690
- ////
691
- head-stop (default '.')
692
- stack-head role (run-in is default)
693
- signature role (sets hardbreaks option)
694
-
695
- subject-stop (default ':')
696
- ////
697
-
698
- ////
699
- == Device and Application Testing
700
-
701
- {project-name} has been tested on the following devices and applications.
702
-
703
- .Computers
704
- |===
705
- |Device |OS |Resolution |ppi |Browsers |Readium |Gitden |Kindle
706
-
707
- |Asus
708
- |Fedora 17
709
- |no x no
710
- |
711
- |Chrome x
712
- |Readium
713
-
714
- Asus, Fedora 20, display resolution, Chrome x, Readium
715
- Ideapad Y460 |Fedora 20 |1366 x 768 (16:9) |
716
- PC, Windows X,
717
- |===
718
-
719
- .Tablets
720
- |===
721
- Asus Transformer, Android x, display resolution, Aldiko, Kindle, Readium, Readmill
722
- Nexus,
723
- |===
724
-
725
- .Phones
726
- |===
727
- HTC Sensation, Android x, display resolution, xxxx
728
- Nexus ,
729
- |===
730
-
731
- ////
732
-
733
- == Contributing
734
-
735
- In the spirit of free software, _everyone_ is encouraged to help improve this project.
736
-
737
- To contribute code, simply fork the project on GitHub, hack away and send a pull request with your proposed changes.
738
-
739
- Feel free to use the {project-issues-uri}[issue tracker] or http://discuss.asciidoctor.org[Asciidoctor mailing list] to provide feedback or suggestions in other ways.
740
-
741
- == Development
742
-
743
- To help develop Asciidoctor EPUB3, or to simply test drive the development version, you need to get the source from GitHub.
744
- Follow the instructions below to learn how to clone the source and run it from your local copy.
745
-
746
- === Retrieve the Source Code
747
-
748
- You can retrieve {project-name} in one of two ways:
749
-
750
- . Clone the git repository
751
- . Download a zip archive of the repository
752
-
753
- ==== Option 1: Fetch Using `git clone`
754
-
755
- If you want to clone the git repository, simply copy the {project-repo-uri}[GitHub repository URL] and pass it to the `git clone` command:
756
-
757
- $ git clone https://github.com/asciidoctor/asciidoctor-epub3
758
-
759
- Next, change to the project directory:
760
-
761
- $ cd asciidoctor-epub3
762
-
763
- ==== Option 2: Download the Archive
764
-
765
- If you want to download a zip archive, click on the btn:[icon:cloud-download[\] Download Zip] button on the right-hand side of the repository page on GitHub.
766
- Once the download finishes, extract the archive, open a console and change to that directory.
767
-
768
- TIP: Instead of working out of the {project-handle} directory, you can simply add the absolute path of the [path]_bin_ directory to your `PATH` environment variable.
769
-
770
- We'll leverage the project configuration to install the necessary dependencies.
771
-
772
- === Prepare RVM (optional step)
773
-
774
- If you're using {rvm-uri}[RVM], we recommend creating a new gemset to work with {project-name}:
775
-
776
- $ rvm use 2.2@asciidoctor-epub3-dev --create
777
-
778
- We like RVM because it keeps the dependencies required by various projects isolated.
779
-
780
- === Install the Dependencies
781
-
782
- The dependencies needed to use {project-name} are defined in the [file]_Gemfile_ at the root of the project.
783
- We can use Bundler to install the dependencies for us.
784
-
785
- To check if you have Bundler available, use the `bundle` command to query the version installed:
786
-
787
- $ bundle --version
788
-
789
- If it's not installed, use the `gem` command to install it.
790
-
791
- $ gem install bundle
792
-
793
- Then use the `bundle` command to install the project dependencies:
794
-
795
- $ bundle
796
-
797
- NOTE: You need to call `bundle` from the project directory so that it can find the [file]_Gemfile_.
798
-
799
- === Build and Install the Gem
800
-
801
- Now that the dependencies are installed, you can build and install the gem.
802
-
803
- Use the Rake build tool to build and install the gem (into the current RVM gemset or into the system if not using RVM):
804
-
805
- $ rake install:local
806
-
807
- The build will report that it built the gem into the [path]_pkg_ directory and that it installed the gem.
808
-
809
- Once the development version of the gem is installed, you can run {project-name} by invoking the `asciidoctor-epub3` script:
810
-
811
- $ asciidoctor-epub3 -v
812
-
813
- If you see the version of {project-name} printed to your console, you're ready to use {project-name}!
814
-
815
- === Shortcut: Run the Launch Script Directly
816
-
817
- Assuming all the required gems install properly, you can run the `asciidoctor-epub3` script directly out of the project folder using either:
818
-
819
- $ bin/asciidoctor-epub3 -v
820
-
821
- or
822
-
823
- $ bundle exec bin/asciidoctor-epub3 -v
824
-
825
- You're now ready to test drive the development version of {project-name}!
826
-
827
- Jump back to <<Getting Started>> to learn how to create an AsciiDoc document and convert it to EPUB3.
828
-
829
- == Authors
830
-
831
- {project-name} was written by https://github.com/mojavelinux[Dan Allen] and https://github.com/graphitefriction[Sarah White] of OpenDevise on behalf of the Asciidoctor Project.
832
-
833
- == Copyright
834
-
835
- Copyright (C) 2014-2016 OpenDevise Inc. and the Asciidoctor Project.
836
- Free use of this software is granted under the terms of the MIT License.
837
-
838
- For the full text of the license, see the {license-uri}[LICENSE.adoc] file.
839
- Refer to the {notice-uri}[NOTICE.adoc] file for information about third-party Open Source software in use.
840
-
841
- ////
842
- == Additional Points of Note
843
-
844
- * uppercase chapter titles to work around line-height limitation in Kindle (1.4 minimum)
845
- * circled numbers from M+ 1mn for annotation numbers in listing blocks
846
- * avatars for authors
847
- * document command to generate the M+ 1p latin fonts
848
- * recommended readers (Readium, Gitden, Kindle, etc)
849
- ////