asciidoctor-epub3 1.5.0.alpha.5 → 1.5.0.alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.adoc +1 -1
- data/NOTICE.adoc +1 -1
- data/README.adoc +183 -79
- data/bin/asciidoctor-epub3 +5 -1
- data/data/samples/asciidoctor-epub3-readme.adoc +183 -79
- data/data/samples/{asciidoctor-js-extension.adoc → asciidoctor-js-browser-extension.adoc} +1 -1
- data/data/samples/asciidoctor-js-introduction.adoc +2 -2
- data/data/samples/sample-book.adoc +1 -1
- data/data/samples/sample-content.adoc +5 -5
- data/data/styles/epub3-css3-only.css +21 -7
- data/data/styles/epub3.css +56 -69
- data/lib/asciidoctor-epub3/converter.rb +16 -9
- data/lib/asciidoctor-epub3/packager.rb +26 -8
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +3 -3
data/bin/asciidoctor-epub3
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
if File.exist?(asciidoctor_epub3 = (File.expand_path '../../lib/asciidoctor-epub3', __FILE__))
|
4
|
+
require asciidoctor_epub3
|
5
|
+
else
|
6
|
+
require 'asciidoctor-epub3'
|
7
|
+
end
|
4
8
|
require 'asciidoctor/cli'
|
5
9
|
|
6
10
|
options = Asciidoctor::Cli::Options.new backend: 'epub3'
|
@@ -1,6 +1,5 @@
|
|
1
1
|
= Asciidoctor EPUB3: 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.5, 2015-11-01
|
4
3
|
:project-name: Asciidoctor EPUB3
|
5
4
|
:project-handle: asciidoctor-epub3
|
6
5
|
:project-uri: https://github.com/asciidoctor/{project-handle}
|
@@ -67,9 +66,10 @@ Of course, there's always room for improvement, so we'll continue to work with y
|
|
67
66
|
* Direct AsciiDoc to EPUB3 conversion
|
68
67
|
* Direct AsciiDoc to KF8/MOBI conversion
|
69
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
70
|
* EPUB3 metadata, manifest and spine (assembled by Gepub)
|
71
71
|
* Document metadata (title, authors, subject, keywords, etc.)
|
72
|
-
* Internal cross reference links
|
72
|
+
* Internal cross reference links (not yet between chapters)
|
73
73
|
* Syntax highlighting with CodeRay or Pygments (must use inline styles)
|
74
74
|
* Unicode callout numbers
|
75
75
|
* Page breaks avoided in block content (so much as it's supported by the reader)
|
@@ -81,8 +81,7 @@ Of course, there's always room for improvement, so we'll continue to work with y
|
|
81
81
|
|
82
82
|
CAUTION: {project-name} is currently _alpha_ software.
|
83
83
|
Use accordingly.
|
84
|
-
Although the bulk of AsciiDoc content is
|
85
|
-
Once it's battle tested, the project will be moved into the Asciidoctor organization on GitHub.
|
84
|
+
Although the bulk of AsciiDoc content is converted, there's still work needed to fill in gaps where conversion is incomplete or unstyled.
|
86
85
|
|
87
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.
|
88
87
|
We may explore the use of fixed layout documents in the future if the need arises.
|
@@ -94,7 +93,7 @@ See {worklog-uri}[WORKLOG.adoc].
|
|
94
93
|
== Converter Workflow
|
95
94
|
|
96
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”).
|
97
|
-
Using the EPUB3 publication as the “digital master”, {project-name}
|
96
|
+
Using the EPUB3 publication as the “digital master”, {project-name} then produces a KF8/MOBI file, the format required by Amazon Kindle.
|
98
97
|
The conversion to KF8/MOBI is performed by sending the EPUB3 through http://www.amazon.com/gp/feature.html?docId=1000765211[KindleGen].
|
99
98
|
|
100
99
|
An EPUB3 archive is typically structured with the contents of each “chapter” in a separate XHTML file.
|
@@ -105,6 +104,8 @@ Asciidoctor takes a different approach.
|
|
105
104
|
=== Declaring the Spine
|
106
105
|
|
107
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.
|
108
109
|
In other words, you must be explicit.
|
109
110
|
Asciidoctor will not try to guess.
|
110
111
|
If your AsciiDoc document is not structured in this way, you'll need to change it to use the {project-name} converter properly.
|
@@ -113,85 +114,82 @@ You can think of the master document as the spine of the book and the include di
|
|
113
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.
|
114
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).
|
115
116
|
|
116
|
-
|
117
|
+
Here's an example showing the structure of a spine document:
|
117
118
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
To check if you have Ruby available, use the `ruby` command to query the version installed:
|
126
|
-
|
127
|
-
$ ruby --version
|
128
|
-
|
129
|
-
If you're using {rvm-uri}[RVM], we recommend creating a new gemset to work with {project-name}:
|
130
|
-
|
131
|
-
$ rvm use @asciidoctor-epub3 --create
|
132
|
-
|
133
|
-
We like RVM because it keeps the dependencies required by various projects isolated ;)
|
134
|
-
|
135
|
-
== Getting Started
|
136
|
-
|
137
|
-
{project-name} isn't yet published as a RubyGem itself, so you'll need to get the source code.
|
138
|
-
|
139
|
-
=== Retrieve the project
|
119
|
+
----
|
120
|
+
= Book Title
|
121
|
+
Author Name
|
122
|
+
:doctype: book
|
123
|
+
:imagesdir: images
|
124
|
+
//...and so on
|
125
|
+
\ifndef::ebook-format[:leveloffset: 1]
|
140
126
|
|
141
|
-
|
127
|
+
\include::chapter-one.adoc[]
|
142
128
|
|
143
|
-
.
|
144
|
-
. Download a zip archive of the repository
|
129
|
+
\include::chapter-two.adoc[]
|
145
130
|
|
146
|
-
|
147
|
-
|
148
|
-
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:
|
131
|
+
\include::chapter-three.adoc[]
|
132
|
+
----
|
149
133
|
|
150
|
-
|
134
|
+
Here's an example showing the structure of a chapter document:
|
151
135
|
|
152
|
-
|
136
|
+
----
|
137
|
+
[[chapter-one]]
|
138
|
+
= Chapter One
|
153
139
|
|
154
|
-
|
140
|
+
chapter content
|
141
|
+
----
|
155
142
|
|
156
|
-
|
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.
|
157
145
|
|
158
|
-
If
|
159
|
-
Once the download finishes, extract the archive, open a console and change to that directory.
|
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]).
|
160
147
|
|
161
|
-
|
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.
|
162
150
|
|
163
|
-
|
151
|
+
== Prerequisites
|
164
152
|
|
165
|
-
|
166
|
-
We can use Bundler to install the dependencies for us.
|
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.
|
167
154
|
|
168
|
-
To check if you have
|
155
|
+
To check if you have Ruby available, use the `ruby` command to query the installed version:
|
169
156
|
|
170
|
-
$
|
157
|
+
$ ruby --version
|
171
158
|
|
172
|
-
|
159
|
+
== Getting Started
|
173
160
|
|
174
|
-
|
161
|
+
You can get {project-name} by <<_install_the_published_gem,installing the published gem>> or <<_development,running the code from source>>.
|
175
162
|
|
176
|
-
|
163
|
+
=== Install the Published Gem
|
177
164
|
|
178
|
-
|
165
|
+
{project-name} is published as a pre-release on RubyGems.org.
|
166
|
+
You can install the published gem using the following command:
|
179
167
|
|
180
|
-
|
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:
|
181
172
|
|
182
|
-
|
173
|
+
.CodeRay
|
174
|
+
$ gem install coderay
|
183
175
|
|
184
|
-
|
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):
|
185
180
|
|
186
|
-
|
181
|
+
[source,asciidoc]
|
182
|
+
----
|
183
|
+
:source-highlighter: coderay
|
184
|
+
----
|
187
185
|
|
188
|
-
|
186
|
+
NOTE: At the moment, Pygments is automatically used if it's available.
|
189
187
|
|
190
|
-
|
188
|
+
Assuming all the required gems install properly, verify you can run the `asciidoctor-epub3` script:
|
191
189
|
|
192
|
-
$
|
190
|
+
$ asciidoctor-epub3 -v
|
193
191
|
|
194
|
-
|
192
|
+
If you see the version of {project-name} printed, you're ready to use {project-name}.
|
195
193
|
Let's get an AsciiDoc document ready to convert to EPUB3.
|
196
194
|
|
197
195
|
=== Prepare an AsciiDoc Document
|
@@ -231,7 +229,7 @@ The `dc` namespace prefix is in reference to the http://dublincore.org/documents
|
|
231
229
|
|===
|
232
230
|
|Name |Description
|
233
231
|
|
234
|
-
|
|
232
|
+
|uuid
|
235
233
|
|Populates the *required* unique identifier (`<dc:identifier>`) in the package metadata.
|
236
234
|
An id will be generated automatically from the doctitle if not specified.
|
237
235
|
The recommended practice is to identify the document by means of a string or number conforming to a formal identification system.
|
@@ -256,7 +254,7 @@ The authors in each chapter document are aggregated together with the authors in
|
|
256
254
|
|
257
255
|
|username
|
258
256
|
|Used to resolve an avatar for the author that is displayed in the header of a chapter.
|
259
|
-
The avatar image should be located at the path _$${imagesdir}/avatars/{username}.
|
257
|
+
The avatar image should be located at the path _$${imagesdir}/avatars/{username}.jpg$$_, where
|
260
258
|
`{username}` is the value of this attribute.
|
261
259
|
|
262
260
|
|producer
|
@@ -290,6 +288,9 @@ The recommended practice is to identify the referenced resource by means of a st
|
|
290
288
|
|An optional override of the properties attribute for this document's item in the manifest.
|
291
289
|
_Only applies to a chapter document._
|
292
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
|
+
|
293
294
|
|doctype
|
294
295
|
|Effectively ignored.
|
295
296
|
The master document is assumed to be a book and each chapter an article.
|
@@ -390,7 +391,7 @@ You just need to specify the format (`-a ebook-format`) as `kf8`.
|
|
390
391
|
|
391
392
|
$ asciidoctor-epub3 -D output -a ebook-format=kf8 data/samples/sample-book.adoc
|
392
393
|
|
393
|
-
When the script completes, you'll see the file [file]_sample-book.mobi_ appear in the [path]_output_ directory.
|
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.
|
394
395
|
|
395
396
|
KindleGen does mandatory validation so you don't need to run the `validate` command after converting to KF8/MOBI.
|
396
397
|
|
@@ -469,6 +470,8 @@ mimetype
|
|
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.
|
470
471
|
{project-name} will discover all local image references and insert the images into the EPUB3 archive at the same relative path.
|
471
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
|
+
|
472
475
|
The sample book contains placeholder images for an author avatar and a book cover.
|
473
476
|
|
474
477
|
// TODO explain the avatar and book cover images
|
@@ -507,6 +510,7 @@ The theme maintains readability regardless of the e-book reader's background mod
|
|
507
510
|
The theme's CSS files are located in the [path]_data/style_ directory.
|
508
511
|
|
509
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.
|
510
514
|
|
511
515
|
=== Fonts
|
512
516
|
|
@@ -520,14 +524,14 @@ Refer to the {notice-uri}[NOTICE.adoc] file for further information about the fo
|
|
520
524
|
|
521
525
|
// TODO document command to generate the M+ 1p latin fonts
|
522
526
|
|
523
|
-
===
|
527
|
+
=== Text Justification Hack
|
524
528
|
|
525
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.
|
526
530
|
Generally speaking, WebKit is a great engine that brings a lot of consistency and power to the e-book reader landscape.
|
527
|
-
It also brings along the same set of bugs.
|
531
|
+
It also brings along the same set of bugs present in browsers that are based on it.
|
528
532
|
|
529
|
-
One
|
530
|
-
|
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.
|
531
535
|
You can see an example of this problem in the screenshot below.
|
532
536
|
|
533
537
|
.WebKit justifying rich text incorrectly
|
@@ -545,28 +549,28 @@ We call it the “word joiner hack”.
|
|
545
549
|
Here's the HTML source of the first sentence from the screenshots:
|
546
550
|
|
547
551
|
```xml
|
548
|
-
<strong><a href="...">Fork</a
|
552
|
+
<strong><a href="...">Fork</a> the repository</srtong> <span>and clone it locally.</span>
|
549
553
|
```
|
550
554
|
|
551
555
|
WebKit treats the space following an inline element as insignificant and thus fails to account for it when justifying the text.
|
552
556
|
|
553
|
-
At first glance, you might think to add a normal space character before the closing tag of the inline element (e.g.,
|
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>+`).
|
554
558
|
However, that would cause any underline beneath links to extend past the end of the word.
|
555
559
|
|
556
|
-
At second glance, you might think to add a zero-width space character immediately following the element (e.g.,
|
560
|
+
At second glance, you might think to add a zero-width space character immediately following the element (e.g., `+<a href="...">Fork</a>​+`).
|
557
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.
|
558
562
|
|
559
|
-
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.,
|
563
|
+
Reflecting on the problem of the zero-width space brings us to either the http://www.fileformat.info/info/unicode/char/FEFF/index.htm[zero-width no-break space] character (e.g., `+<a href="...">Fork</a>+`) or the http://www.fileformat.info/info/unicode/char/2060/index.htm[word joiner] character (e.g., `+<a href="...">Fork</a>⁠+`).
|
560
564
|
Like the zero-width space, these characters occupy no space.
|
561
565
|
However, instead of introducing a wrap opportunity, they prevent one.
|
562
566
|
|
563
567
|
But here's the clincher.
|
564
|
-
If the character following a zero-width non-break space or a word joiner is a normal space (e.g.,
|
568
|
+
If the character following a zero-width non-break space or a word joiner is a normal space (e.g., `+<a href="...">Fork</a> the+`), then it behaves just like a regular space.
|
565
569
|
We've covered all the scenarios!
|
566
570
|
Hey WebKit, you've been Unicode punked!
|
567
571
|
|
568
572
|
*UPDATE:* The zero-width no-break space was deprecated in favor of the word joiner.
|
569
|
-
However, as we've discovered, font support for the word joiner is
|
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.
|
570
574
|
Therefore, we've decided to go with the zero-width no-break space to avoid nasty rectangle outlines from font bombing your content.
|
571
575
|
|
572
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._
|
@@ -584,15 +588,18 @@ This enhancement allows you to use styles targeted specifically at that reader.
|
|
584
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.
|
585
589
|
|
586
590
|
,===
|
587
|
-
Reader,
|
588
|
-
|
589
|
-
Gitden,gitden-reader
|
590
|
-
Namo PubTreeViewer,namo-epub-library
|
591
|
-
Readium,
|
592
|
-
iBooks,ibooks
|
593
|
-
|
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
|
594
599
|
,===
|
595
600
|
|
601
|
+
NOTE: Kobo does not support the epubReadingSystem JavaScript object, despite the fact that it does support JavaScript.
|
602
|
+
|
596
603
|
== Pushing to Android
|
597
604
|
|
598
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.
|
@@ -670,6 +677,15 @@ To see all of the workarounds and why we chose certain style options, check out
|
|
670
677
|
* `max-width` isn't supported
|
671
678
|
* `widows` are left in the cold
|
672
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.
|
673
689
|
|
674
690
|
////
|
675
691
|
head-stop (default '.')
|
@@ -722,13 +738,101 @@ To contribute code, simply fork the project on GitHub, hack away and send a pull
|
|
722
738
|
|
723
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.
|
724
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
|
+
|
725
829
|
== Authors
|
726
830
|
|
727
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.
|
728
832
|
|
729
833
|
== Copyright
|
730
834
|
|
731
|
-
Copyright (C) 2014-
|
835
|
+
Copyright (C) 2014-2016 OpenDevise Inc. and the Asciidoctor Project.
|
732
836
|
Free use of this software is granted under the terms of the MIT License.
|
733
837
|
|
734
838
|
For the full text of the license, see the {license-uri}[LICENSE.adoc] file.
|
@@ -18,7 +18,7 @@ The resulting JavaScript can be executed in any JavaScript runtime environment,
|
|
18
18
|
|
19
19
|
== Proving the concept
|
20
20
|
|
21
|
-
When I first discovered Opal, I thought to myself,
|
21
|
+
When I first discovered Opal, I thought to myself, "`Sure, this could work.`"
|
22
22
|
Little did I know that achieving this proof of concept was more than a small task.
|
23
23
|
|
24
24
|
The effort involved filling gaps in Opal to support all the features of the Ruby standard library that Asciidoctor uses, as well as changes in Asciidoctor to make it compatible with constraints imposed by JavaScript (such as immutable strings).
|
@@ -43,7 +43,7 @@ As we learn to optimize Opal, the size of the generated files should become quit
|
|
43
43
|
====
|
44
44
|
|
45
45
|
You need to load both files into your JavaScript environment to use Asciidoctor.
|
46
|
-
For instance, in an HTML page, add these two
|
46
|
+
For instance, in an HTML page, add these two `<script>` tags (ideally at the bottom of the page):
|
47
47
|
|
48
48
|
[source,html]
|
49
49
|
----
|