rack-server-pages 0.0.5 → 0.0.6

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.
data/CHANGES.md CHANGED
@@ -1,7 +1,14 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
- ### [0.0.5](https://github.com/migrs/rack-server-pages/tree/v0.0.5) / 2012-03-18
4
+ ### [0.0.6](https://github.com/migrs/rack-server-pages/tree/v0.0.6) / 2012-05-16
5
+
6
+ * [Changes](https://github.com/migrs/rack-server-pages/compare/v0.0.5...v0.0.6)
7
+
8
+ * Feature
9
+ - Passing local parameters to partial template (Tilt mode only)
10
+
11
+ ### [0.0.5](https://github.com/migrs/rack-server-pages/tree/v0.0.5) / 2012-04-18
5
12
 
6
13
  * [Changes](https://github.com/migrs/rack-server-pages/compare/v0.0.4...v0.0.5)
7
14
 
data/README.md CHANGED
@@ -477,7 +477,6 @@ And create `public/info.php` :)
477
477
  ## ToDo
478
478
 
479
479
  ### Implements
480
- - Error handling
481
480
  - Static file generator (for designer)
482
481
 
483
482
  ### Tasks
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class ServerPages
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
@@ -219,8 +219,8 @@ module Rack
219
219
  end
220
220
  end
221
221
 
222
- def render_with_layout(scope, &block)
223
- content = render(scope, &block)
222
+ def render_with_layout(scope, locals = {}, &block)
223
+ content = render(scope, locals = {}, &block)
224
224
  if layout = scope.layout and layout_file = Dir["#{layout}{.*,}"].first
225
225
  scope.layout(false)
226
226
  Template[layout_file].render_with_layout(scope) { content }
@@ -234,8 +234,8 @@ module Rack
234
234
  (@tilt ||= Tilt[@file]) ? self : nil
235
235
  end
236
236
 
237
- def render(scope, &block)
238
- @tilt.new(@file).render(scope, &block)
237
+ def render(scope, locals = {}, &block)
238
+ @tilt.new(@file).render(scope, locals, &block)
239
239
  end
240
240
 
241
241
  def default_mime_type
@@ -255,7 +255,8 @@ module Rack
255
255
  (@file =~ /\.(#{self.class.extensions.join('|')})$/) and ::File.exist?(@file) ? self : nil
256
256
  end
257
257
 
258
- def render(scope, &block)
258
+ def render(scope, locals = {}, &block)
259
+ ## TODO: support locals
259
260
  ERB.new(IO.read(@file)).result(scope._binding(&block))
260
261
  end
261
262
 
@@ -292,9 +293,9 @@ module Rack
292
293
  halt
293
294
  end
294
295
 
295
- def partial(file, &block)
296
+ def partial(file, locals = {}, &block)
296
297
  if tpl_file = Dir["#{file}{.*,}"].first and template = Template[tpl_file]
297
- template.render(self, &block)
298
+ template.render(self, locals, &block)
298
299
  else
299
300
  IO.read(file)
300
301
  end
@@ -5,6 +5,7 @@ What's your name?:
5
5
  <input type="text" name="name" value="<%=h params["name"]%>" />
6
6
  <input type="submit" />
7
7
  </form>
8
+ <%= partial 'views/examples/_time.html', :a => 'PartA', :b => 'PartB' %>
8
9
 
9
10
  <%= @sample1 %>
10
11
  <%= @sample2 %>
@@ -1 +1,4 @@
1
1
  <p><code>Time: <%= Time.now %></code></p>
2
+ <%= a rescue nil %>
3
+ <%= b rescue nil %>
4
+ <%= c rescue nil %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-server-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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: 2012-04-17 00:00:00.000000000Z
12
+ date: 2012-05-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70273387486420 !ruby/object:Gem::Requirement
16
+ requirement: &70139451581180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70273387486420
24
+ version_requirements: *70139451581180
25
25
  description: ! "Rack middleware and appilcation for serving dynamic pages in very
26
26
  simple way.\n There are no controllers and no models, just only
27
27
  views like a asp, jsp and php!"