Skip to content

Commit

Permalink
remove some unused instance variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Aug 11, 2009
1 parent cc2664c commit ee915b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/middleman.rb
Expand Up @@ -82,16 +82,14 @@ def self.run!(options={}, &block)
get /(.*)/ do |path|
path << "index.html" if path.match(%r{/$})
path.gsub!(%r{^/}, '')

@template = path.gsub(File.extname(path), '').to_sym
@full_request_path = path
path.gsub!(File.extname(path), '')

result = nil
begin
%w(haml erb builder maruku mab).detect do |renderer|
next false if !File.exists?(File.join(options.views, "#{@template}.#{renderer}"))
next false if !File.exists?(File.join(options.views, "#{path}.#{renderer}"))
renderer = "markaby" if renderer == "mab"
result = send(renderer.to_sym, @template)
result = send(renderer.to_sym, path.to_sym)
end
rescue Haml::Error => e
result = "Haml Error: #{e}"
Expand Down
6 changes: 5 additions & 1 deletion lib/middleman/helpers.rb
Expand Up @@ -5,8 +5,12 @@ def link_to(title, url="#", params={})
end

def page_classes(*additional)
path = env["REQUEST_PATH"]
path << "index.html" if path.match(%r{/$})
path.gsub!(%r{^/}, '')

classes = []
parts = @full_request_path.split('.')[0].split('/')
parts = path.split('.')[0].split('/')
parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }

classes << "index" if classes.empty?
Expand Down

0 comments on commit ee915b6

Please sign in to comment.