Skip to content
Browse files

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

filters.
  • Loading branch information...
1 parent 8f2cde7 commit 5f53c33d961a2c1f1169aeeb843f55a71b84f3e5 @TwP TwP committed May 31, 2008
View
2 examples/presentation/content/_sample_code.txt
@@ -1,12 +1,10 @@
---
filter: erb
---
-<notextile>
<% uv :lang => "ruby", :theme => 'twilight' do -%>
class A
def method()
puts "in class #{self.class.name}"
end
end
<% end -%>
-</notextile>
View
2 examples/presentation/content/index.txt
@@ -44,7 +44,7 @@ h1. Title of the Third Slide
This code comes from a partial
-<%= render_partial('sample_code') %>
+<%= render_partial 'sample_code', :guard => true %>
h1. Title of the Fourth Slide
View
10 lib/webby/renderer.rb
@@ -96,10 +96,15 @@ def render_page
def render_partial( part, opts = {} )
part = _find_partial(part)
- _track_rendering(part.path) {
+ str = _track_rendering(part.path) {
_configure_locals(opts[:locals])
Filters.process(self, part, ::Webby::Resources::File.read(part.path))
}
+
+ # TODO: add documentation / examples for the guard option
+
+ str = _guard(str) if opts[:guard]
+ str
end
# call-seq:
@@ -256,6 +261,9 @@ def _configure_locals( locals )
# Raies a Webby::Error if the partial could not be found.
#
def _find_partial( part )
+
+ # FIXME: this won't work for partial names with paths
+
case part
when String
fn = '_' + part

0 comments on commit 5f53c33

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