dimples 1.7 → 1.7.1
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 +4 -4
- data/lib/dimples.rb +1 -1
- data/lib/dimples/configuration.rb +61 -50
- data/lib/dimples/errors.rb +1 -1
- data/lib/dimples/frontable.rb +12 -7
- data/lib/dimples/page.rb +10 -13
- data/lib/dimples/post.rb +4 -7
- data/lib/dimples/renderable.rb +19 -20
- data/lib/dimples/site.rb +106 -57
- data/lib/dimples/template.rb +2 -2
- data/lib/dimples/version.rb +1 -1
- data/lib/dimples/writeable.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 005ba579c9f57984364c6a1a16be1ba7d5da3225
|
4
|
+
data.tar.gz: 46eb5a741462c4b9148926cc737e1340214ce9f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a62e3eade61a897926ffd222adff17f2488bbd7ac7209027c9501ff5a8eab1682a2dd4040d6c16d3719a026908dabd15e96bacf5d72fe073cdb3d7f94cc4e130
|
7
|
+
data.tar.gz: 37440b46a3359a99046ade561b26f94b62e3780e195a7704f621c21635397a3b74fc8f62c68b36c44f58a3a643de510954f4d30f72691762af22682c6b183ac1
|
data/lib/dimples.rb
CHANGED
@@ -3,15 +3,11 @@ module Dimples
|
|
3
3
|
def initialize(config = {})
|
4
4
|
@settings = Dimples::Configuration.default_settings
|
5
5
|
|
6
|
-
|
7
|
-
@settings.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
@settings[key] = config[key]
|
13
|
-
end
|
14
|
-
end
|
6
|
+
config.each_key do |key|
|
7
|
+
if @settings[key].is_a?(Hash)
|
8
|
+
@settings[key].merge!(config[key])
|
9
|
+
else
|
10
|
+
@settings[key] = config[key]
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -26,53 +22,68 @@ module Dimples
|
|
26
22
|
{
|
27
23
|
'source_path' => current_path,
|
28
24
|
'destination_path' => File.join(current_path, 'site'),
|
25
|
+
'rendering' => {},
|
26
|
+
'category_names' => {},
|
27
|
+
'paths' => default_paths,
|
28
|
+
'layouts' => default_layouts,
|
29
|
+
'pagination' => default_pagination,
|
30
|
+
'generation' => default_generation,
|
31
|
+
'file_extensions' => default_file_extensions,
|
32
|
+
'date_formats' => default_date_formats
|
33
|
+
}
|
34
|
+
end
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
'
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
'year_archives' => 'year_archives',
|
41
|
-
'month_archives' => 'month_archives',
|
42
|
-
'day_archives' => 'day_archives'
|
43
|
-
},
|
44
|
-
|
45
|
-
'rendering' => {
|
46
|
-
},
|
36
|
+
def self.default_layouts
|
37
|
+
{
|
38
|
+
'posts' => 'posts',
|
39
|
+
'post' => 'post',
|
40
|
+
'category' => 'category',
|
41
|
+
'year_archives' => 'year_archives',
|
42
|
+
'month_archives' => 'month_archives',
|
43
|
+
'day_archives' => 'day_archives'
|
44
|
+
}
|
45
|
+
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
def self.default_paths
|
48
|
+
{
|
49
|
+
'archives' => 'archives',
|
50
|
+
'posts' => 'archives/%Y/%m/%d',
|
51
|
+
'categories' => 'archives/categories'
|
52
|
+
}
|
53
|
+
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
'feed' => true,
|
60
|
-
'category_feeds' => true,
|
61
|
-
},
|
55
|
+
def self.default_pagination
|
56
|
+
{
|
57
|
+
'enabled' => true,
|
58
|
+
'per_page' => 10
|
59
|
+
}
|
60
|
+
end
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
def self.default_generation
|
63
|
+
{
|
64
|
+
'paginated_posts' => false,
|
65
|
+
'categories' => true,
|
66
|
+
'year_archives' => true,
|
67
|
+
'month_archives' => true,
|
68
|
+
'day_archives' => true,
|
69
|
+
'feed' => true,
|
70
|
+
'category_feeds' => true
|
71
|
+
}
|
72
|
+
end
|
67
73
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
74
|
+
def self.default_file_extensions
|
75
|
+
{
|
76
|
+
'pages' => 'html',
|
77
|
+
'posts' => 'html'
|
78
|
+
}
|
79
|
+
end
|
73
80
|
|
74
|
-
|
81
|
+
def self.default_date_formats
|
82
|
+
{
|
83
|
+
'year' => '%Y',
|
84
|
+
'month' => '%Y-%m',
|
85
|
+
'day' => '%Y-%m-%d'
|
75
86
|
}
|
76
87
|
end
|
77
88
|
end
|
78
|
-
end
|
89
|
+
end
|
data/lib/dimples/errors.rb
CHANGED
data/lib/dimples/frontable.rb
CHANGED
@@ -14,14 +14,19 @@ module Dimples
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
if metadata
|
18
|
-
metadata.each_pair do |key, value|
|
19
|
-
self.class.send(:attr_accessor, key.to_sym) unless self.respond_to?(key.to_sym)
|
20
|
-
self.send("#{key}=", value)
|
21
|
-
end
|
22
|
-
end
|
17
|
+
apply_metadata(metadata) if metadata
|
23
18
|
|
24
19
|
contents
|
25
20
|
end
|
21
|
+
|
22
|
+
def apply_metadata(metadata)
|
23
|
+
metadata.each_pair do |key, value|
|
24
|
+
unless respond_to?(key.to_sym)
|
25
|
+
self.class.send(:attr_accessor, key.to_sym)
|
26
|
+
end
|
27
|
+
|
28
|
+
send("#{key}=", value)
|
29
|
+
end
|
30
|
+
end
|
26
31
|
end
|
27
|
-
end
|
32
|
+
end
|
data/lib/dimples/page.rb
CHANGED
@@ -10,36 +10,33 @@ module Dimples
|
|
10
10
|
attr_accessor :filename
|
11
11
|
attr_accessor :extension
|
12
12
|
attr_accessor :layout
|
13
|
+
attr_accessor :contents
|
13
14
|
attr_accessor :rendered_contents
|
14
15
|
|
15
|
-
attr_writer :contents
|
16
|
-
|
17
16
|
def initialize(site, path = nil)
|
18
17
|
@site = site
|
19
18
|
@extension = @site.config['file_extensions']['pages']
|
19
|
+
@path = path
|
20
20
|
|
21
|
-
if path
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@contents = read_with_yaml(path)
|
21
|
+
if @path
|
22
|
+
@filename = File.basename(@path, File.extname(@path))
|
23
|
+
@contents = read_with_yaml(@path)
|
25
24
|
else
|
26
|
-
@path = nil
|
27
25
|
@filename = 'index'
|
28
26
|
@contents = ''
|
29
27
|
end
|
30
28
|
end
|
31
29
|
|
32
|
-
def contents
|
33
|
-
@contents
|
34
|
-
end
|
35
|
-
|
36
30
|
def output_file_path(parent_path)
|
37
31
|
parts = [parent_path]
|
38
32
|
|
39
|
-
|
33
|
+
unless @path.nil?
|
34
|
+
parts << File.dirname(@path).gsub(@site.source_paths[:pages], '')
|
35
|
+
end
|
36
|
+
|
40
37
|
parts << "#{@filename}.#{@extension}"
|
41
38
|
|
42
39
|
File.join(parts)
|
43
40
|
end
|
44
41
|
end
|
45
|
-
end
|
42
|
+
end
|
data/lib/dimples/post.rb
CHANGED
@@ -11,6 +11,7 @@ module Dimples
|
|
11
11
|
attr_accessor :filename
|
12
12
|
attr_accessor :extension
|
13
13
|
attr_accessor :layout
|
14
|
+
attr_accessor :contents
|
14
15
|
attr_accessor :slug
|
15
16
|
attr_accessor :date
|
16
17
|
attr_accessor :year
|
@@ -21,8 +22,6 @@ module Dimples
|
|
21
22
|
attr_accessor :next_post
|
22
23
|
attr_accessor :draft
|
23
24
|
|
24
|
-
attr_writer :contents
|
25
|
-
|
26
25
|
def initialize(site, path)
|
27
26
|
@site = site
|
28
27
|
@path = path
|
@@ -30,7 +29,8 @@ module Dimples
|
|
30
29
|
@filename = 'index'
|
31
30
|
@extension = @site.config['file_extensions']['posts']
|
32
31
|
|
33
|
-
|
32
|
+
date_format = /(\d{4})-(\d{2})-(\d{2})-(.+)/
|
33
|
+
parts = File.basename(path, File.extname(path)).match(date_format)
|
34
34
|
|
35
35
|
@slug = parts[4]
|
36
36
|
@date = Time.mktime(parts[1], parts[2], parts[3])
|
@@ -47,13 +47,10 @@ module Dimples
|
|
47
47
|
@contents = read_with_yaml(path)
|
48
48
|
end
|
49
49
|
|
50
|
-
def contents
|
51
|
-
@contents
|
52
|
-
end
|
53
50
|
|
54
51
|
def output_file_path(parent_path)
|
55
52
|
parent_path = @date.strftime(parent_path) if parent_path =~ /%/
|
56
53
|
File.join([parent_path, @slug, "#{@filename}.#{@extension}"])
|
57
54
|
end
|
58
55
|
end
|
59
|
-
end
|
56
|
+
end
|
data/lib/dimples/renderable.rb
CHANGED
@@ -1,27 +1,12 @@
|
|
1
1
|
module Dimples
|
2
2
|
module Renderable
|
3
3
|
def render(context = {}, body = nil, use_layout = true)
|
4
|
-
context[:site] ||= @site
|
5
|
-
context[:this] ||= self
|
6
|
-
context[:type] ||= self.class.name.split('::').last.downcase.to_sym
|
7
|
-
|
8
|
-
scope = Object.new
|
9
|
-
|
10
|
-
context.each_pair do |key, value|
|
11
|
-
scope.instance_variable_set("@#{key}".to_sym, value)
|
12
|
-
end
|
13
|
-
|
14
4
|
begin
|
15
|
-
output = renderer.render(
|
5
|
+
output = renderer.render(build_scope(context)) { body }.strip
|
16
6
|
@rendered_contents = output
|
17
7
|
rescue RuntimeError, TypeError, NoMethodError, SyntaxError, NameError => e
|
18
|
-
|
19
|
-
|
20
|
-
else
|
21
|
-
"dynamic #{self.class}"
|
22
|
-
end
|
23
|
-
|
24
|
-
raise Errors::RenderingError.new(problem_file, e.message)
|
8
|
+
file = @path || "dynamic #{self.class}"
|
9
|
+
raise Errors::RenderingError.new(file, e.message)
|
25
10
|
end
|
26
11
|
|
27
12
|
if use_layout && defined?(@layout) && @site.templates[@layout]
|
@@ -31,8 +16,22 @@ module Dimples
|
|
31
16
|
output
|
32
17
|
end
|
33
18
|
|
19
|
+
def build_scope(context)
|
20
|
+
context[:site] ||= @site
|
21
|
+
context[:this] ||= self
|
22
|
+
context[:type] ||= self.class.name.split('::').last.downcase.to_sym
|
23
|
+
|
24
|
+
scope = Object.new
|
25
|
+
|
26
|
+
context.each_pair do |key, value|
|
27
|
+
scope.instance_variable_set("@#{key}".to_sym, value)
|
28
|
+
end
|
29
|
+
|
30
|
+
scope
|
31
|
+
end
|
32
|
+
|
34
33
|
def renderer
|
35
|
-
proc =
|
34
|
+
proc = proc { contents }
|
36
35
|
|
37
36
|
if @path
|
38
37
|
extension = File.extname(@path)[1..-1]
|
@@ -44,4 +43,4 @@ module Dimples
|
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
47
|
-
end
|
46
|
+
end
|
data/lib/dimples/site.rb
CHANGED
@@ -17,7 +17,7 @@ module Dimples
|
|
17
17
|
@output_paths = {}
|
18
18
|
@templates = {}
|
19
19
|
@categories = {}
|
20
|
-
@archives = {year: {}, month: {}, day: {}}
|
20
|
+
@archives = { year: {}, month: {}, day: {} }
|
21
21
|
|
22
22
|
@pages = []
|
23
23
|
@posts = []
|
@@ -33,12 +33,13 @@ module Dimples
|
|
33
33
|
@source_paths[:root] = File.expand_path(@config['source_path'])
|
34
34
|
@output_paths[:site] = File.expand_path(@config['destination_path'])
|
35
35
|
|
36
|
-
%w
|
36
|
+
%w(pages posts public templates).each do |path|
|
37
37
|
@source_paths[path.to_sym] = File.join(@source_paths[:root], path)
|
38
38
|
end
|
39
39
|
|
40
|
-
%w
|
41
|
-
|
40
|
+
%w(archives posts categories).each do |path|
|
41
|
+
output_path = File.join(@output_paths[:site], @config['paths'][path])
|
42
|
+
@output_paths[path.to_sym] = output_path
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -55,16 +56,17 @@ module Dimples
|
|
55
56
|
rescue Errors::PublishingError => e
|
56
57
|
puts "Error: Failed to publish #{e.file}: #{e.message}"
|
57
58
|
rescue => e
|
58
|
-
puts "Error: #{e}"
|
59
|
+
puts "Error: #{e.backtrace}"
|
59
60
|
end
|
60
61
|
|
61
62
|
def prepare_site
|
62
|
-
|
63
|
-
FileUtils.remove_dir(@output_paths[:site])
|
64
|
-
Dir.mkdir(@output_paths[:site])
|
65
|
-
rescue => e
|
66
|
-
raise "Failed to prepare the site directory (#{e})"
|
63
|
+
if Dir.exist?(@output_paths[:site])
|
64
|
+
FileUtils.remove_dir(@output_paths[:site])
|
67
65
|
end
|
66
|
+
|
67
|
+
Dir.mkdir(@output_paths[:site])
|
68
|
+
rescue => e
|
69
|
+
raise "Failed to prepare the site directory (#{e})"
|
68
70
|
end
|
69
71
|
|
70
72
|
def scan_files
|
@@ -90,7 +92,7 @@ module Dimples
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def scan_posts
|
93
|
-
Dir.glob(File.join(@source_paths[:posts], '*.*')).
|
95
|
+
Dir.glob(File.join(@source_paths[:posts], '*.*')).reverse_each do |path|
|
94
96
|
post = @post_class.new(self, path)
|
95
97
|
next if !@generation_options[:include_drafts] && post.draft
|
96
98
|
|
@@ -100,21 +102,38 @@ module Dimples
|
|
100
102
|
(@categories[slug] ||= []) << post
|
101
103
|
end
|
102
104
|
|
103
|
-
(
|
104
|
-
(
|
105
|
-
(
|
105
|
+
archive_year(post.year) << post
|
106
|
+
archive_month(post.year, post.month) << post
|
107
|
+
archive_day(post.year, post.month, post.day) << post
|
106
108
|
|
107
109
|
@posts << post
|
108
110
|
end
|
109
111
|
|
110
112
|
@posts.each_index do |index|
|
111
|
-
|
112
|
-
|
113
|
+
if index - 1 >= 0
|
114
|
+
@posts[index].next_post = @posts.fetch(index - 1, nil)
|
115
|
+
end
|
116
|
+
|
117
|
+
if index + 1 < @posts.count
|
118
|
+
@posts[index].previous_post = @posts.fetch(index + 1, nil)
|
119
|
+
end
|
113
120
|
end
|
114
121
|
|
115
122
|
@latest_post = @posts.first
|
116
123
|
end
|
117
124
|
|
125
|
+
def archive_year(year)
|
126
|
+
@archives[:year][year] ||= []
|
127
|
+
end
|
128
|
+
|
129
|
+
def archive_month(year, month)
|
130
|
+
@archives[:month]["#{year}/#{month}"] ||= []
|
131
|
+
end
|
132
|
+
|
133
|
+
def archive_day(year, month, day)
|
134
|
+
@archives[:day]["#{year}/#{month}/#{day}"] ||= []
|
135
|
+
end
|
136
|
+
|
118
137
|
def prepare_template(template)
|
119
138
|
end
|
120
139
|
|
@@ -140,7 +159,10 @@ module Dimples
|
|
140
159
|
end
|
141
160
|
|
142
161
|
if @config['generation']['paginated_posts']
|
143
|
-
|
162
|
+
paths = [@output_paths[:archives]]
|
163
|
+
layout = @config['layouts']['posts']
|
164
|
+
|
165
|
+
paginate(posts: @posts, paths: paths, layout: layout)
|
144
166
|
end
|
145
167
|
end
|
146
168
|
|
@@ -152,32 +174,35 @@ module Dimples
|
|
152
174
|
|
153
175
|
def generate_categories
|
154
176
|
@categories.each do |slug, posts|
|
155
|
-
|
156
|
-
|
177
|
+
name = @config['category_names'][slug] || slug.capitalize
|
178
|
+
paths = [@output_paths[:categories], slug]
|
179
|
+
layout = @config['layouts']['category']
|
180
|
+
context = { category: slug }
|
181
|
+
|
182
|
+
paginate(posts: posts, title: name, paths: paths, layout: layout, context: context)
|
157
183
|
end
|
158
184
|
end
|
159
185
|
|
160
186
|
def generate_archives
|
161
|
-
%w
|
162
|
-
|
187
|
+
%w(year month day).each do |date_type|
|
163
188
|
if @config['generation']["#{date_type}_archives"]
|
164
|
-
|
189
|
+
layout = @config['layouts']["#{date_type}_archives"]
|
165
190
|
|
166
191
|
@archives[date_type.to_sym].each_value do |posts|
|
167
192
|
title = posts[0].date.strftime(@config['date_formats'][date_type])
|
168
193
|
paths = [@output_paths[:archives], posts[0].year]
|
169
|
-
dates = {year: posts[0].year}
|
194
|
+
dates = { year: posts[0].year }
|
170
195
|
|
171
196
|
case date_type
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
197
|
+
when 'month'
|
198
|
+
paths << posts[0].month
|
199
|
+
dates[:month] = posts[0].month
|
200
|
+
when 'day'
|
201
|
+
paths.concat([posts[0].month, posts[0].day])
|
202
|
+
dates.merge(month: posts[0].month, day: posts[0].day)
|
178
203
|
end
|
179
204
|
|
180
|
-
paginate(posts: posts, title: title, paths: paths, layout:
|
205
|
+
paginate(posts: posts, title: title, paths: paths, layout: layout, context: dates)
|
181
206
|
end
|
182
207
|
end
|
183
208
|
end
|
@@ -194,60 +219,84 @@ module Dimples
|
|
194
219
|
end
|
195
220
|
|
196
221
|
def generate_posts_feed
|
197
|
-
|
222
|
+
posts = @posts[0..@config['pagination']['per_page'] - 1]
|
223
|
+
generate_feed(@output_paths[:site], posts: posts)
|
198
224
|
end
|
199
225
|
|
200
226
|
def generate_category_feeds
|
201
227
|
@categories.each do |slug, posts|
|
202
|
-
|
228
|
+
path = File.join(@output_paths[:categories], slug)
|
229
|
+
posts = posts[0..@config['pagination']['per_page'] - 1]
|
230
|
+
|
231
|
+
generate_feed(path, posts: posts, category: slug)
|
203
232
|
end
|
204
233
|
end
|
205
234
|
|
206
235
|
def copy_assets
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
raise "Failed to copy site assets (#{e})"
|
236
|
+
if Dir.exist?(@source_paths[:public])
|
237
|
+
path = File.join(@source_paths[:public], '.')
|
238
|
+
FileUtils.cp_r(path, @output_paths[:site])
|
211
239
|
end
|
240
|
+
rescue => e
|
241
|
+
raise "Failed to copy site assets (#{e})"
|
212
242
|
end
|
213
243
|
|
214
244
|
def paginate(posts:, title: nil, paths:, layout: false, context: {})
|
215
|
-
|
245
|
+
raise "'#{layout}' template not found" unless @templates.key?(layout)
|
216
246
|
|
217
247
|
per_page = @config['pagination']['per_page']
|
218
248
|
page_count = (posts.length.to_f / per_page.to_i).ceil
|
219
249
|
|
220
|
-
|
221
|
-
|
250
|
+
page_path = paths[0].gsub(@output_paths[:site], '') + '/'
|
251
|
+
page_path += paths[1..-1].join('/') + '/' if paths.length > 1
|
222
252
|
|
223
|
-
|
253
|
+
(1..page_count).each do |index|
|
224
254
|
page = @page_class.new(self)
|
225
255
|
|
226
256
|
page.layout = layout
|
227
257
|
page.title = title || @templates[layout].title
|
228
258
|
|
229
|
-
pagination =
|
230
|
-
|
231
|
-
pages: page_count,
|
232
|
-
post_count: posts.length,
|
233
|
-
path: pagination_path
|
234
|
-
}
|
259
|
+
pagination = build_pagination(index, page_count, posts.count, page_path)
|
260
|
+
output_path = File.join(paths, index != 1 ? "page#{index}" : '')
|
235
261
|
|
236
|
-
|
237
|
-
|
262
|
+
context[:posts] = posts.slice((index - 1) * per_page, per_page)
|
263
|
+
context[:pagination] = pagination
|
238
264
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
end
|
265
|
+
page.write(output_path, context)
|
266
|
+
end
|
267
|
+
end
|
243
268
|
|
244
|
-
|
269
|
+
def build_pagination(index, page_count, item_count, path)
|
270
|
+
pagination = {
|
271
|
+
page: index,
|
272
|
+
pages: page_count,
|
273
|
+
post_count: item_count,
|
274
|
+
path: path
|
275
|
+
}
|
245
276
|
|
246
|
-
|
247
|
-
|
277
|
+
if (pagination[:page] - 1) > 0
|
278
|
+
pagination[:previous_page] = pagination[:page] - 1
|
279
|
+
end
|
248
280
|
|
249
|
-
|
281
|
+
if (pagination[:page] + 1) <= pagination[:pages]
|
282
|
+
pagination[:next_page] = pagination[:page] + 1
|
283
|
+
end
|
284
|
+
|
285
|
+
if pagination[:previous_page]
|
286
|
+
pagination[:previous_page_url] = pagination[:path]
|
287
|
+
|
288
|
+
if pagination[:previous_page] != 1
|
289
|
+
page_string = "page#{pagination[:previous_page]}"
|
290
|
+
pagination[:previous_page_url] += page_string
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
if pagination[:next_page]
|
295
|
+
page_string = "#{pagination[:path]}page#{pagination[:next_page]}"
|
296
|
+
pagination[:next_page_url] = page_string
|
250
297
|
end
|
298
|
+
|
299
|
+
pagination
|
251
300
|
end
|
252
301
|
|
253
302
|
private
|
@@ -258,4 +307,4 @@ module Dimples
|
|
258
307
|
}
|
259
308
|
end
|
260
309
|
end
|
261
|
-
end
|
310
|
+
end
|
data/lib/dimples/template.rb
CHANGED
@@ -10,11 +10,11 @@ module Dimples
|
|
10
10
|
attr_accessor :rendered_contents
|
11
11
|
|
12
12
|
def initialize(site, path)
|
13
|
-
|
13
|
+
@site = site
|
14
14
|
@slug = File.basename(path, File.extname(path))
|
15
15
|
@path = path
|
16
16
|
|
17
17
|
@contents = read_with_yaml(path)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
data/lib/dimples/version.rb
CHANGED
data/lib/dimples/writeable.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dimples
|
2
2
|
module Writeable
|
3
3
|
def write(path, context = {})
|
4
|
-
output = context ? render(context) : contents
|
4
|
+
output = context ? render(context) : contents
|
5
5
|
|
6
6
|
publish_path = output_file_path(path)
|
7
7
|
parent_path = File.dirname(publish_path)
|
@@ -17,4 +17,4 @@ module Dimples
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bogan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|