Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added the option to guard a partial when it is rendered from subsequent

filters.
  • Loading branch information...
commit 5f53c33d961a2c1f1169aeeb843f55a71b84f3e5 1 parent 8f2cde7
Tim Pease TwP authored
2  examples/presentation/content/_sample_code.txt
... ... @@ -1,7 +1,6 @@
1 1 ---
2 2 filter: erb
3 3 ---
4   -<notextile>
5 4 <% uv :lang => "ruby", :theme => 'twilight' do -%>
6 5 class A
7 6 def method()
@@ -9,4 +8,3 @@ class A
9 8 end
10 9 end
11 10 <% end -%>
12   -</notextile>
2  examples/presentation/content/index.txt
@@ -44,7 +44,7 @@ h1. Title of the Third Slide
44 44
45 45 This code comes from a partial
46 46
47   -<%= render_partial('sample_code') %>
  47 +<%= render_partial 'sample_code', :guard => true %>
48 48
49 49
50 50 h1. Title of the Fourth Slide
10 lib/webby/renderer.rb
@@ -96,10 +96,15 @@ def render_page
96 96 def render_partial( part, opts = {} )
97 97 part = _find_partial(part)
98 98
99   - _track_rendering(part.path) {
  99 + str = _track_rendering(part.path) {
100 100 _configure_locals(opts[:locals])
101 101 Filters.process(self, part, ::Webby::Resources::File.read(part.path))
102 102 }
  103 +
  104 + # TODO: add documentation / examples for the guard option
  105 +
  106 + str = _guard(str) if opts[:guard]
  107 + str
103 108 end
104 109
105 110 # call-seq:
@@ -256,6 +261,9 @@ def _configure_locals( locals )
256 261 # Raies a Webby::Error if the partial could not be found.
257 262 #
258 263 def _find_partial( part )
  264 +
  265 + # FIXME: this won't work for partial names with paths
  266 +
259 267 case part
260 268 when String
261 269 fn = '_' + part

0 comments on commit 5f53c33

Please sign in to comment.
Something went wrong with that request. Please try again.