asciidoctor-epub3 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72adabdf77bf1c5e2832d0c4c9c538763ae77f7999ac75d33735ef60d3052b25
4
- data.tar.gz: 9c45d339749d3c2c4e5ec305f68cb9a160c5a79ba0ce930737aefa758d9b3acb
3
+ metadata.gz: 5ee3533e733000fb2993b451bc747991ccab2634a91208266e61d6530055c8cf
4
+ data.tar.gz: 6e42f2fc2c09382374920e1263c436c866ced640a7cc8dbf3bf1b55aa866033e
5
5
  SHA512:
6
- metadata.gz: 2f47ab2d12d778412ad17d341c288b6fb7bc192ee202f88068cd16ebc19ce8905b6f9f3313560c87ae9970f60c4afb04a41ad4d94de31b634e46150773ecbbc3
7
- data.tar.gz: 962a3c4c02999a05d6349ba7b980437b652f892bb3c4085fd8794c41bb386e0f12e01b5c23e44cde8923d085a8933df7c43fd6888f07393fe4c76ba7599e5f7d
6
+ metadata.gz: 2fe027ccae88e3ad3ace13d369f89ef8d0a837e627b4204e47bc2ae1e7b148dc8d8ec4699b48b18e0e64c65d2a2d2afd0f29f07fdfd46a03f01fde64ed29d662
7
+ data.tar.gz: c1a0601815f2b1add43036b397705fbf648bebc0ede9921893f20c7fc8e5dd16a35799eb39dd0d8b8871636861e56bf3721644fd38d3fd5cb0f290642b553105
data/CHANGELOG.adoc CHANGED
@@ -5,7 +5,25 @@
5
5
  This document provides a high-level view of the changes to the {project-name} by release.
6
6
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
7
 
8
- == 1.5.0 (2021-04-29) - @slonopotamus
8
+ == 2.0.0 (2024-01-12) - @slonopotamus
9
+
10
+ * fix handling of chapters with Unicode titles for Mobi (#417)
11
+ * add XML declarations to XHTML files (#424 by @abbrev)
12
+ * bump the oldest supported Ruby to 2.6
13
+ * bump the oldest supported Asciidoctor to 2.0
14
+ * escape double quotes in alt text (#443)
15
+ * refactor `btn` styling to be more customizable (#450)
16
+ * fix duplicate HTML IDs in case the same footnote is used multiple times (#447)
17
+ * add initial support for `:pygments-linenums-mode: inline` (#451)
18
+ * line numbers are no longer selected when copying text from code snippets (#422)
19
+ * compress CSS to reduce its size
20
+ * preserve roles of admonition blocks (#420)
21
+ * use prose font for verse blocks (#394)
22
+ * add support for absolute cover image path (#419)
23
+ * add support for floating blocks (#405)
24
+ * fix `<hN>` tags for chapters (#388)
25
+
26
+ == 1.5.1 (2021-04-29) - @slonopotamus
9
27
 
10
28
  * update Font Awesome Solid to 5.15.1
11
29
  * use CSS for image size scaling instead of `width` attribute (#382)
@@ -71,7 +89,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
71
89
  * fix image and listing numbers being reset in each chapter (#178)
72
90
  * fix xref resolving between sub-includes of chapter files (#166)
73
91
  * add support for contentless include files (#151)
74
- * drop nonstandard `<<chapter#>>` xref syntax and instead support vanilla `<<anchor>>` or `<<file#anchor>>` syntax (#136)
92
+ * drop nonstandard `\<<chapter#>>` xref syntax and instead support vanilla `\<<anchor>>` or `\<<file#anchor>>` syntax (#136)
75
93
  * properly include bibliography generated by asciidoctor-bibtex (#206)
76
94
  * require Asciidoctor 1.5.6+
77
95
  * add support for book preamble (#303)
data/Gemfile CHANGED
@@ -5,15 +5,12 @@ source 'https://rubygems.org'
5
5
  # Look in asciidoctor-epub3.gemspec for runtime and development dependencies.
6
6
  gemspec
7
7
 
8
- if ENV.key? 'ASCIIDOCTOR_VERSION'
9
- gem 'asciidoctor', ENV['ASCIIDOCTOR_VERSION'], require: false
10
- # Newer asciidoctor-diagram 1.5.x require asciidoctor >=1.5.7
11
- gem 'asciidoctor-diagram', '1.5.16', require: false if Gem::Version.new(ENV['ASCIIDOCTOR_VERSION']) < Gem::Version.new('2.0.0')
12
- end
13
-
14
8
  group :optional do
15
- # epubcheck-ruby might be safe to be converted into runtime dependency, but could have issues when packaged into asciidoctorj-epub3
16
- gem 'epubcheck-ruby', '~> 4.2.5.0'
17
- # Kindlegen is unavailable neither for 64-bit MacOS nor for ARM
18
- gem 'kindlegen', '~> 3.1.0' unless RbConfig::CONFIG['host_os'] =~ /darwin/
9
+ # epubcheck-ruby might be safe to be converted into runtime dependency,
10
+ # but could have issues when packaged into asciidoctorj-epub3
11
+ gem 'epubcheck-ruby', '~> 5.1.0.0'
12
+
13
+ # Kindlegen is unavailable neither for 64-bit x86 macOS nor for ARM
14
+ # Also, skip JRuby on Windows for now. See https://github.com/jruby/jruby/issues/7171
15
+ gem 'kindlegen', '~> 3.1.0' unless RUBY_PLATFORM =~ /darwin/ || (Gem.win_platform? && RUBY_ENGINE == 'jruby')
19
16
  end
data/README.adoc CHANGED
@@ -1,28 +1,28 @@
1
1
  = {project-name}: A _native_ EPUB3 converter for AsciiDoc
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
- v1.5.1, 2021-04-29
3
+ v2.0.0, 2024-01-12
4
4
  :project-name: Asciidoctor EPUB3
5
5
  :project-handle: asciidoctor-epub3
6
6
  :uri-project: https://github.com/asciidoctor/{project-handle}
7
7
  :uri-gem: https://rubygems.org/gems/asciidoctor-epub3
8
- :uri-ci: {uri-project}/actions?query=branch%3Amaster
8
+ :uri-ci: {uri-project}/actions?query=branch%3Amain
9
9
  :uri-issues: {uri-project}/issues
10
10
  :uri-rvm: https://rvm.io
11
11
 
12
12
  image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg[project chat,link=https://asciidoctor.zulipchat.com/]
13
13
  image:https://img.shields.io/gem/v/asciidoctor-epub3.svg[Latest Release,link={uri-gem}]
14
- image:{uri-project}/workflows/CI/badge.svg?branch=master[GitHub Actions,link={uri-ci}]
14
+ image:{uri-project}/workflows/CI/badge.svg?branch=main[GitHub Actions,link={uri-ci}]
15
15
 
16
16
  {project-name} is a set of Asciidoctor extensions for converting AsciiDoc documents directly to the EPUB3 and KF8/MOBI e-book formats.
17
17
 
18
18
  == Documentation
19
19
 
20
- Detailed installation and usage instructions can be found on the https://docs.asciidoctor.org/asciidoctor-epub3/latest/[Asciidoctor Docs site].
20
+ Detailed installation and usage instructions can be found on the https://docs.asciidoctor.org/epub3-converter/latest/[Asciidoctor Docs site].
21
21
 
22
22
  == Installation
23
23
 
24
24
  {project-name} is published on RubyGems.org.
25
- {project-name} requires Ruby 2.3 or newer.
25
+ {project-name} requires Ruby 2.6 or newer.
26
26
  You can install the published gem using the following command:
27
27
 
28
28
  [source,shell script]
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  $default_tasks = [] # rubocop:disable Style/GlobalVars
4
- Dir.glob('tasks/*.rake').each {|file| load file }
4
+ Dir.glob('tasks/*.rake').each { |file| load file }
5
5
  task default: $default_tasks unless $default_tasks.empty? # rubocop:disable Style/GlobalVars
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.version = Asciidoctor::Epub3::VERSION
9
9
 
10
10
  s.summary = 'Converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book formats'
11
- s.description = <<-EOS
12
- An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book archives.
11
+ s.description = <<~EOS
12
+ An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book archives.
13
13
  EOS
14
14
 
15
15
  s.authors = ['Dan Allen', 'Sarah White']
@@ -17,30 +17,33 @@ An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/M
17
17
  s.homepage = 'https://github.com/asciidoctor/asciidoctor-epub3'
18
18
  s.license = 'MIT'
19
19
 
20
- s.required_ruby_version = '>= 2.4.0'
20
+ s.required_ruby_version = '>= 2.6.0'
21
21
 
22
22
  files = begin
23
- (result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split %(\0)).empty? ? Dir['**/*'] : result
24
- rescue
23
+ (result = Open3.popen3('git ls-files -z') { |_, out| out.read }.split %(\0)).empty? ? Dir['**/*'] : result
24
+ rescue StandardError
25
25
  Dir['**/*']
26
26
  end
27
- s.files = files.grep %r/^(?:(?:data\/(?:fonts|images|styles)|lib)\/.+|Gemfile|Rakefile|LICENSE|(?:CHANGELOG|NOTICE|README)\.adoc|\.yardopts|#{s.name}\.gemspec)$/
28
- s.executables = %w(asciidoctor-epub3 adb-push-ebook)
29
- s.test_files = s.files.grep(/^(?:test|spec|feature)\/.*$/)
27
+ s.files = files.grep %r{^(?:(?:data/(?:fonts|images|styles)|lib)/.+|Gemfile|Rakefile|LICENSE|(?:CHANGELOG|NOTICE|README)\.adoc|\.yardopts|#{s.name}\.gemspec)$}
28
+ s.executables = %w[asciidoctor-epub3 adb-push-ebook]
30
29
 
31
30
  s.require_paths = ['lib']
32
31
 
33
- s.add_development_dependency 'asciidoctor-diagram', '>= 1.5.0', '< 3.0.0'
32
+ s.add_development_dependency 'asciidoctor-diagram', '~> 2.0'
34
33
  s.add_development_dependency 'asciimath', '~> 2.0'
35
34
  s.add_development_dependency 'coderay', '~> 1.1.0'
36
- s.add_development_dependency 'pygments.rb', '~> 2.2.0'
37
- s.add_development_dependency 'rake', '~> 13.0.0'
35
+ s.add_development_dependency 'pygments.rb', '~> 2.4.0'
36
+ s.add_development_dependency 'rake', '~> 13.1.0'
38
37
  s.add_development_dependency 'rouge', '~> 3.0'
39
- s.add_development_dependency 'rspec', '~> 3.10.0'
40
- s.add_development_dependency 'rubocop', '~> 0.81.0'
41
- s.add_development_dependency 'rubocop-rspec', '~> 1.41.0'
38
+ s.add_development_dependency 'rspec', '~> 3.12.0'
39
+ s.add_development_dependency 'rubocop', '~> 1.50.2'
40
+ s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
41
+ s.add_development_dependency 'rubocop-rspec', '~> 2.20.0'
42
42
 
43
- s.add_runtime_dependency 'asciidoctor', '>= 1.5.6', '< 3.0.0'
43
+ s.add_runtime_dependency 'asciidoctor', '~> 2.0'
44
44
  s.add_runtime_dependency 'gepub', '~> 1.0.0'
45
45
  s.add_runtime_dependency 'mime-types', '~> 3.0'
46
+
47
+ # TODO: switch to 'sass-embedded' when we drop Ruby 2.5 support
48
+ s.add_runtime_dependency 'sass'
46
49
  end
data/bin/adb-push-ebook CHANGED
@@ -4,10 +4,10 @@
4
4
  ADB = ENV['ADB'] || 'adb'
5
5
  TARGETS = {
6
6
  '.epub' => '/sdcard/',
7
- '.mobi' => '/sdcard/Android/data/com.amazon.kindle/files/',
8
- }
7
+ '.mobi' => '/sdcard/Android/data/com.amazon.kindle/files/'
8
+ }.freeze
9
9
 
10
- unless ::File.executable? ADB
10
+ unless File.executable? ADB
11
11
  warn %(adb-push-ebook: `adb` not found.\nPlease set the ADB environment variable or add `adb` to your PATH.)
12
12
  exit 1
13
13
  end
@@ -17,19 +17,21 @@ require 'shellwords'
17
17
 
18
18
  payload_file = ARGV[0] || '_output/sample-book'
19
19
 
20
- if (payload_file_ext = File.extname payload_file).empty?
21
- transfers = TARGETS.map do |(ext, target_dir)|
22
- {
23
- src: %(#{payload_file}#{ext}),
24
- dest: target_dir,
25
- }
26
- end
27
- else
28
- transfers = [{ src: payload_file, dest: TARGETS[payload_file_ext] }]
29
- end
20
+ transfers = if (payload_file_ext = File.extname payload_file).empty?
21
+ TARGETS.map do |(ext, target_dir)|
22
+ {
23
+ src: %(#{payload_file}#{ext}),
24
+ dest: target_dir
25
+ }
26
+ end
27
+ else
28
+ [{ src: payload_file, dest: TARGETS[payload_file_ext] }]
29
+ end
30
30
 
31
31
  transfers.each do |transfer|
32
+ next unless File.file? transfer[:src]
33
+
32
34
  Open3.popen2e Shellwords.join([ADB, 'push', transfer[:src], transfer[:dest]]) do |_input, output, _wait_thr|
33
- output.each {|line| puts line }
34
- end if File.file? transfer[:src]
35
+ output.each { |line| puts line }
36
+ end
35
37
  end
@@ -0,0 +1,90 @@
1
+ $black: #000000;
2
+ $off-black: #101010;
3
+ $deep-gray: #202020;
4
+ $dark-gray: #333332;
5
+ $tuatara-gray: #40403E;
6
+ $medium-gray: #707070;
7
+ $gray: #C8C8C8;
8
+ $off-white: #E0E0E0;
9
+ $papaya-white: #FFF0D4;
10
+ $white: #FFFFFF;
11
+
12
+ $mahogany-red: #C83737;
13
+ $flamingo-orange: #F2642A;
14
+ $light-yellow: #FFC14F;
15
+ $beauty-pink: #F1CECE;
16
+ $cinderella-pink: #FCD9CA;
17
+
18
+ $green: #57AD68;
19
+ $medium-green: #468C54;
20
+
21
+ // =========================
22
+ // === assign the colors ===
23
+ // =========================
24
+
25
+ $body-background: $white;
26
+
27
+ $header-text: $off-black;
28
+ $h4-header-text: $deep-gray;
29
+ $h5-header-text: $dark-gray;
30
+
31
+ $chapter-header-title-text: $dark-gray;
32
+ $chapter-header-title-border: $dark-gray;
33
+ $chapter-header-em: $green;
34
+
35
+ $link-border: $dark-gray;
36
+
37
+ $blockquote-text: $black;
38
+ $para-first-text: $dark-gray;
39
+
40
+ $list-lvl1: $dark-gray;
41
+ $list-lvl2: $green;
42
+ $list-lvl3: $dark-gray;
43
+ $list-lvl4: $green;
44
+
45
+ $footer-context: $dark-gray;
46
+
47
+ $abstract-text: $dark-gray;
48
+ $abstract-link: $dark-gray;
49
+
50
+ $caption-text: $dark-gray;
51
+
52
+ $aside-background: $off-white;
53
+ $aside-border: $gray;
54
+
55
+ $button-text: $black;
56
+ $button-shadow: $gray;
57
+
58
+ $pre-text: $off-black;
59
+ $pre-background: $off-white;
60
+ $pre-border: $gray;
61
+
62
+ $kbd-background: $off-white;
63
+ $kbd-border: $gray;
64
+
65
+ $mark-text: $black;
66
+ $mark-background: $light-yellow;
67
+
68
+ $last-mark-text: $green;
69
+
70
+ $i-conum-text: $medium-green;
71
+
72
+ $table-border: $medium-gray;
73
+
74
+ $note-border: $light-yellow;
75
+ $note-background: $papaya-white;
76
+
77
+ $tip-border: $tuatara-gray;
78
+ $tip-background: $off-white;
79
+
80
+ $caution-border: $medium-gray;
81
+ $caution-background: $off-white;
82
+
83
+ $warning-border: $mahogany-red;
84
+ $warning-background: $beauty-pink;
85
+
86
+ $important-border: $flamingo-orange;
87
+ $important-background: $cinderella-pink;
88
+
89
+ $about-author-border: $gray;
90
+ $headshot-border: $medium-gray;
@@ -0,0 +1,54 @@
1
+ /* educate older readers about tags introduced in HTML5 */
2
+ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
3
+ display: block;
4
+ }
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ border: 0;
20
+ font: inherit;
21
+ font-size: 100%;
22
+ margin: 0;
23
+ padding: 0;
24
+ vertical-align: baseline;
25
+ }
26
+
27
+ @page {
28
+ margin: 0;
29
+ }
30
+
31
+ *, *:before, *:after {
32
+ box-sizing: border-box;
33
+ }
34
+
35
+ body {
36
+ line-height: 1;
37
+ }
38
+
39
+ blockquote, q {
40
+ quotes: none;
41
+ }
42
+
43
+ img {
44
+ max-width: 100%;
45
+ }
46
+
47
+ ol, ul {
48
+ list-style: none;
49
+ }
50
+
51
+ table {
52
+ border-collapse: collapse;
53
+ border-spacing: 0;
54
+ }
@@ -1,45 +1,15 @@
1
- /* @page is for EPUB2 only */
2
- @page {
3
- margin: 0;
4
- }
5
-
6
- body.calibre-desktop {
7
- padding: 20pt 0 !important;
8
- }
9
-
10
- body.calibre-desktop > section {
11
- margin: 0 25pt;
12
- }
13
-
14
1
  /* Gitden & Namo default to 16px font-size; bump it to 19px (118.75%) */
15
2
  body.gitden-reader,
16
3
  body.namo-epub-library {
17
4
  font-size: 118.75%;
18
5
  }
19
6
 
20
- /* Gitden doesn't give us much margin, so let's roughly match Aldiko and Kindle (narrow setting) */
21
- body.gitden-reader {
22
- margin: 0 5pt !important;
23
- }
24
-
25
- /* Namo has the same margin problem, except setting side margins doesn't work */
26
- /*body.namo-epub-library > section.chapter {
27
- margin: 0 5pt;
28
- }*/
29
-
30
7
  /* Use tighter margins and smaller font (18px) on phones (Nexus 4 and smaller) */
31
8
  @media only screen and (max-device-width: 768px) and (max-device-height: 1280px), only screen and (max-device-width: 1280px) and (max-device-height: 768px) {
32
9
  body.gitden-reader,
33
10
  body.namo-epub-library {
34
11
  font-size: 112.5%;
35
12
  }
36
-
37
- /*body.gitden-reader {
38
- margin: 0 5pt !important;
39
- }*/
40
- /*body.namo-epub-library > section.chapter {
41
- margin: 0 5pt;
42
- }*/
43
13
  }
44
14
 
45
15
  body.gitden-reader pre {
@@ -55,7 +25,7 @@ h1 :not(code), h2 :not(code), h3:not(.list-heading) :not(code), h4 :not(code), h
55
25
  }
56
26
 
57
27
  /* QUESTION what about nested elements inside code? */
58
- body code, body kbd, body pre, pre :not(code) {
28
+ body code, body kbd, body :not(.verse) > pre, :not(.verse) > pre :not(code) {
59
29
  /* !important required to override custom font setting in Kindle / Gitden / Namo */
60
30
  /* Gitden requires the extra weight of a parent selector */
61
31
  /* Kindle and Gitden require the override on pre child elements */