asciidoctor-epub3 1.0.0.alpha.1 → 1.0.0.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e1941b434f39af3cda0c2079d7697d2f6277786
4
- data.tar.gz: 5e32f9533e5cb27a7dca30712fc0928e37c0730a
3
+ metadata.gz: 27a405770a51e0bc06e16b4a484203d25cfeb704
4
+ data.tar.gz: 63fdd03371885ea40a82575db6e241ec64c75d00
5
5
  SHA512:
6
- metadata.gz: 902f72d0b550593264cf3a06f472adcbd5602f9f04f3904a9061416572fce28d34b8dbb49c1157837d9572106abde3a8f62281177df3a36bd6d30b7b47cdecdf
7
- data.tar.gz: ad8745fee5e4be8e7c0e5c7e6ed8743e0a32dc59af310d6181c483c7c857dff256d1f97dde82ce07349fd4c2a62e3a71ac9ac85f5555ce6976d7ce08df20f653
6
+ metadata.gz: 1db122ccbf5baccd60a59e1e482b98132ed5fb3b0097c2d00311e460da24d44a6ab8be76a7202ae49a4c8f112535ba4d9b32d8b7b41f382b492f297ef00a34e9
7
+ data.tar.gz: 0f960257b627d5b7441045585ab267e60ab3292126a0cd7fd4929f2402c5d08bc3ffa1dee46d16ca76b86f21e5154487ba0e5f817d707a83a5e3eca57ae3ef55
@@ -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.3em;
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: 1em;
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
- #WordJoiner = [8288].pack 'U*'
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 = ((node.doctitle sanitize: true) || (node.attr 'untitled-label')).gsub WordJoiner, ''
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">#{((item.doctitle sanitize: true) || (item.attr 'untitled-label')).gsub WordJoiner, ''}</a></li>)
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
- if (doctitle = node.doctitle)
124
- doctitle_sanitized = (node.doctitle sanitize: :sgml).gsub WordJoiner, ''
125
- if doctitle.include? ': '
126
- title, _, subtitle = doctitle.rpartition ': '
127
- else
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 = node.attr 'untitled-label'
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
- title_upper = title.upcase
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(WordJoiner, '').gsub('"', '&quot;')
794
+ sanitized = sanitized.gsub(WordJoinerRx, '').gsub('"', '&quot;')
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: :sgml).gsub(WordJoiner, '').downcase.delete(':').tr_s(' ', '-').tr_s('-', '-')
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
- WordJoiner = Epub3::WordJoiner
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 WordJoiner, ''
30
+ title.gsub WordJoinerRx, ''
31
31
  end
32
32
 
33
33
  def add_theme_assets doc
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Epub3
3
- VERSION = '1.0.0.alpha.1'
3
+ VERSION = '1.0.0.alpha.2'
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.0.0.alpha.1
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-07-29 00:00:00.000000000 Z
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.rc.2
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.rc.2
44
+ version: 1.5.0
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.6.0