mint 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mint/plugins/epub.rb +10 -8
- data/lib/mint/version.rb +1 -1
- data/plugins/templates/epub/{container.haml → layouts/container.haml} +0 -0
- data/plugins/templates/epub/{content.haml → layouts/content.haml} +10 -11
- data/plugins/templates/epub/{layout.haml → layouts/layout.haml} +0 -0
- data/plugins/templates/epub/{title.haml → layouts/title.haml} +1 -1
- data/plugins/templates/epub/{toc.haml → layouts/toc.haml} +0 -0
- metadata +41 -41
data/lib/mint/plugins/epub.rb
CHANGED
@@ -32,7 +32,7 @@ module Mint
|
|
32
32
|
end
|
33
33
|
|
34
34
|
Dir.chdir document.destination_directory do
|
35
|
-
metadata =
|
35
|
+
metadata = standardized_metadata document
|
36
36
|
chapters = document.chapters
|
37
37
|
locals = { chapters: chapters }.merge metadata
|
38
38
|
|
@@ -156,8 +156,8 @@ module Mint
|
|
156
156
|
|
157
157
|
def self.create_chapters!(chapters, opts={})
|
158
158
|
opts = chapter_defaults.deep_merge(opts)
|
159
|
-
template_file = EPub.template_directory + '/layout.haml'
|
160
|
-
renderer = Tilt.new template_file, :ugly =>
|
159
|
+
template_file = EPub.template_directory + '/layouts/layout.haml'
|
160
|
+
renderer = Tilt.new template_file, :ugly => true
|
161
161
|
chapters.map do |chapter|
|
162
162
|
renderer.render Object.new, opts[:locals].merge(:content => chapter)
|
163
163
|
end.each_with_index do |text, id|
|
@@ -168,8 +168,8 @@ module Mint
|
|
168
168
|
private
|
169
169
|
|
170
170
|
def self.create_from_template!(opts={})
|
171
|
-
template_file = EPub.template_directory + "/#{opts[:from]}"
|
172
|
-
renderer = Tilt.new template_file, :ugly =>
|
171
|
+
template_file = EPub.template_directory + "/layouts/#{opts[:from]}"
|
172
|
+
renderer = Tilt.new template_file, :ugly => true
|
173
173
|
content = renderer.render Object.new, opts[:locals]
|
174
174
|
|
175
175
|
File.open(opts[:to], 'w') do |f|
|
@@ -195,7 +195,8 @@ module Mint
|
|
195
195
|
}
|
196
196
|
end
|
197
197
|
|
198
|
-
def self.
|
198
|
+
def self.standardized_metadata(document)
|
199
|
+
metadata = document.metadata.merge(:stylesheet => document.stylesheet)
|
199
200
|
sanitized_metadata =
|
200
201
|
Helpers.symbolize_keys(metadata, :downcase => true)
|
201
202
|
standardized_metadata =
|
@@ -260,7 +261,7 @@ module Mint
|
|
260
261
|
genre: 'Non-fiction',
|
261
262
|
rights: 'All Rights Reserved',
|
262
263
|
ncx_file: 'toc.ncx',
|
263
|
-
|
264
|
+
stylesheet: 'style.css',
|
264
265
|
title_file: 'title.html',
|
265
266
|
}
|
266
267
|
}
|
@@ -284,7 +285,8 @@ module Mint
|
|
284
285
|
to: "#{CONTENT_DIR}/title.html",
|
285
286
|
locals: {
|
286
287
|
title: 'Untitled',
|
287
|
-
creators: ['Anonymous']
|
288
|
+
creators: ['Anonymous'],
|
289
|
+
stylesheet: 'style.css'
|
288
290
|
}
|
289
291
|
}
|
290
292
|
end
|
data/lib/mint/version.rb
CHANGED
File without changes
|
@@ -1,21 +1,20 @@
|
|
1
1
|
!!! XML
|
2
2
|
%package(version='2.0' xmlns='http://www.idpf.org/2007/opf' unique-identifier=uuid)
|
3
|
-
%metadata
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
%metadata(xmlns:dc='http://purl.org/dc/elements/1.1/'
|
4
|
+
xmlns:dcterms='http://purl.org/dc/terms/'
|
5
|
+
xmlns:opf='http://www.idpf.org/2007/opf'
|
6
|
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance')
|
7
7
|
|
8
8
|
%dc:title= title
|
9
|
-
%dc:language
|
10
|
-
%dc:identifier
|
9
|
+
%dc:language(xsi:type='dcterms:RFC3066')= language
|
10
|
+
%dc:identifier(id=uuid)= short_title
|
11
11
|
%dc:description= description
|
12
|
-
%dc:date
|
12
|
+
%dc:date(xsi:type='dcterms:W3CDTF')= date
|
13
13
|
|
14
14
|
- creators.each do |creator|
|
15
|
-
%dc:creator
|
15
|
+
%dc:creator(opf:file-as=creator opf:role='aut')
|
16
16
|
- contributors.each do |contributor|
|
17
|
-
%dc:contributor
|
18
|
-
'opf:role' => 'edt' }
|
17
|
+
%dc:contributor(opf:file-as=contributor opf:role='edt')
|
19
18
|
|
20
19
|
%dc:publisher= publisher
|
21
20
|
%dc:type= genre
|
@@ -23,7 +22,7 @@
|
|
23
22
|
|
24
23
|
%manifest
|
25
24
|
%item(id='ncx' href=ncx_file media-type='application/x-dtbncx+xml')/
|
26
|
-
%item(id='style' href=
|
25
|
+
%item(id='style' href=stylesheet media-type='text/css')/
|
27
26
|
%item(id='title' href=title_file media-type='application/xhtml+xml')/
|
28
27
|
- chapters.each_with_index do |content, id|
|
29
28
|
- idx = id + 1
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
16
|
-
requirement: &
|
16
|
+
requirement: &70146447648180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70146447648180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdiscount
|
27
|
-
requirement: &
|
27
|
+
requirement: &70146447647640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70146447647640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: erubis
|
38
|
-
requirement: &
|
38
|
+
requirement: &70146447647160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70146447647160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: haml
|
49
|
-
requirement: &
|
49
|
+
requirement: &70146447646720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70146447646720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass
|
60
|
-
requirement: &
|
60
|
+
requirement: &70146447646240 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70146447646240
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdiscount
|
71
|
-
requirement: &
|
71
|
+
requirement: &70146447645760 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70146447645760
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: liquid
|
82
|
-
requirement: &
|
82
|
+
requirement: &70146447645300 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70146447645300
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: less
|
93
|
-
requirement: &
|
93
|
+
requirement: &70146447644880 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70146447644880
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: radius
|
104
|
-
requirement: &
|
104
|
+
requirement: &70146447644460 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70146447644460
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: markaby
|
115
|
-
requirement: &
|
115
|
+
requirement: &70146447644040 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70146447644040
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: active_support
|
126
|
-
requirement: &
|
126
|
+
requirement: &70146447643620 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70146447643620
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: nokogiri
|
137
|
-
requirement: &
|
137
|
+
requirement: &70146447643180 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70146447643180
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: hashie
|
148
|
-
requirement: &
|
148
|
+
requirement: &70146447642760 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :runtime
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70146447642760
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rubyzip
|
159
|
-
requirement: &
|
159
|
+
requirement: &70146447642320 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :runtime
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *70146447642320
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: rspec
|
170
|
-
requirement: &
|
170
|
+
requirement: &70146447641860 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,10 +175,10 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *70146447641860
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: cucumber
|
181
|
-
requirement: &
|
181
|
+
requirement: &70146447641380 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
@@ -186,10 +186,10 @@ dependencies:
|
|
186
186
|
version: '0'
|
187
187
|
type: :development
|
188
188
|
prerelease: false
|
189
|
-
version_requirements: *
|
189
|
+
version_requirements: *70146447641380
|
190
190
|
- !ruby/object:Gem::Dependency
|
191
191
|
name: aruba
|
192
|
-
requirement: &
|
192
|
+
requirement: &70146447640940 !ruby/object:Gem::Requirement
|
193
193
|
none: false
|
194
194
|
requirements:
|
195
195
|
- - ! '>='
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
version: '0'
|
198
198
|
type: :development
|
199
199
|
prerelease: false
|
200
|
-
version_requirements: *
|
200
|
+
version_requirements: *70146447640940
|
201
201
|
description:
|
202
202
|
email: david@wit.io
|
203
203
|
executables:
|
@@ -228,11 +228,11 @@ files:
|
|
228
228
|
- templates/default/style.sass
|
229
229
|
- templates/pro/layout.haml
|
230
230
|
- templates/pro/style.sass
|
231
|
-
- plugins/templates/epub/container.haml
|
232
|
-
- plugins/templates/epub/layout.haml
|
233
|
-
- plugins/templates/epub/title.haml
|
234
|
-
- plugins/templates/epub/toc.haml
|
235
|
-
- plugins/templates/epub/content.haml
|
231
|
+
- plugins/templates/epub/layouts/container.haml
|
232
|
+
- plugins/templates/epub/layouts/layout.haml
|
233
|
+
- plugins/templates/epub/layouts/title.haml
|
234
|
+
- plugins/templates/epub/layouts/toc.haml
|
235
|
+
- plugins/templates/epub/layouts/content.haml
|
236
236
|
- features/support/env.rb
|
237
237
|
- features/publish.feature
|
238
238
|
- features/plugins/epub.feature
|