asciidoctor-epub3 1.5.0.alpha.4 → 1.5.0.alpha.5
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 +3 -2
- data/bin/asciidoctor-epub3 +18 -3
- data/data/samples/asciidoctor-epub3-readme.adoc +3 -2
- data/lib/asciidoctor-epub3/converter.rb +7 -2
- data/lib/asciidoctor-epub3/packager.rb +12 -12
- data/lib/asciidoctor-epub3/version.rb +1 -1
- data/scripts/generate-font-subsets.pe +19 -15
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53cfac0ce0da69c5ac8b1b2a207ab0ff89cfd187
|
4
|
+
data.tar.gz: 069bcd8227164ddc01bc2cd161b65ae7b3fe0c2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d6f85f5787589c0015ff134ad61ec92ae70fff3d2a4a3ec14f7298e76b6ef198eda072e638d86373569a8b725578afaddba2505e491d3b4a7b647fe496dfbdc
|
7
|
+
data.tar.gz: 6c3f1e30f7aef5b2d858834eb36c215681ef6f9a1feb48c5f108ba05c439eae4ee06665208f5780dc8f409d98dd6ba3b7b47d446255dfdf3efcb9d60d22e1305
|
data/LICENSE.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.The MIT License
|
2
2
|
....
|
3
|
-
Copyright (C) 2014 OpenDevise Inc. and the Asciidoctor Project
|
3
|
+
Copyright (C) 2014-2015 OpenDevise Inc. and the Asciidoctor Project
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/NOTICE.adoc
CHANGED
data/README.adoc
CHANGED
@@ -1,5 +1,6 @@
|
|
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
|
3
4
|
:project-name: Asciidoctor EPUB3
|
4
5
|
:project-handle: asciidoctor-epub3
|
5
6
|
:project-uri: https://github.com/asciidoctor/{project-handle}
|
@@ -188,7 +189,7 @@ The build will report that it built the Gem into the [path]_pkg_ directory.
|
|
188
189
|
|
189
190
|
Finally, install the Gem.
|
190
191
|
|
191
|
-
$ gem install pkg/asciidoctor-epub3-1.
|
192
|
+
$ gem install pkg/asciidoctor-epub3-1.5.0.dev.gem
|
192
193
|
|
193
194
|
You're now ready to use {project-name}!
|
194
195
|
Let's get an AsciiDoc document ready to convert to EPUB3.
|
@@ -727,7 +728,7 @@ Feel free to use the {project-issues-uri}[issue tracker] or http://discuss.ascii
|
|
727
728
|
|
728
729
|
== Copyright
|
729
730
|
|
730
|
-
Copyright (C) 2014 OpenDevise Inc. and the Asciidoctor Project.
|
731
|
+
Copyright (C) 2014-2015 OpenDevise Inc. and the Asciidoctor Project.
|
731
732
|
Free use of this software is granted under the terms of the MIT License.
|
732
733
|
|
733
734
|
For the full text of the license, see the {license-uri}[LICENSE.adoc] file.
|
data/bin/asciidoctor-epub3
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../lib/asciidoctor-epub3'
|
4
4
|
require 'asciidoctor/cli'
|
5
5
|
|
6
6
|
options = Asciidoctor::Cli::Options.new backend: 'epub3'
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
# FIXME provide an API in Asciidoctor for sub-components to print version information
|
9
|
+
unless ARGV != ['-v'] && (ARGV & ['-V', '--version']).empty?
|
10
|
+
require_relative '../lib/asciidoctor-epub3/version'
|
11
|
+
$stdout.write %(Asciidoctor EPUB3 #{Asciidoctor::Epub3::VERSION} using )
|
12
|
+
# NOTE the print_version method was added in Asciidoctor 1.5.2
|
13
|
+
if options.respond_to? :print_version
|
14
|
+
options.print_version
|
15
|
+
else
|
16
|
+
puts %(Asciidoctor #{::Asciidoctor::VERSION} [http://asciidoctor.org])
|
17
|
+
end
|
9
18
|
exit 0
|
19
|
+
end
|
20
|
+
|
21
|
+
# FIXME This is a really bizarre API. Please make me simpler.
|
22
|
+
case (result = options.parse! ARGV)
|
23
|
+
when Integer
|
24
|
+
exit result
|
10
25
|
else
|
11
26
|
invoker = Asciidoctor::Cli::Invoker.new options
|
12
27
|
GC.start
|
@@ -1,5 +1,6 @@
|
|
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
|
3
4
|
:project-name: Asciidoctor EPUB3
|
4
5
|
:project-handle: asciidoctor-epub3
|
5
6
|
:project-uri: https://github.com/asciidoctor/{project-handle}
|
@@ -188,7 +189,7 @@ The build will report that it built the Gem into the [path]_pkg_ directory.
|
|
188
189
|
|
189
190
|
Finally, install the Gem.
|
190
191
|
|
191
|
-
$ gem install pkg/asciidoctor-epub3-1.
|
192
|
+
$ gem install pkg/asciidoctor-epub3-1.5.0.dev.gem
|
192
193
|
|
193
194
|
You're now ready to use {project-name}!
|
194
195
|
Let's get an AsciiDoc document ready to convert to EPUB3.
|
@@ -727,7 +728,7 @@ Feel free to use the {project-issues-uri}[issue tracker] or http://discuss.ascii
|
|
727
728
|
|
728
729
|
== Copyright
|
729
730
|
|
730
|
-
Copyright (C) 2014 OpenDevise Inc. and the Asciidoctor Project.
|
731
|
+
Copyright (C) 2014-2015 OpenDevise Inc. and the Asciidoctor Project.
|
731
732
|
Free use of this software is granted under the terms of the MIT License.
|
732
733
|
|
733
734
|
For the full text of the license, see the {license-uri}[LICENSE.adoc] file.
|
@@ -33,8 +33,7 @@ class Converter
|
|
33
33
|
|
34
34
|
# FIXME we have to package in write because we don't have access to target before this point
|
35
35
|
def write packager, target
|
36
|
-
|
37
|
-
packager.package validate: @validate, extract: @extract, to_dir: (::File.dirname target)
|
36
|
+
packager.package validate: @validate, extract: @extract, target: target
|
38
37
|
nil
|
39
38
|
end
|
40
39
|
end
|
@@ -315,6 +314,12 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
315
314
|
</div>)
|
316
315
|
end
|
317
316
|
|
317
|
+
def floating_title node
|
318
|
+
tag_name = %(h#{node.level + 1})
|
319
|
+
id_attribute = node.id ? %( id="#{node.id}") : nil
|
320
|
+
%(<#{tag_name}#{id_attribute} class="#{['discrete', node.role].compact * ' '}">#{node.title}</#{tag_name}>)
|
321
|
+
end
|
322
|
+
|
318
323
|
def listing node
|
319
324
|
figure_classes = ['listing']
|
320
325
|
figure_classes << 'coalesce' if node.option? 'unbreakable'
|
@@ -313,8 +313,7 @@ end
|
|
313
313
|
class Packager
|
314
314
|
KINDLEGEN = ENV['KINDLEGEN'] || 'kindlegen'
|
315
315
|
EPUBCHECK = ENV['EPUBCHECK'] || %(epubcheck#{::Gem.win_platform? ? '.bat' : '.sh'})
|
316
|
-
EpubExtensionRx = /\.epub$/
|
317
|
-
Kf8ExtensionRx = /-kf8\.epub$/
|
316
|
+
EpubExtensionRx = /\.epub$/i
|
318
317
|
|
319
318
|
def initialize spine_doc, spine, format = :epub3, options = {}
|
320
319
|
@document = spine_doc
|
@@ -326,7 +325,8 @@ class Packager
|
|
326
325
|
doc = @document
|
327
326
|
spine = @spine
|
328
327
|
fmt = @format
|
329
|
-
|
328
|
+
target = options[:target]
|
329
|
+
dest = File.dirname target
|
330
330
|
|
331
331
|
images = spine.map {|item| (item.find_by context: :image) || [] }.flatten
|
332
332
|
usernames = spine.map {|item| item.attr 'username' }.compact.uniq
|
@@ -424,9 +424,9 @@ class Packager
|
|
424
424
|
|
425
425
|
::FileUtils.mkdir_p dest unless ::File.directory? dest
|
426
426
|
|
427
|
-
epub_file =
|
427
|
+
epub_file = fmt == :kf8 ? %(#{::Asciidoctor::Helpers.rootname target}-kf8.epub) : target
|
428
428
|
builder.generate_epub epub_file
|
429
|
-
puts %(Wrote #{fmt.upcase} to #{epub_file})
|
429
|
+
puts %(Wrote #{fmt.upcase} to #{epub_file}) if $VERBOSE
|
430
430
|
if options[:extract]
|
431
431
|
extract_dir = epub_file.sub EpubExtensionRx, ''
|
432
432
|
::FileUtils.remove_dir extract_dir if ::File.directory? extract_dir
|
@@ -442,28 +442,28 @@ class Packager
|
|
442
442
|
end
|
443
443
|
end
|
444
444
|
end
|
445
|
-
puts %(Extracted #{fmt.upcase} to #{extract_dir})
|
445
|
+
puts %(Extracted #{fmt.upcase} to #{extract_dir}) if $VERBOSE
|
446
446
|
end
|
447
447
|
|
448
448
|
if fmt == :kf8
|
449
|
-
distill_epub_to_mobi epub_file
|
449
|
+
distill_epub_to_mobi epub_file, target
|
450
450
|
elsif options[:validate]
|
451
451
|
validate_epub epub_file
|
452
452
|
end
|
453
453
|
end
|
454
454
|
|
455
455
|
# QUESTION how to enable the -c2 flag? (enables ~3-5% compression)
|
456
|
-
def distill_epub_to_mobi epub_file
|
456
|
+
def distill_epub_to_mobi epub_file, target
|
457
457
|
kindlegen_cmd = KINDLEGEN
|
458
458
|
unless ::File.executable? kindlegen_cmd
|
459
459
|
require 'kindlegen' unless defined? ::Kindlegen
|
460
460
|
kindlegen_cmd = ::Kindlegen.command
|
461
461
|
end
|
462
|
-
mobi_file = ::File.basename(
|
462
|
+
mobi_file = ::File.basename(target.sub EpubExtensionRx, '.mobi')
|
463
463
|
::Open3.popen2e(::Shellwords.join [kindlegen_cmd, '-o', mobi_file, epub_file]) {|input, output, wait_thr|
|
464
|
-
output.each {|line| puts line }
|
464
|
+
output.each {|line| puts line } unless $VERBOSE.nil?
|
465
465
|
}
|
466
|
-
puts %(Wrote MOBI to #{::File.join ::File.dirname(epub_file), mobi_file})
|
466
|
+
puts %(Wrote MOBI to #{::File.join ::File.dirname(epub_file), mobi_file}) if $VERBOSE
|
467
467
|
end
|
468
468
|
|
469
469
|
def validate_epub epub_file
|
@@ -473,7 +473,7 @@ class Packager
|
|
473
473
|
end
|
474
474
|
# NOTE epubcheck gem doesn't support epubcheck command options; enable -quiet once supported
|
475
475
|
::Open3.popen2e(::Shellwords.join [epubcheck_cmd, epub_file]) {|input, output, wait_thr|
|
476
|
-
output.each {|line| puts line }
|
476
|
+
output.each {|line| puts line } unless $VERBOSE.nil?
|
477
477
|
}
|
478
478
|
end
|
479
479
|
end
|
@@ -27,7 +27,7 @@
|
|
27
27
|
# FIXME: need to generate cjk font
|
28
28
|
|
29
29
|
genflags = 0x08
|
30
|
-
#genflags =
|
30
|
+
#genflags = 0x10 + 0x08
|
31
31
|
copy_fonts = ["NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-BoldItalic.ttf", "mplus-1p-regular.ttf", "mplus-1p-bold.ttf", "mplus-1p-light.ttf"]
|
32
32
|
#copy_fonts = ["NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-BoldItalic.ttf"]
|
33
33
|
#copy_fonts = ["LiberationMono-Regular.ttf", "LiberationMono-Bold.ttf", "LiberationMono-Italic.ttf", "LiberationMono-BoldItalic.ttf"]
|
@@ -40,6 +40,8 @@ num_copy_scripts = SizeOf(copy_scripts)
|
|
40
40
|
code_fonts = ["mplus-1mn-light.ttf", "mplus-1mn-regular.ttf", "mplus-1mn-medium.ttf", "mplus-1mn-bold.ttf"]
|
41
41
|
#code_fonts = []
|
42
42
|
num_code_fonts = SizeOf(code_fonts)
|
43
|
+
code_script = "ascii"
|
44
|
+
#code_script = "multilingual"
|
43
45
|
if ($argc == 2)
|
44
46
|
output_dir = $argv[1]
|
45
47
|
else
|
@@ -155,26 +157,28 @@ while (fi < num_code_fonts)
|
|
155
157
|
new_basename = code_fonts[fi]:r
|
156
158
|
# remove hyphen from mplus-1
|
157
159
|
new_basename = "mplus1" + StrJoin(StrSplit(new_basename, "mplus-1"), "")
|
158
|
-
new_suffix = "-
|
160
|
+
new_suffix = "-" + code_script + ".ttf"
|
159
161
|
Open(code_fonts[fi])
|
160
162
|
SelectAll()
|
161
163
|
# NOTE: M+ fonts don't have hinting, so technically this is redundant
|
162
164
|
ClearInstrs()
|
163
165
|
SelectNone()
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
166
|
+
if (code_script == "ascii")
|
167
|
+
# Basic Latin (e.g., Code)
|
168
|
+
SelectMore(0u0020,0u007e)
|
169
|
+
# No-break space
|
170
|
+
SelectMore(0u00a0)
|
171
|
+
# Box drawing symbols for unix `tree` output
|
172
|
+
SelectMore(0u2500,0u257f)
|
173
|
+
if (new_basename == "mplus1mn-regular")
|
174
|
+
# Enclosed numbers (1-20)
|
175
|
+
SelectMore(0u2460,0u2473)
|
176
|
+
new_suffix = "-ascii-conums.ttf"
|
177
|
+
endif
|
178
|
+
SelectInvert()
|
179
|
+
Clear()
|
180
|
+
SelectNone()
|
174
181
|
endif
|
175
|
-
SelectInvert()
|
176
|
-
Clear()
|
177
|
-
SelectNone()
|
178
182
|
SetFontNames(new_basename, "M+ 1mn")
|
179
183
|
# repurpose light as italic
|
180
184
|
if (new_basename == "mplus1mn-light")
|
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.
|
4
|
+
version: 1.5.0.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.3.
|
62
|
+
version: 0.3.5
|
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.
|
69
|
+
version: 0.3.5
|
70
70
|
description: |
|
71
71
|
An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book archives.
|
72
72
|
email: dan@opendevise.io
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: 1.3.1
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.4.8
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book formats
|