brochure 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -79,6 +79,18 @@ option:
79
79
  run Brochure.app(root, :assigns => { :domain => "37signals.com" })
80
80
 
81
81
 
82
+ ## Tilt template options
83
+
84
+ You can specify global [Tilt template
85
+ options](https://github.com/rtomayko/tilt/blob/master/TEMPLATES.md#readme)
86
+ on a per-engine basis with `:template_options`:
87
+
88
+ run Brochure.app(root, :template_options => {
89
+ ".haml" => { :format => :html5 },
90
+ ".md" => { :smart => true }
91
+ })
92
+
93
+
82
94
  # Installation
83
95
 
84
96
  $ gem install brochure
@@ -3,7 +3,7 @@ require "rack"
3
3
  require "tilt"
4
4
 
5
5
  module Brochure
6
- VERSION = "0.5.1"
6
+ VERSION = "0.5.2"
7
7
 
8
8
  autoload :Application, "brochure/application"
9
9
  autoload :CaptureNotSupported, "brochure/errors"
@@ -1,6 +1,6 @@
1
1
  module Brochure
2
2
  class Application
3
- attr_reader :app_root, :template_root, :asset_root, :plugin_root, :assigns
3
+ attr_reader :app_root, :template_root, :asset_root, :plugin_root, :assigns, :template_options
4
4
 
5
5
  def initialize(root, options = {})
6
6
  @app_root = File.expand_path(root)
@@ -9,6 +9,7 @@ module Brochure
9
9
  @plugin_root = File.join(@app_root, "vendor", "plugins")
10
10
 
11
11
  @assigns = options[:assigns] || {}
12
+ @template_options = options[:template_options] || {}
12
13
  helpers.push(*options[:helpers]) if options[:helpers]
13
14
  initialize_plugins
14
15
  end
@@ -76,7 +77,11 @@ module Brochure
76
77
 
77
78
  def find_partial_path(logical_path, format_extension)
78
79
  dirname, basename = File.split(logical_path)
79
- partial_path = File.join(dirname, "_" + basename)
80
+ if dirname == "."
81
+ partial_path = "_" + basename
82
+ else
83
+ partial_path = File.join(dirname, "_" + basename)
84
+ end
80
85
  template_trail.find(partial_path, partial_path + format_extension)
81
86
  end
82
87
 
@@ -8,7 +8,10 @@ module Brochure
8
8
  end
9
9
 
10
10
  def template
11
- @template ||= Tilt.new(path, nil, :outvar => '@_out_buf') if engine_extension
11
+ if engine_extension
12
+ options = app.template_options[engine_extension] || nil
13
+ @template ||= Tilt.new(path, options, :outvar => '@_out_buf')
14
+ end
12
15
  end
13
16
 
14
17
  def basename
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brochure
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sam Stephenson
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-20 00:00:00 -06:00
19
+ date: 2010-12-05 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -30,9 +30,9 @@ dependencies:
30
30
  hash: 19
31
31
  segments:
32
32
  - 0
33
- - 1
34
- - 4
35
- version: 0.1.4
33
+ - 3
34
+ - 0
35
+ version: 0.3.0
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency