diff --git a/lib/middleman.rb b/lib/middleman.rb index 490798fa..189c7f16 100755 --- a/lib/middleman.rb +++ b/lib/middleman.rb @@ -12,7 +12,9 @@ module Middleman end autoload :Base, "middleman/base" + autoload :ERb, "middleman/erb" autoload :Haml, "middleman/haml" + autoload :Sass, "middleman/sass" autoload :Helpers, "middleman/helpers" end \ No newline at end of file diff --git a/lib/middleman/base.rb b/lib/middleman/base.rb index 7ffb7789..24d05c84 100644 --- a/lib/middleman/base.rb +++ b/lib/middleman/base.rb @@ -126,6 +126,7 @@ module Middleman end end +require "middleman/erb" # Haml is required & includes helpers require "middleman/haml" require "middleman/sass" @@ -144,6 +145,7 @@ class Middleman::Base disable :automatic_image_sizes disable :relative_assets disable :cache_buster + disable :ugly_haml # Default build features configure :build do diff --git a/lib/middleman/erb.rb b/lib/middleman/erb.rb new file mode 100755 index 00000000..5f5c0b54 --- /dev/null +++ b/lib/middleman/erb.rb @@ -0,0 +1,24 @@ +require "erb" + +module Middleman + module ERb + module Renderer + def self.included(base) + base.supported_formats << "erb" + end + + def render_path(path, layout) + if template_exists?(path, :erb) + layout = false if File.extname(path) == ".xml" + erb(path.to_sym, :layout => layout) + else + super + end + end + end + end +end + +class Middleman::Base + include Middleman::ERb::Renderer +end \ No newline at end of file diff --git a/lib/middleman/haml.rb b/lib/middleman/haml.rb index 3449fb2f..36f3037c 100755 --- a/lib/middleman/haml.rb +++ b/lib/middleman/haml.rb @@ -13,7 +13,7 @@ module Middleman result = nil begin layout = false if File.extname(path) == ".xml" - result = haml(path.to_sym, :layout => layout) + result = haml(path.to_sym, :layout => layout, :ugly => Middleman::Base.enabled?(:ugly_haml)) rescue ::Haml::Error => e result = "Haml Error: #{e}" result << "
Backtrace: #{e.backtrace.join("\n")}
" diff --git a/lib/middleman/sass.rb b/lib/middleman/sass.rb index 5115b4ea..bfb1801a 100644 --- a/lib/middleman/sass.rb +++ b/lib/middleman/sass.rb @@ -9,7 +9,7 @@ rescue LoadError puts "YUI-Compressor not available. Install it with: gem install yui-compressor" end -module Middleman::Sass +module Middleman::Sass def self.included(base) base.supported_formats << "sass" end