Permalink
Browse files

add a verbose flag

  • Loading branch information...
1 parent f4365d0 commit 00610d6f100c84a5ec3cecbebc482ff62ef4cc7b Todd Fisher committed Mar 15, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/sitepack.rb
View
9 lib/sitepack.rb
@@ -129,6 +129,8 @@ def site_pack_config(yaml_file)
config = YAML.load_file(yaml_file)
@vars = config['vars']
@filter = config['filter'] || 'redcloth'
+ @verbose = config['verbose']
+ puts "Site Pack!\nVars:#{@vars.inspect}\nFilter(default):#{@filter.inspect}" if @verbose
end
def _site_pack_get_opt(opt)
instance_variable_get("@#{opt}".to_sym)
@@ -161,13 +163,14 @@ def site_content(content_path, params)
end
end
sidebar = doc.at(:sidebar)
- @sidebar = content_processor(sidebar,self.class._site_pack_get_opt('filter')) if sidebar
+ @sidebar = content_processor(sidebar) if sidebar
template.to_sym
end
- def content_processor(node,default_filter='redcloth')
- filter = node[:filter] || default_filter
+ def content_processor(node)
+ filter = node[:filter] || self.class._site_pack_get_opt('filter')
+ puts "Render(#{node.name.inspect}) with #{filter.inspect}" if self.class._site_pack_get_opt('verbose')
output = case filter
when 'redcloth'
RedCloth.new(node.inner_html).to_html

0 comments on commit 00610d6

Please sign in to comment.