asciidoctor-epub3 1.0.0.alpha.1 → 1.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/styles/epub3.css +2 -2
- data/lib/asciidoctor-epub3/converter.rb +15 -18
- data/lib/asciidoctor-epub3/packager.rb +2 -2
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a405770a51e0bc06e16b4a484203d25cfeb704
|
4
|
+
data.tar.gz: 63fdd03371885ea40a82575db6e241ec64c75d00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db122ccbf5baccd60a59e1e482b98132ed5fb3b0097c2d00311e460da24d44a6ab8be76a7202ae49a4c8f112535ba4d9b32d8b7b41f382b492f297ef00a34e9
|
7
|
+
data.tar.gz: 0f960257b627d5b7441045585ab267e60ab3292126a0cd7fd4929f2402c5d08bc3ffa1dee46d16ca76b86f21e5154487ba0e5f817d707a83a5e3eca57ae3ef55
|
data/data/styles/epub3.css
CHANGED
@@ -910,7 +910,7 @@ blockquote > p:first-of-type::before {
|
|
910
910
|
content: "\f10d"; /* quote-left, a flipped version of the quote-right from Entypo */
|
911
911
|
padding-right: .5em;
|
912
912
|
font-size: 1.5em;
|
913
|
-
line-height: 1.
|
913
|
+
line-height: 1.3;
|
914
914
|
margin-top: -0.5em;
|
915
915
|
vertical-align: text-bottom;
|
916
916
|
}
|
@@ -1040,7 +1040,7 @@ aside.admonition::before {
|
|
1040
1040
|
display: block;
|
1041
1041
|
font-family: "FontAwesome";
|
1042
1042
|
font-size: 2em;
|
1043
|
-
line-height:
|
1043
|
+
line-height: 1;
|
1044
1044
|
width: 1em;
|
1045
1045
|
text-align: center;
|
1046
1046
|
margin-bottom: -0.25em;
|
@@ -4,8 +4,9 @@ require_relative 'font_icon_map'
|
|
4
4
|
|
5
5
|
module Asciidoctor
|
6
6
|
module Epub3
|
7
|
-
#
|
7
|
+
# tried 8288, but it didn't work in older readers
|
8
8
|
WordJoiner = [65279].pack 'U*'
|
9
|
+
WordJoinerRx = RUBY_ENGINE_JRUBY ? /uFEFF/ : WordJoiner
|
9
10
|
|
10
11
|
# Public: The main converter for the epub3 backend that handles packaging the
|
11
12
|
# EPUB3 or KF8 publication file.
|
@@ -94,7 +95,7 @@ class ContentConverter
|
|
94
95
|
|
95
96
|
# TODO aggregate authors of spine document into authors attribute(s) on main document
|
96
97
|
def navigation_document node, spine
|
97
|
-
doctitle_sanitized = (
|
98
|
+
doctitle_sanitized = (node.doctitle sanitize: true, use_fallback: true).gsub WordJoinerRx, ''
|
98
99
|
lines = [%(<!DOCTYPE html>
|
99
100
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="#{lang = (node.attr 'lang', 'en')}" lang="#{lang}">
|
100
101
|
<head>
|
@@ -109,7 +110,7 @@ class ContentConverter
|
|
109
110
|
<h2>#{node.attr 'toc-title'}</h2>
|
110
111
|
<ol>)]
|
111
112
|
spine.each do |item|
|
112
|
-
lines << %(<li><a href="#{item.id || (item.attr 'docname')}.xhtml">#{(
|
113
|
+
lines << %(<li><a href="#{item.id || (item.attr 'docname')}.xhtml">#{(item.doctitle sanitize: true, use_fallback: true).gsub WordJoinerRx, ''}</a></li>)
|
113
114
|
end
|
114
115
|
lines << %(</ol>
|
115
116
|
</nav>
|
@@ -120,23 +121,19 @@ class ContentConverter
|
|
120
121
|
|
121
122
|
def document node
|
122
123
|
docid = node.id
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
# HACK until we get proper handling of title-only in CSS
|
129
|
-
title = ''
|
130
|
-
subtitle = doctitle
|
131
|
-
end
|
124
|
+
|
125
|
+
if (doctitle = node.doctitle partition: true, sanitize: true, use_fallback: true).subtitle?
|
126
|
+
title = doctitle.main
|
127
|
+
title_upper = title.upcase
|
128
|
+
subtitle = doctitle.subtitle
|
132
129
|
else
|
133
130
|
# HACK until we get proper handling of title-only in CSS
|
134
|
-
title = ''
|
135
|
-
subtitle =
|
131
|
+
title = title_upper = ''
|
132
|
+
subtitle = doctitle.combined
|
136
133
|
end
|
137
|
-
subtitle_formatted = subtitle.gsub(WordJoiner, '').split(' ').map {|w| %(<b>#{w}</b>) } * ' '
|
138
134
|
|
139
|
-
|
135
|
+
doctitle_sanitized = (node.doctitle sanitize: true, use_fallback: true).gsub WordJoinerRx, ''
|
136
|
+
subtitle_formatted = subtitle.gsub(WordJoinerRx, '').split(' ').map {|w| %(<b>#{w}</b>) } * ' '
|
140
137
|
# FIXME make this uppercase routine more intelligent, less fragile
|
141
138
|
subtitle_formatted_upper = subtitle_formatted.upcase
|
142
139
|
.gsub(UppercaseTagRx) { %(<#{$1}#{$2.downcase}>) }
|
@@ -794,7 +791,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
794
791
|
if target == :plain && (sanitized.include? ';')
|
795
792
|
sanitized = sanitized.gsub(CharEntityRx) { [$1.to_i].pack('U*') }.gsub(FromHtmlSpecialCharsRx, FromHtmlSpecialCharsMap)
|
796
793
|
elsif target == :attribute
|
797
|
-
sanitized = sanitized.gsub(
|
794
|
+
sanitized = sanitized.gsub(WordJoinerRx, '').gsub('"', '"')
|
798
795
|
end
|
799
796
|
sanitized
|
800
797
|
end
|
@@ -817,7 +814,7 @@ class DocumentIdGenerator
|
|
817
814
|
def generate_id doc
|
818
815
|
unless (id = doc.id)
|
819
816
|
id = if doc.header?
|
820
|
-
doc.doctitle(sanitize:
|
817
|
+
doc.doctitle(sanitize: true).gsub(WordJoinerRx, '').downcase.delete(':').tr_s(' ', '-').tr_s('-', '-')
|
821
818
|
elsif (first_section = doc.first_section)
|
822
819
|
first_section.id
|
823
820
|
else
|
@@ -8,7 +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
|
-
|
11
|
+
WordJoinerRx = Epub3::WordJoinerRx
|
12
12
|
FromHtmlSpecialCharsMap = ContentConverter::FromHtmlSpecialCharsMap
|
13
13
|
FromHtmlSpecialCharsRx = ContentConverter::FromHtmlSpecialCharsRx
|
14
14
|
CsvDelimiterRx = /\s*,\s*/
|
@@ -27,7 +27,7 @@ module GepubBuilderMixin
|
|
27
27
|
when :plain
|
28
28
|
doc.doctitle(sanitize: true).gsub(FromHtmlSpecialCharsRx, FromHtmlSpecialCharsMap)
|
29
29
|
end
|
30
|
-
title.gsub
|
30
|
+
title.gsub WordJoinerRx, ''
|
31
31
|
end
|
32
32
|
|
33
33
|
def add_theme_assets doc
|
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.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.2
|
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: 2014-
|
12
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.5.0
|
34
|
+
version: 1.5.0
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 1.6.0
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.5.0
|
44
|
+
version: 1.5.0
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.6.0
|