munge 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c59629c86e087e24ffd0f4c0c6541050b7d1263
4
- data.tar.gz: 760d8f97c8a011e8499cbaa10c39b2e3c125a8b5
3
+ metadata.gz: c596cde656ea166e0febf10a87f2d419c4316385
4
+ data.tar.gz: 69533be20adc8de7fff0185ef62a7277f7417af0
5
5
  SHA512:
6
- metadata.gz: 3270e943cf0f1f25f2797e7b8b37d690645ba2a7fb3b54706c467d167c2caeecb34e49d48b2835b900ddfbc866e86305edeb2d2d1537d06d54e59941654b489b
7
- data.tar.gz: 24191c1b2fbb9cacfcb171839af26f596832a048ec7a08fba4b78540e402e5a94ab6ed5c8f9b49216f67a73147d81c7e4a11268a78035c5e7fdac0c7cf42cee8
6
+ metadata.gz: 010455f44a56ac64e1d844ed5162be5a5c8a3b6f51ae6f2371bef881a14234b8c1548afbb95f5d80a3892fd2ffbf7ba4cb0feacec10fd3ef411b2757e3034722
7
+ data.tar.gz: 09896ef1edd2904bdbfca617b53ed79bb8519730dabef653d891a7dc8fb6db6861f4bf3c559c38e6947054ae22b765e7db45e3da8911b338ba00e8e4bcb85d21
@@ -13,7 +13,7 @@ module Munge
13
13
  end
14
14
 
15
15
  def routed
16
- items.reject { |item| item.route.nil? }
16
+ items.select(&:route)
17
17
  end
18
18
 
19
19
  def build_virtual_item(relpath, content, **frontmatter)
@@ -28,7 +28,8 @@ module Munge
28
28
  output =
29
29
  engines
30
30
  .inject(content) do |memo, engine|
31
- template = engine.new(template_name) { memo }
31
+ options = @tilt_options[engine]
32
+ template = engine.new(template_name, options) { memo }
32
33
 
33
34
  if inner
34
35
  template.render(self, data) { inner }
@@ -1,9 +1,10 @@
1
1
  module Munge
2
2
  module Transformers
3
- class Tilt
3
+ class TiltTransformer
4
4
  def initialize(scope)
5
5
  @pristine_scope = scope
6
- @registry = []
6
+ @registry = []
7
+ @demands = Hash.new { Hash.new }
7
8
  end
8
9
 
9
10
  def name
@@ -14,6 +15,7 @@ module Munge
14
15
  scope = @pristine_scope.dup
15
16
  scope.instance_variable_set :@renderer, @renderer
16
17
  dirty_scope = extend_with_helpers(scope)
18
+ dirty_scope.instance_variable_set(:@tilt_options, @demands)
17
19
  dirty_scope.render_with_layout(item, content_engines: renderer, content_override: content)
18
20
  end
19
21
 
@@ -21,6 +23,10 @@ module Munge
21
23
  @registry.push(helper)
22
24
  end
23
25
 
26
+ def demand(tilt_template, **options)
27
+ @demands[tilt_template] = @demands[tilt_template].merge(options)
28
+ end
29
+
24
30
  private
25
31
 
26
32
  def extend_with_helpers(scope)
data/lib/munge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Munge
2
- VERSION = "0.8.0".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
data/lib/munge.rb CHANGED
@@ -47,4 +47,4 @@ require "munge/routers/auto_add_extension"
47
47
  require "munge/routers/fingerprint"
48
48
  require "munge/routers/add_index_html"
49
49
  require "munge/routers/remove_index_basename"
50
- require "munge/transformers/tilt"
50
+ require "munge/transformers/tilt_transformer"
@@ -1,4 +1,4 @@
1
- tilt_transformer = Transformers::Tilt.new(system)
1
+ tilt_transformer = Transformers::TiltTransformer.new(system)
2
2
  tilt_transformer.register(Munge::Helpers::Capture)
3
3
  tilt_transformer.register(Munge::Helpers::Find)
4
4
  tilt_transformer.register(Munge::Helpers::Link)
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.8.0
4
+ version: 0.9.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-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-10 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.8.0/README.md
195
+ description: Documentation for this release is located in https://github.com/zachahn/munge/blob/v0.9.0/README.md
196
196
  email:
197
197
  - zach.ahn@gmail.com
198
198
  executables:
@@ -243,7 +243,7 @@ files:
243
243
  - lib/munge/system/readers/filesystem.rb
244
244
  - lib/munge/system/router.rb
245
245
  - lib/munge/system/router/itemish.rb
246
- - lib/munge/transformers/tilt.rb
246
+ - lib/munge/transformers/tilt_transformer.rb
247
247
  - lib/munge/util/config.rb
248
248
  - lib/munge/util/path.rb
249
249
  - lib/munge/util/symbol_hash.rb
@@ -295,3 +295,4 @@ signing_key:
295
295
  specification_version: 4
296
296
  summary: Static site generator aiming to simplify complex build rules
297
297
  test_files: []
298
+ has_rdoc: