1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

minor rdoc tweaks

This commit is contained in:
tdreyno 2009-10-06 16:51:34 -07:00
parent 7e845647ea
commit 8874e97608
4 changed files with 63 additions and 60 deletions

View file

@ -62,6 +62,7 @@ Rake::RDocTask.new do |rdoc|
rdoc.title = "middleman #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.exclude('lib/middleman/features/sprockets+ruby19.rb')
end
desc "Build and publish documentation using GitHub Pages."

View file

@ -4,12 +4,6 @@ require 'rubygems' unless ENV['NO_RUBYGEMS']
# We're riding on Sinatra, so let's include it
require 'sinatra/base'
# Rack helper for adding mime-types during local preview
def mime(ext, type)
ext = ".#{ext}" unless ext.to_s[0] == ?.
Rack::Mime::MIME_TYPES[ext.to_s] = type
end
module Middleman
class Base < Sinatra::Base
set :app_file, __FILE__
@ -45,6 +39,12 @@ module Middleman
enable :cache_buster
end
# Rack helper for adding mime-types during local preview
def mime(ext, type)
ext = ".#{ext}" unless ext.to_s[0] == ?.
Rack::Mime::MIME_TYPES[ext.to_s] = type
end
# Convenience function to discover if a tempalte exists for the requested renderer (haml, sass, etc)
def template_exists?(path, renderer=nil)
template_path = path.dup

View file

@ -2,9 +2,10 @@ require 'haml'
module Middleman
module Haml
module Renderer
def self.included(base)
base.supported_formats << "haml"
base.helpers Middleman::HamlHelpers
base.helpers Middleman::Haml::Helpers
end
def render_path(path)
@ -23,7 +24,7 @@ module Middleman
end
end
module HamlHelpers
module Helpers
def haml_partial(name, options = {})
item_name = name.to_sym
counter_name = "#{name}_counter".to_sym
@ -60,6 +61,7 @@ module Middleman
output + "</table></div>"
end
end
end
module Sass
def self.included(base)
@ -125,6 +127,6 @@ END
end
class Middleman::Base
include Middleman::Haml
include Middleman::Haml::Renderer
include Middleman::Sass
end

View file

@ -12,9 +12,8 @@ module Middleman
END
end
end
end
module Compressor
module StaticJavascript
def render_path(path)
if template_exists?(path, :js)
compressor = YUI::JavaScriptCompressor.new(:munge => true)
@ -24,8 +23,9 @@ END
end
end
end
end
class Base
include Middleman::Compressor
include Middleman::Minified::StaticJavascript
end
end