munge 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -5
- data/lib/munge/application.rb +1 -1
- data/lib/munge/helpers/rendering.rb +6 -4
- data/lib/munge/init.rb +3 -0
- data/lib/munge/item.rb +12 -0
- data/lib/munge/system/collection.rb +6 -0
- data/lib/munge/system/router.rb +1 -1
- data/lib/munge/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c59629c86e087e24ffd0f4c0c6541050b7d1263
|
4
|
+
data.tar.gz: 760d8f97c8a011e8499cbaa10c39b2e3c125a8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3270e943cf0f1f25f2797e7b8b37d690645ba2a7fb3b54706c467d167c2caeecb34e49d48b2835b900ddfbc866e86305edeb2d2d1537d06d54e59941654b489b
|
7
|
+
data.tar.gz: 24191c1b2fbb9cacfcb171839af26f596832a048ec7a08fba4b78540e402e5a94ab6ed5c8f9b49216f67a73147d81c7e4a11268a78035c5e7fdac0c7cf42cee8
|
data/README.md
CHANGED
@@ -80,11 +80,10 @@ posts_for_index =
|
|
80
80
|
.sort_by { |item| item.route }
|
81
81
|
.reverse
|
82
82
|
|
83
|
-
app.create("blog/index.html.erb", "", posts: posts_for_index)
|
84
|
-
item.route
|
85
|
-
item.layout = "list"
|
86
|
-
item.transform
|
87
|
-
end
|
83
|
+
app.create("blog/index.html.erb", "", posts: posts_for_index)
|
84
|
+
.each { |item| item.route = "blog" }
|
85
|
+
.each { |item| item.layout = "list" }
|
86
|
+
.each { |item| item.transform }
|
88
87
|
```
|
89
88
|
|
90
89
|
|
data/lib/munge/application.rb
CHANGED
@@ -5,19 +5,21 @@ module Munge
|
|
5
5
|
content = content_override || item.content
|
6
6
|
renderers = tilt_renderer_list(item, engines)
|
7
7
|
mdata = merged_data(item.frontmatter, data, self_item: item)
|
8
|
+
item_path = item.relpath
|
8
9
|
|
9
|
-
render_string(content, data: mdata, engines: renderers)
|
10
|
+
render_string(content, data: mdata, engines: renderers, template_name: item_path)
|
10
11
|
end
|
11
12
|
|
12
13
|
def layout(item_or_string, data: {}, &block)
|
13
14
|
layout_item = resolve_layout(item_or_string)
|
14
15
|
renderers = tilt_renderer_list(layout_item, nil)
|
15
16
|
mdata = merged_data(layout_item.frontmatter, data, self_layout: layout_item)
|
17
|
+
layout_path = "(layout) #{layout_item.relpath}"
|
16
18
|
|
17
|
-
render_string(layout_item.content, data: mdata, engines: renderers, &block)
|
19
|
+
render_string(layout_item.content, data: mdata, engines: renderers, template_name: layout_path, &block)
|
18
20
|
end
|
19
21
|
|
20
|
-
def render_string(content, data: {}, engines: [], &block)
|
22
|
+
def render_string(content, data: {}, engines: [], template_name: nil, &block)
|
21
23
|
inner =
|
22
24
|
if block_given?
|
23
25
|
capture(&block)
|
@@ -26,7 +28,7 @@ module Munge
|
|
26
28
|
output =
|
27
29
|
engines
|
28
30
|
.inject(content) do |memo, engine|
|
29
|
-
template = engine.new { memo }
|
31
|
+
template = engine.new(template_name) { memo }
|
30
32
|
|
31
33
|
if inner
|
32
34
|
template.render(self, data) { inner }
|
data/lib/munge/init.rb
CHANGED
data/lib/munge/item.rb
CHANGED
@@ -82,6 +82,12 @@ module Munge
|
|
82
82
|
@transforms.push([transformer, args])
|
83
83
|
end
|
84
84
|
|
85
|
+
def freeze
|
86
|
+
freeze_all_instance_variables
|
87
|
+
|
88
|
+
super
|
89
|
+
end
|
90
|
+
|
85
91
|
private
|
86
92
|
|
87
93
|
def generate_regex(pattern_list)
|
@@ -94,5 +100,11 @@ module Munge
|
|
94
100
|
.sub(%r{^/+}, "")
|
95
101
|
.sub(%r{/+$}, "")
|
96
102
|
end
|
103
|
+
|
104
|
+
def freeze_all_instance_variables
|
105
|
+
instance_variables.each do |ivar|
|
106
|
+
instance_variable_get(ivar).freeze
|
107
|
+
end
|
108
|
+
end
|
97
109
|
end
|
98
110
|
end
|
data/lib/munge/system/router.rb
CHANGED
data/lib/munge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: munge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Ahn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,7 +192,7 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '3.4'
|
195
|
-
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.
|
195
|
+
description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.8.0/README.md
|
196
196
|
email:
|
197
197
|
- zach.ahn@gmail.com
|
198
198
|
executables:
|