asciidoctor-epub3 1.5.0.alpha.8 → 1.5.0.alpha.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/CHANGELOG.adoc +21 -13
- data/LICENSE.adoc +1 -1
- data/README.adoc +26 -16
- data/asciidoctor-epub3.gemspec +7 -10
- data/lib/asciidoctor-epub3/converter.rb +48 -48
- data/lib/asciidoctor-epub3/packager.rb +5 -4
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +39 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8c660366a3ffa12ff1f0b2638413c240da220d07949a69493f4743c42287f5c
|
4
|
+
data.tar.gz: 229d4a8ea185962d0c9fb7563423905fad27c62a6a20a126e44aabb935da0c98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2c23900d2e5d2c08b16ccb2d0e80e62f3f3da8623a3cc84dae1d65620fd4ff64675124d8a08be2aa4da2c6043d7399e131e1a2a6b582b8d23ada23c4c598ad
|
7
|
+
data.tar.gz: 6097d5e1f9a1942bd8933b23c94b26cff099025345cf030296584d848ebbbaade4669c14bcf369ab07fd65a8ecba736d9bfded24cc2d62930501c0883ada6d7a
|
data/.yardopts
ADDED
data/CHANGELOG.adoc
CHANGED
@@ -5,21 +5,29 @@
|
|
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.alpha.9 (2019-04-04) - @mojavelinux
|
9
|
+
|
10
|
+
* allow converter to be used with Asciidoctor 2 (#185)
|
11
|
+
* upgrade gepub (and, indirectly, nokogiri) (#177)
|
12
|
+
* add support for start attribute on ordered list
|
13
|
+
* don't add end mark to chapter when publication-type is book (#163)
|
14
|
+
* drop unsupported versions of Ruby from CI matrix
|
15
|
+
|
8
16
|
== 1.5.0.alpha.8 (2018-02-20) - @mojavelinux
|
9
17
|
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
18
|
+
* include inline images in EPUB3 archive (#5)
|
19
|
+
* allow chapter to begin with level-1 section title by adding support for negative leveloffset (#107)
|
20
|
+
* don't transform the chapter title to uppercase (rely on CSS only) (#97)
|
21
|
+
* set correct mimetype for TTF files (#120)
|
22
|
+
* implement support for the custom xrefstyle for references within a chapter (#132)
|
23
|
+
* show correct path of front cover image and the current document when missing (#124)
|
24
|
+
* retain ID of block image (#141)
|
25
|
+
* retain ID of example block (#143)
|
26
|
+
* retain ID of admonition block (#146)
|
27
|
+
* transfer role specified on block image to output (#145)
|
28
|
+
* handle nil response from pygments.rb (#156)
|
29
|
+
* invert the colors for the chapter title (use black on white) (#96)
|
30
|
+
* darken font on Kindle Paperwhite devices (#67)
|
23
31
|
|
24
32
|
== 1.5.0.alpha.7 (2017-04-18) - @mojavelinux
|
25
33
|
|
data/LICENSE.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.The MIT License
|
2
2
|
....
|
3
|
-
Copyright (C) 2014-
|
3
|
+
Copyright (C) 2014-2019 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/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
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.0.alpha.
|
3
|
+
v1.5.0.alpha.9, 2019-04-04
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -404,7 +404,7 @@ The master document is assumed to be a book and each chapter an article.
|
|
404
404
|
|
405
405
|
|publication-type
|
406
406
|
|Used to control the inclusion of special content in the generated HTML.
|
407
|
-
If set to a value other than book, the byline information (author and avatar) is included below the chapter header.
|
407
|
+
If set to a value other than book, the byline information (author and avatar) is included below the chapter header and a typographic end mark is added at the end of the last paragraph.
|
408
408
|
Suggested values include: book (default), anthology, magazine, journal, article.
|
409
409
|
|===
|
410
410
|
|
@@ -777,11 +777,33 @@ To see all of the workarounds and why we chose certain style options, check out
|
|
777
777
|
* `text-rendering: optimizeLegibility` causes file to be rejected by KFP (and causes the text to disappear in some previewers)
|
778
778
|
* 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
|
779
779
|
|
780
|
+
=== Kindle Direct Publishing
|
781
|
+
|
782
|
+
If you want to publish your book to the Amazon Kindle store, and have your styles and fonts preserved, you must use https://kdp.amazon.com[Kindle Direct Publishing].
|
783
|
+
No other method of publishing to the Amazon Kindle store will leave your book intact.
|
784
|
+
|
785
|
+
This workflow also allows you to preview the book the way your readers will see it.
|
786
|
+
So it's a good way to acceptance test your custom styles to discover which ones are honored and which ones are ignored.
|
787
|
+
|
788
|
+
==== Look Inside
|
789
|
+
|
790
|
+
The Amazon Kindle store offers a “Look Inside” feature for reader.
|
791
|
+
This so-called feature aims to gives readers a glimpse at the contents of the book.
|
792
|
+
Sadly, it does no such thing.
|
793
|
+
Instead, it shows pages from the legacy MOBI document that kindlegen adds to your e-book file, not the higher fidelity KF8 document.
|
794
|
+
This means the preview won't look at all like what the Kindle reader or application will actually show.
|
795
|
+
Custom fonts, font-based icons, and most styles will be missing.
|
796
|
+
|
797
|
+
This situation is unfortunate for authors.
|
798
|
+
What we recommend is to complain loudly to Amazon that they are hurting your sales by displaying a crippled version of your product.
|
799
|
+
Tell them that under no circumstances should they show an altered version of your product.
|
800
|
+
Another option is to contact Amazon to opt-out of this program.
|
801
|
+
|
780
802
|
=== Send to Kindle
|
781
803
|
|
782
804
|
WARNING: Don't use it!
|
783
805
|
|
784
|
-
{uri-send-to-kindle}[
|
806
|
+
{uri-send-to-kindle}[Send to Kindle] is a tempting choice for transferring MOBI files to a Kindle device.
|
785
807
|
However, it's utterly broken.
|
786
808
|
If you use this tool, don't be surprised if you see missing font-based icons, default fonts, and other font and style errors in your manuscript.
|
787
809
|
It's known to strip out all the font files and break the encoding of the document.
|
@@ -792,18 +814,6 @@ Once transferred, Whispersync will detect the new file (usually looking in the B
|
|
792
814
|
It's important to note that “Send to Kindle” is not reflective of the experience readers will have when shopping in the Kindle store.
|
793
815
|
If you use Kindle Direct Publishing (KDP) to publish your book, the integrity of your book will be preserved (to the degree that Amazon allows).
|
794
816
|
|
795
|
-
=== Look Inside
|
796
|
-
|
797
|
-
The Amazon Kindle store has a “Look Inside” feature, which aims to gives readers a glimpse at the contents of the book.
|
798
|
-
Sadly, it does no such thing.
|
799
|
-
Instead, it shows pages from the legacy MOBI document that kindlegen adds to your e-book file, not the higher fidelity KF8 document.
|
800
|
-
Therefore, the preview won't look at all like what the Kindle reader or application will actually show.
|
801
|
-
Custom fonts, font-based icons, and most styles will be missing.
|
802
|
-
|
803
|
-
This situation is unfortunate for authors.
|
804
|
-
What I recommend is to complain loudly to Amazon that they are hurting your sales by displaying a crippled version of your product.
|
805
|
-
Another option is to contact Amazon to opt-out of this so-called feature.
|
806
|
-
|
807
817
|
////
|
808
818
|
head-stop (default '.')
|
809
819
|
stack-head role (run-in is default)
|
@@ -953,7 +963,7 @@ endif::[]
|
|
953
963
|
|
954
964
|
== Copyright
|
955
965
|
|
956
|
-
Copyright (C) 2014-
|
966
|
+
Copyright (C) 2014-2019 OpenDevise Inc. and the Asciidoctor Project.
|
957
967
|
Free use of this software is granted under the terms of the MIT License.
|
958
968
|
|
959
969
|
For the full text of the license, see the <<LICENSE#,LICENSE>> file.
|
data/asciidoctor-epub3.gemspec
CHANGED
@@ -16,27 +16,24 @@ An extension for Asciidoctor that converts AsciiDoc documents to EPUB3 and KF8/M
|
|
16
16
|
s.homepage = 'https://github.com/asciidoctor/asciidoctor-epub3'
|
17
17
|
s.license = 'MIT'
|
18
18
|
|
19
|
-
s
|
19
|
+
# NOTE required ruby version is informational only; it's not enforced since it can't be overridden and can cause builds to break
|
20
|
+
#s.required_ruby_version = '>= 2.3.0'
|
20
21
|
|
21
22
|
files = begin
|
22
23
|
(result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split %(\0)).empty? ? Dir['**/*'] : result
|
23
24
|
rescue
|
24
25
|
Dir['**/*']
|
25
26
|
end
|
26
|
-
s.files = files.grep %r/^(?:(?:data\/(?:fonts|images|styles)|lib)\/.+|Gemfile|Rakefile|(?:CHANGELOG|LICENSE|NOTICE|README)\.adoc|#{s.name}\.gemspec)$/
|
27
|
+
s.files = files.grep %r/^(?:(?:data\/(?:fonts|images|styles)|lib)\/.+|Gemfile|Rakefile|(?:CHANGELOG|LICENSE|NOTICE|README)\.adoc|\.yardopts|#{s.name}\.gemspec)$/
|
27
28
|
s.executables = %w(asciidoctor-epub3 adb-push-ebook)
|
28
29
|
s.test_files = s.files.grep(/^(?:test|spec|feature)\/.*$/)
|
29
30
|
|
30
31
|
s.require_paths = ['lib']
|
31
32
|
|
32
|
-
s.
|
33
|
-
s.rdoc_options = ['--charset=UTF-8', '--title="Asciidoctor EPUB3"', '--main=README.adoc', '-ri']
|
34
|
-
s.extra_rdoc_files = ['CHANGELOG.adoc', 'LICENSE.adoc', 'NOTICE.adoc', 'README.adoc']
|
33
|
+
s.add_development_dependency 'rake', '~> 12.3.2'
|
35
34
|
|
36
|
-
s.
|
37
|
-
|
38
|
-
|
39
|
-
s.add_runtime_dependency 'asciidoctor', '~> 1.5.0'
|
40
|
-
s.add_runtime_dependency 'gepub', '~> 0.6.9.2'
|
35
|
+
s.add_runtime_dependency 'asciidoctor', '>= 1.5.0', '< 3.0.0'
|
36
|
+
s.add_runtime_dependency 'gepub', '~> 1.0.2'
|
41
37
|
s.add_runtime_dependency 'thread_safe', '~> 0.3.6'
|
38
|
+
s.add_runtime_dependency 'concurrent-ruby', '~> 1.1.5'
|
42
39
|
end
|
@@ -50,14 +50,15 @@ class ContentConverter
|
|
50
50
|
|
51
51
|
register_for 'epub3-xhtml5'
|
52
52
|
|
53
|
-
|
53
|
+
LF = ?\n
|
54
54
|
NoBreakSpace = ' '
|
55
55
|
ThinNoBreakSpace = ' '
|
56
56
|
RightAngleQuote = '›'
|
57
57
|
CalloutStartNum = %(\u2460)
|
58
58
|
|
59
|
-
XmlElementRx = /<\/?.+?>/
|
60
59
|
CharEntityRx = /&#(\d{2,6});/
|
60
|
+
XmlElementRx = /<\/?.+?>/
|
61
|
+
TrailingPunctRx = /[[:punct:]]$/
|
61
62
|
|
62
63
|
FromHtmlSpecialCharsMap = {
|
63
64
|
'<' => '<',
|
@@ -97,6 +98,7 @@ class ContentConverter
|
|
97
98
|
|
98
99
|
def document node
|
99
100
|
docid = node.id
|
101
|
+
pubtype = node.attr 'publication-type', 'book'
|
100
102
|
|
101
103
|
if (doctitle = node.doctitle partition: true, use_fallback: true).subtitle?
|
102
104
|
title = %(#{doctitle.main} )
|
@@ -110,33 +112,33 @@ class ContentConverter
|
|
110
112
|
doctitle_sanitized = (node.doctitle sanitize: true, use_fallback: true).to_s
|
111
113
|
subtitle_formatted = subtitle.split.map {|w| %(<b>#{w}</b>) } * ' '
|
112
114
|
|
113
|
-
if
|
114
|
-
byline =
|
115
|
+
if pubtype == 'book'
|
116
|
+
byline = ''
|
115
117
|
else
|
116
118
|
author = node.attr 'author'
|
117
119
|
username = node.attr 'username', 'default'
|
118
120
|
imagesdir = (node.references[:spine].attr 'imagesdir', '.').chomp '/'
|
119
|
-
imagesdir =
|
120
|
-
byline = %(<p class="byline"><img src="#{imagesdir}avatars/#{username}.jpg"/> <b class="author">#{author}</b></p>#{
|
121
|
+
imagesdir = imagesdir == '.' ? '' : %(#{imagesdir}/)
|
122
|
+
byline = %(<p class="byline"><img src="#{imagesdir}avatars/#{username}.jpg"/> <b class="author">#{author}</b></p>#{LF})
|
121
123
|
end
|
122
124
|
|
123
|
-
mark_last_paragraph node
|
125
|
+
mark_last_paragraph node unless pubtype == 'book'
|
124
126
|
content = node.content
|
125
127
|
|
126
128
|
# NOTE must run after content is resolved
|
127
129
|
# TODO perhaps create dynamic CSS file?
|
128
130
|
if @icon_names.empty?
|
129
|
-
icon_css_head = icon_css_scoped =
|
131
|
+
icon_css_head = icon_css_scoped = ''
|
130
132
|
else
|
131
133
|
icon_defs = @icon_names.map {|name|
|
132
134
|
%(.i-#{name}::before { content: "#{FontIconMap[name.tr('-', '_').to_sym]}"; })
|
133
|
-
} *
|
135
|
+
} * LF
|
134
136
|
icon_css_head = %(<style>
|
135
137
|
#{icon_defs}
|
136
138
|
</style>
|
137
139
|
)
|
138
140
|
# NOTE Namo Pubtree requires icon CSS to be repeated inside <body> (or in a linked stylesheet); wrap in div to hide from Aldiko
|
139
|
-
icon_css_scoped = (node.attr? 'ebook-format', 'kf8') ?
|
141
|
+
icon_css_scoped = (node.attr? 'ebook-format', 'kf8') ? '' : %(<div style="display: none" aria-hidden="true"><style scoped="scoped">
|
140
142
|
#{icon_defs}
|
141
143
|
</style></div>
|
142
144
|
)
|
@@ -188,7 +190,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
188
190
|
</body>
|
189
191
|
</html>'
|
190
192
|
|
191
|
-
lines *
|
193
|
+
lines * LF
|
192
194
|
end
|
193
195
|
|
194
196
|
# NOTE embedded is used for AsciiDoc table cell content
|
@@ -198,13 +200,13 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
198
200
|
|
199
201
|
def section node
|
200
202
|
hlevel = node.level + 1
|
201
|
-
epub_type_attr = node.special ? %( epub:type="#{node.sectname}") :
|
203
|
+
epub_type_attr = node.special ? %( epub:type="#{node.sectname}") : ''
|
202
204
|
div_classes = [%(sect#{node.level}), node.role].compact
|
203
205
|
title = node.title
|
204
206
|
title_sanitized = xml_sanitize title
|
205
207
|
if node.document.header? || node.level != 1 || node != node.document.first_section
|
206
208
|
%(<section class="#{div_classes * ' '}" title="#{title_sanitized}"#{epub_type_attr}>
|
207
|
-
<h#{hlevel} id="#{node.id}">#{title}</h#{hlevel}>#{(content = node.content).empty? ?
|
209
|
+
<h#{hlevel} id="#{node.id}">#{title}</h#{hlevel}>#{(content = node.content).empty? ? '' : %[
|
208
210
|
#{content}]}
|
209
211
|
</section>)
|
210
212
|
else
|
@@ -247,8 +249,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
247
249
|
role = node.role
|
248
250
|
# stack-head is the alternative to the default, inline-head (where inline means "run-in")
|
249
251
|
head_stop = node.attr 'head-stop', (role && (node.has_role? 'stack-head') ? nil : '.')
|
250
|
-
#
|
251
|
-
head = node.title? ? %(<strong class="head">#{title = node.title}#{head_stop && title !~ /[[:punct:]]$/ ? head_stop : nil}</strong> ) : nil
|
252
|
+
head = node.title? ? %(<strong class="head">#{title = node.title}#{head_stop && title !~ TrailingPunctRx ? head_stop : ''}</strong> ) : ''
|
252
253
|
if role
|
253
254
|
node.set_option 'hardbreaks' if node.has_role? 'signature'
|
254
255
|
%(<p class="#{role}">#{head}#{node.content}</p>)
|
@@ -267,7 +268,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
267
268
|
end
|
268
269
|
|
269
270
|
def admonition node
|
270
|
-
id_attr = node.id ? %( id="#{node.id}") :
|
271
|
+
id_attr = node.id ? %( id="#{node.id}") : ''
|
271
272
|
if node.title?
|
272
273
|
title = node.title
|
273
274
|
title_sanitized = xml_sanitize title
|
@@ -276,7 +277,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
276
277
|
)
|
277
278
|
else
|
278
279
|
title_attr = %( title="#{node.caption}")
|
279
|
-
title_el =
|
280
|
+
title_el = ''
|
280
281
|
end
|
281
282
|
|
282
283
|
type = node.attr 'name'
|
@@ -296,9 +297,9 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
296
297
|
end
|
297
298
|
|
298
299
|
def example node
|
299
|
-
id_attr = node.id ? %( id="#{node.id}") :
|
300
|
+
id_attr = node.id ? %( id="#{node.id}") : ''
|
300
301
|
title_div = node.title? ? %(<div class="example-title">#{node.title}</div>
|
301
|
-
) :
|
302
|
+
) : ''
|
302
303
|
%(<div#{id_attr} class="example">
|
303
304
|
#{title_div}<div class="example-content">
|
304
305
|
#{convert_content node}
|
@@ -308,7 +309,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
308
309
|
|
309
310
|
def floating_title node
|
310
311
|
tag_name = %(h#{node.level + 1})
|
311
|
-
id_attribute = node.id ? %( id="#{node.id}") :
|
312
|
+
id_attribute = node.id ? %( id="#{node.id}") : ''
|
312
313
|
%(<#{tag_name}#{id_attribute} class="#{['discrete', node.role].compact * ' '}">#{node.title}</#{tag_name}>)
|
313
314
|
end
|
314
315
|
|
@@ -317,7 +318,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
317
318
|
figure_classes << 'coalesce' if node.option? 'unbreakable'
|
318
319
|
pre_classes = node.style == 'source' ? ['source', %(language-#{node.attr 'language'})] : ['screen']
|
319
320
|
title_div = node.title? ? %(<figcaption>#{node.captioned_title}</figcaption>
|
320
|
-
) :
|
321
|
+
) : ''
|
321
322
|
# patches conums to fix extra or missing leading space
|
322
323
|
# TODO remove patch once upgrading to Asciidoctor 1.5.6
|
323
324
|
%(<figure class="#{figure_classes * ' '}">
|
@@ -356,7 +357,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
356
357
|
footer_content << %(<span class="context">#{node.title}</span>)
|
357
358
|
end
|
358
359
|
|
359
|
-
footer_tag = footer_content.empty? ?
|
360
|
+
footer_tag = footer_content.empty? ? '' : %(
|
360
361
|
<footer>~ #{footer_content * ' '}</footer>)
|
361
362
|
content = (convert_content node).strip.
|
362
363
|
sub(OpenParagraphTagRx, '<p><span class="open-quote">“</span>').
|
@@ -383,7 +384,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
383
384
|
end
|
384
385
|
|
385
386
|
footer_tag = footer_content.size > 0 ? %(
|
386
|
-
<span class="attribution">~ #{footer_content * ', '}</span>) :
|
387
|
+
<span class="attribution">~ #{footer_content * ', '}</span>) : ''
|
387
388
|
%(<div#{id_attr}#{class_attr}>
|
388
389
|
<pre>#{node.content}#{footer_tag}</pre>
|
389
390
|
</div>)
|
@@ -399,8 +400,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
399
400
|
title_el = %(<h2>#{title}</h2>
|
400
401
|
)
|
401
402
|
else
|
402
|
-
title_attr =
|
403
|
-
title_el = nil
|
403
|
+
title_attr = title_el = ''
|
404
404
|
end
|
405
405
|
|
406
406
|
%(<aside class="#{classes * ' '}"#{title_attr} epub:type="sidebar">
|
@@ -413,7 +413,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
413
413
|
def table node
|
414
414
|
lines = [%(<div class="table">)]
|
415
415
|
lines << %(<div class="content">)
|
416
|
-
table_id_attr = node.id ? %( id="#{node.id}") :
|
416
|
+
table_id_attr = node.id ? %( id="#{node.id}") : ''
|
417
417
|
frame_class = {
|
418
418
|
'all' => 'table-framed',
|
419
419
|
'topbot' => 'table-framed-topbot',
|
@@ -435,7 +435,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
435
435
|
unless (node.option? 'autowidth') && !(node.attr? 'width', nil, false)
|
436
436
|
table_styles << %(width: #{node.attr 'tablepcwidth'}%)
|
437
437
|
end
|
438
|
-
table_style_attr = table_styles.size > 0 ? %( style="#{table_styles * '; '}") :
|
438
|
+
table_style_attr = table_styles.size > 0 ? %( style="#{table_styles * '; '}") : ''
|
439
439
|
|
440
440
|
lines << %(<table#{table_id_attr}#{table_class_attr}#{table_style_attr}>)
|
441
441
|
lines << %(<caption>#{node.captioned_title}</caption>) if node.title?
|
@@ -483,10 +483,10 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
483
483
|
if (halign = cell.attr 'valign') && halign != 'top'
|
484
484
|
cell_classes << 'valign-top'
|
485
485
|
end
|
486
|
-
cell_class_attr = cell_classes.size > 0 ? %( class="#{cell_classes * ' '}") :
|
487
|
-
cell_colspan_attr = cell.colspan ? %( colspan="#{cell.colspan}") :
|
488
|
-
cell_rowspan_attr = cell.rowspan ? %( rowspan="#{cell.rowspan}") :
|
489
|
-
cell_style_attr = (node.document.attr? 'cellbgcolor') ? %( style="background-color: #{node.document.attr 'cellbgcolor'}") :
|
486
|
+
cell_class_attr = cell_classes.size > 0 ? %( class="#{cell_classes * ' '}") : ''
|
487
|
+
cell_colspan_attr = cell.colspan ? %( colspan="#{cell.colspan}") : ''
|
488
|
+
cell_rowspan_attr = cell.rowspan ? %( rowspan="#{cell.rowspan}") : ''
|
489
|
+
cell_style_attr = (node.document.attr? 'cellbgcolor') ? %( style="background-color: #{node.document.attr 'cellbgcolor'}") : ''
|
490
490
|
lines << %(<#{cell_tag_name}#{cell_class_attr}#{cell_colspan_attr}#{cell_rowspan_attr}#{cell_style_attr}>#{cell_content}</#{cell_tag_name}>)
|
491
491
|
end
|
492
492
|
lines << '</tr>'
|
@@ -497,7 +497,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
497
497
|
lines << '</table>
|
498
498
|
</div>
|
499
499
|
</div>'
|
500
|
-
lines *
|
500
|
+
lines * LF
|
501
501
|
end
|
502
502
|
|
503
503
|
def colist node
|
@@ -522,18 +522,18 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
522
522
|
subject_stop = node.attr 'subject-stop', (role && (node.has_role? 'stack') ? nil : ':')
|
523
523
|
# QUESTION should we just use itemized-list and ordered-list as the class here? or just list?
|
524
524
|
div_classes = [%(#{style}-list), role].compact
|
525
|
-
list_class_attr = (node.option? 'brief') ? ' class="brief"' :
|
525
|
+
list_class_attr = (node.option? 'brief') ? ' class="brief"' : ''
|
526
526
|
lines << %(<div class="#{div_classes * ' '}">
|
527
|
-
<#{list_tag_name}#{list_class_attr}#{list_tag_name == 'ol' && (node.option? 'reversed') ? ' reversed="reversed"' :
|
527
|
+
<#{list_tag_name}#{list_class_attr}#{list_tag_name == 'ol' && (node.option? 'reversed') ? ' reversed="reversed"' : ''}>)
|
528
528
|
node.items.each do |subjects, dd|
|
529
529
|
# consists of one term (a subject) and supporting content
|
530
530
|
subject = [*subjects].first.text
|
531
531
|
subject_plain = xml_sanitize subject, :plain
|
532
|
-
subject_element = %(<strong class="subject">#{subject}#{subject_stop && subject_plain !~
|
532
|
+
subject_element = %(<strong class="subject">#{subject}#{subject_stop && subject_plain !~ TrailingPunctRx ? subject_stop : ''}</strong>)
|
533
533
|
lines << '<li>'
|
534
534
|
if dd
|
535
535
|
# NOTE: must wrap remaining text in a span to help webkit justify the text properly
|
536
|
-
lines << %(<span class="principal">#{subject_element}#{dd.text? ? %[ <span class="supporting">#{dd.text}</span>] :
|
536
|
+
lines << %(<span class="principal">#{subject_element}#{dd.text? ? %[ <span class="supporting">#{dd.text}</span>] : ''}</span>)
|
537
537
|
lines << dd.content if dd.blocks?
|
538
538
|
else
|
539
539
|
lines << %(<span class="principal">#{subject_element}</span>)
|
@@ -565,19 +565,19 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
565
565
|
lines << '</dl>
|
566
566
|
</div>'
|
567
567
|
end
|
568
|
-
lines *
|
568
|
+
lines * LF
|
569
569
|
end
|
570
570
|
|
571
|
-
# TODO support start attribute
|
572
571
|
def olist node
|
573
572
|
complex = false
|
574
573
|
div_classes = ['ordered-list', node.style, node.role].compact
|
575
574
|
ol_classes = [node.style, ((node.option? 'brief') ? 'brief' : nil)].compact
|
576
|
-
ol_class_attr = ol_classes.empty? ?
|
577
|
-
|
575
|
+
ol_class_attr = ol_classes.empty? ? '' : %( class="#{ol_classes * ' '}")
|
576
|
+
ol_start_attr = (node.attr? 'start') ? %( start="#{node.attr 'start'}") : ''
|
577
|
+
id_attribute = node.id ? %( id="#{node.id}") : ''
|
578
578
|
lines = [%(<div#{id_attribute} class="#{div_classes * ' '}">)]
|
579
579
|
lines << %(<h3 class="list-heading">#{node.title}</h3>) if node.title?
|
580
|
-
lines << %(<ol#{ol_class_attr}#{(node.option? 'reversed') ? ' reversed="reversed"' :
|
580
|
+
lines << %(<ol#{ol_class_attr}#{ol_start_attr}#{(node.option? 'reversed') ? ' reversed="reversed"' : ''}>)
|
581
581
|
node.items.each do |item|
|
582
582
|
lines << %(<li>
|
583
583
|
<span class="principal">#{item.text}</span>)
|
@@ -593,15 +593,15 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
593
593
|
end
|
594
594
|
lines << '</ol>
|
595
595
|
</div>'
|
596
|
-
lines *
|
596
|
+
lines * LF
|
597
597
|
end
|
598
598
|
|
599
599
|
def ulist node
|
600
600
|
complex = false
|
601
601
|
div_classes = ['itemized-list', node.style, node.role].compact
|
602
602
|
ul_classes = [node.style, ((node.option? 'brief') ? 'brief' : nil)].compact
|
603
|
-
ul_class_attr = ul_classes.empty? ?
|
604
|
-
id_attribute = node.id ? %( id="#{node.id}") :
|
603
|
+
ul_class_attr = ul_classes.empty? ? '' : %( class="#{ul_classes * ' '}")
|
604
|
+
id_attribute = node.id ? %( id="#{node.id}") : ''
|
605
605
|
lines = [%(<div#{id_attribute} class="#{div_classes * ' '}">)]
|
606
606
|
lines << %(<h3 class="list-heading">#{node.title}</h3>) if node.title?
|
607
607
|
lines << %(<ul#{ul_class_attr}>)
|
@@ -620,7 +620,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
620
620
|
end
|
621
621
|
lines << '</ul>
|
622
622
|
</div>'
|
623
|
-
lines *
|
623
|
+
lines * LF
|
624
624
|
end
|
625
625
|
|
626
626
|
def image node
|
@@ -660,7 +660,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
660
660
|
<div class="content">
|
661
661
|
<img src="#{node.image_uri node.attr('target')}" #{img_attrs * ' '}/>
|
662
662
|
</div>#{node.title? ? %[
|
663
|
-
<figcaption>#{node.captioned_title}</figcaption>] :
|
663
|
+
<figcaption>#{node.captioned_title}</figcaption>] : ''}
|
664
664
|
</figure>)
|
665
665
|
end
|
666
666
|
|
@@ -688,7 +688,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
688
688
|
refid = %(#{refid}##{refid})
|
689
689
|
id_attr = %( id="xref--#{refdoc_id}")
|
690
690
|
end
|
691
|
-
id_attr =
|
691
|
+
id_attr = '' unless @xrefs_seen.add? refid
|
692
692
|
refdoc = doc.references[:spine_items].find {|it| refdoc_id == (it.id || (it.attr 'docname')) }
|
693
693
|
if refdoc
|
694
694
|
# QUESTION should we invoke xreftext for references in other documents?
|
@@ -703,7 +703,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
|
|
703
703
|
warn %(asciidoctor: WARNING: #{::File.basename(doc.attr 'docfile')}: invalid reference to anchor in unknown chapter: #{refdoc_id})
|
704
704
|
end
|
705
705
|
else
|
706
|
-
id_attr = (@xrefs_seen.add? refid) ? %( id="xref-#{refid}") :
|
706
|
+
id_attr = (@xrefs_seen.add? refid) ? %( id="xref-#{refid}") : ''
|
707
707
|
if (refs = doc.references[:refs])
|
708
708
|
if ::Asciidoctor::AbstractNode === (ref = refs[refid])
|
709
709
|
xreftext = text || ref.xreftext((@xrefstyle ||= (doc.attr 'xrefstyle')))
|
@@ -8,6 +8,7 @@ module Epub3
|
|
8
8
|
module GepubBuilderMixin
|
9
9
|
DATA_DIR = ::File.expand_path(::File.join ::File.dirname(__FILE__), '..', '..', 'data')
|
10
10
|
SAMPLES_DIR = ::File.join DATA_DIR, 'samples'
|
11
|
+
LF = ?\n
|
11
12
|
CharEntityRx = ContentConverter::CharEntityRx
|
12
13
|
XmlElementRx = ContentConverter::XmlElementRx
|
13
14
|
FromHtmlSpecialCharsMap = ContentConverter::FromHtmlSpecialCharsMap
|
@@ -327,7 +328,7 @@ body > svg {
|
|
327
328
|
lines << %(</nav>
|
328
329
|
</body>
|
329
330
|
</html>)
|
330
|
-
lines *
|
331
|
+
lines * LF
|
331
332
|
end
|
332
333
|
|
333
334
|
def nav_level items, depth, state = {}
|
@@ -353,7 +354,7 @@ body > svg {
|
|
353
354
|
state.delete :content_doc_href if item.context == :document
|
354
355
|
end
|
355
356
|
lines << '</ol>'
|
356
|
-
lines *
|
357
|
+
lines * LF
|
357
358
|
end
|
358
359
|
|
359
360
|
# NOTE gepub doesn't support building a ncx TOC with depth > 1, so do it ourselves
|
@@ -379,7 +380,7 @@ body > svg {
|
|
379
380
|
lines[0] = lines[0].sub '%{depth}', %(<meta name="dtb:depth" content="#{state[:max_depth]}"/>)
|
380
381
|
lines << %(</navMap>
|
381
382
|
</ncx>)
|
382
|
-
lines *
|
383
|
+
lines * LF
|
383
384
|
end
|
384
385
|
|
385
386
|
def ncx_level items, depth, state = {}
|
@@ -405,7 +406,7 @@ body > svg {
|
|
405
406
|
lines << %(</navPoint>)
|
406
407
|
state.delete :content_doc_href if item.context == :document
|
407
408
|
end
|
408
|
-
lines *
|
409
|
+
lines * LF
|
409
410
|
end
|
410
411
|
|
411
412
|
def collect_keywords doc, spine
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -9,50 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-04 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:
|
20
|
+
version: 12.3.2
|
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:
|
27
|
+
version: 12.3.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: asciidoctor
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 1.5.0
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.0.0
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
41
44
|
version: 1.5.0
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: gepub
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
52
|
- - "~>"
|
47
53
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
54
|
+
version: 1.0.2
|
49
55
|
type: :runtime
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
52
58
|
requirements:
|
53
59
|
- - "~>"
|
54
60
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
61
|
+
version: 1.0.2
|
56
62
|
- !ruby/object:Gem::Dependency
|
57
63
|
name: thread_safe
|
58
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +73,32 @@ dependencies:
|
|
67
73
|
- - "~>"
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: 0.3.6
|
70
|
-
|
71
|
-
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: concurrent-ruby
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.5
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.1.5
|
90
|
+
description: 'An extension for Asciidoctor that converts AsciiDoc documents to EPUB3
|
91
|
+
and KF8/MOBI (Kindle) e-book archives.
|
92
|
+
|
93
|
+
'
|
72
94
|
email: dan@opendevise.com
|
73
95
|
executables:
|
74
96
|
- asciidoctor-epub3
|
75
97
|
- adb-push-ebook
|
76
98
|
extensions: []
|
77
|
-
extra_rdoc_files:
|
78
|
-
- CHANGELOG.adoc
|
79
|
-
- LICENSE.adoc
|
80
|
-
- NOTICE.adoc
|
81
|
-
- README.adoc
|
99
|
+
extra_rdoc_files: []
|
82
100
|
files:
|
101
|
+
- ".yardopts"
|
83
102
|
- CHANGELOG.adoc
|
84
103
|
- Gemfile
|
85
104
|
- LICENSE.adoc
|
@@ -147,26 +166,21 @@ licenses:
|
|
147
166
|
- MIT
|
148
167
|
metadata: {}
|
149
168
|
post_install_message:
|
150
|
-
rdoc_options:
|
151
|
-
- "--charset=UTF-8"
|
152
|
-
- --title="Asciidoctor EPUB3"
|
153
|
-
- "--main=README.adoc"
|
154
|
-
- "-ri"
|
169
|
+
rdoc_options: []
|
155
170
|
require_paths:
|
156
171
|
- lib
|
157
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
173
|
requirements:
|
159
174
|
- - ">="
|
160
175
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
176
|
+
version: '0'
|
162
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
178
|
requirements:
|
164
179
|
- - ">"
|
165
180
|
- !ruby/object:Gem::Version
|
166
181
|
version: 1.3.1
|
167
182
|
requirements: []
|
168
|
-
|
169
|
-
rubygems_version: 2.7.6
|
183
|
+
rubygems_version: 3.0.3
|
170
184
|
signing_key:
|
171
185
|
specification_version: 4
|
172
186
|
summary: Converts AsciiDoc documents to EPUB3 and KF8/MOBI (Kindle) e-book formats
|