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.
@@ -49,18 +49,35 @@ module GepubBuilderMixin
49
49
 
50
50
  # TODO improve design/UX of custom theme functionality, including custom fonts
51
51
  resources do
52
- file 'styles/epub3.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3.css'), format)
53
- file 'styles/epub3-css3-only.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3-css3-only.css'), format)
52
+ if format == :kf8
53
+ # NOTE add layer of indirection so Kindle Direct Publishing (KDP) doesn't strip font-related CSS rules
54
+ file 'styles/epub3.css' => '@import url("epub3-proxied.css");'.to_ios
55
+ file 'styles/epub3-css3-only.css' => '@import url("epub3-css3-only-proxied.css");'.to_ios
56
+ file 'styles/epub3-proxied.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3.css'), format)
57
+ file 'styles/epub3-css3-only-proxied.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3-css3-only.css'), format)
58
+ else
59
+ file 'styles/epub3.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3.css'), format)
60
+ file 'styles/epub3-css3-only.css' => (builder.postprocess_css_file ::File.join(workdir, 'epub3-css3-only.css'), format)
61
+ end
54
62
  end
55
63
 
56
64
  resources do
57
- #file 'styles/epub3.css' => (builder.postprocess_css_file 'styles/epub3.css', format)
58
- #file 'styles/epub3-css3-only.css' => (builder.postprocess_css_file 'styles/epub3-css3-only.css', format)
59
65
  font_files, font_css = builder.select_fonts ::File.join(DATA_DIR, 'styles/epub3-fonts.css'), (doc.attr 'scripts', 'latin')
60
66
  file 'styles/epub3-fonts.css' => font_css
61
- with_media_type 'application/x-font-ttf' do
62
- font_files.each do |font_file|
63
- file font_file => ::File.join(DATA_DIR, font_file)
67
+ unless font_files.empty?
68
+ # NOTE metadata property in oepbs package manifest doesn't work; must use proprietary iBooks file instead
69
+ #(@book.metadata.add_metadata 'meta', 'true')['property'] = 'ibooks:specified-fonts' unless format == :kf8
70
+ builder.optional_file 'META-INF/com.apple.ibooks.display-options.xml' => '<?xml version="1.0" encoding="UTF-8"?>
71
+ <display_options>
72
+ <platform name="*">
73
+ <option name="specified-fonts">true</option>
74
+ </platform>
75
+ </display_options>'.to_ios unless format == :kf8
76
+
77
+ with_media_type 'application/x-font-ttf' do
78
+ font_files.each do |font_file|
79
+ file font_file => ::File.join(DATA_DIR, font_file)
80
+ end
64
81
  end
65
82
  end
66
83
  end
@@ -446,6 +463,7 @@ class Packager
446
463
  end
447
464
 
448
465
  if fmt == :kf8
466
+ # QUESTION shouldn't we validate this epub file too?
449
467
  distill_epub_to_mobi epub_file, target
450
468
  elsif options[:validate]
451
469
  validate_epub epub_file
@@ -460,7 +478,7 @@ class Packager
460
478
  kindlegen_cmd = ::Kindlegen.command
461
479
  end
462
480
  mobi_file = ::File.basename(target.sub EpubExtensionRx, '.mobi')
463
- ::Open3.popen2e(::Shellwords.join [kindlegen_cmd, '-o', mobi_file, epub_file]) {|input, output, wait_thr|
481
+ ::Open3.popen2e(::Shellwords.join [kindlegen_cmd, '-dont_append_source', '-o', mobi_file, epub_file]) {|input, output, wait_thr|
464
482
  output.each {|line| puts line } unless $VERBOSE.nil?
465
483
  }
466
484
  puts %(Wrote MOBI to #{::File.join ::File.dirname(epub_file), mobi_file}) if $VERBOSE
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Epub3
3
- VERSION = '1.5.0.alpha.5'
3
+ VERSION = '1.5.0.alpha.6'
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.5
4
+ version: 1.5.0.alpha.6
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: 2015-11-02 00:00:00.000000000 Z
12
+ date: 2016-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -128,7 +128,7 @@ files:
128
128
  - data/images/default-headshot.jpg
129
129
  - data/images/default-headshot.png
130
130
  - data/samples/asciidoctor-epub3-readme.adoc
131
- - data/samples/asciidoctor-js-extension.adoc
131
+ - data/samples/asciidoctor-js-browser-extension.adoc
132
132
  - data/samples/asciidoctor-js-introduction.adoc
133
133
  - data/samples/i18n.adoc
134
134
  - data/samples/images/asciidoctor-js-chrome-extension.png