From ee915b62bb89a5d850403e14a2031ed2806a3e62 Mon Sep 17 00:00:00 2001 From: tdreyno Date: Tue, 11 Aug 2009 11:21:49 -0700 Subject: [PATCH] remove some unused instance variables --- lib/middleman.rb | 8 +++----- lib/middleman/helpers.rb | 6 +++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/middleman.rb b/lib/middleman.rb index cf8e9bee..c2713a93 100644 --- a/lib/middleman.rb +++ b/lib/middleman.rb @@ -82,16 +82,14 @@ class Middleman < Sinatra::Base 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}" diff --git a/lib/middleman/helpers.rb b/lib/middleman/helpers.rb index 34b4c602..9d7b3ae6 100644 --- a/lib/middleman/helpers.rb +++ b/lib/middleman/helpers.rb @@ -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?