update padrino.
This commit is contained in:
parent
049866ee2e
commit
3995ad850c
268 changed files with 2330 additions and 1477 deletions
|
@ -6,7 +6,7 @@ require 'i18n'
|
|||
|
||||
# Don't fail on invalid locale, that's not what our current
|
||||
# users expect.
|
||||
::I18n.config.enforce_available_locales = false
|
||||
::I18n.enforce_available_locales = false
|
||||
|
||||
# Use ActiveSupport JSON
|
||||
require 'active_support/json'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
if !defined?(::Padrino::Helpers)
|
||||
require 'vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/support_lite'
|
||||
require 'vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers'
|
||||
require 'vendored-middleman-deps/padrino-core-0.12.0/lib/padrino-core/support_lite'
|
||||
require 'vendored-middleman-deps/padrino-helpers-0.12.0/lib/padrino-helpers'
|
||||
end
|
||||
|
||||
module Middleman
|
||||
|
|
|
@ -7,30 +7,28 @@ module Middleman
|
|||
|
||||
# once registered
|
||||
def registered(app)
|
||||
# Setup a default ERb engine
|
||||
app.config.define_setting :erb_engine, :erb, 'The engine to use for rendering ERb templates'
|
||||
app.config.define_setting :erb_engine_prefix, ::Tilt, 'The parent module for ERb template engines'
|
||||
|
||||
app.before_configuration do
|
||||
template_extensions :erb => :html
|
||||
end
|
||||
|
||||
# After config
|
||||
app.after_configuration do
|
||||
# Find the user's prefered engine
|
||||
# Convert symbols to classes
|
||||
if config[:erb_engine].is_a? Symbol
|
||||
engine = engine.to_s
|
||||
engine = engine == 'erb' ? 'ERB' : engine.camelize
|
||||
config[:erb_engine] = config[:erb_engine_prefix].const_get("#{engine}Template")
|
||||
end
|
||||
|
||||
# Tell Tilt to use the preferred engine
|
||||
::Tilt.prefer(config[:erb_engine])
|
||||
::Tilt.prefer(Template, :erb)
|
||||
end
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
||||
class Template < ::Tilt::ErubisTemplate
|
||||
##
|
||||
# In preamble we need a flag `__in_erb_template` and SafeBuffer for padrino apps.
|
||||
#
|
||||
def precompiled_preamble(locals)
|
||||
original = super
|
||||
"__in_erb_template = true\n" << original
|
||||
#.rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
# Require gem
|
||||
require 'haml'
|
||||
|
||||
module SafeTemplate
|
||||
def render(*)
|
||||
super.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
class Tilt::HamlTemplate
|
||||
include SafeTemplate
|
||||
end
|
||||
|
||||
module Middleman
|
||||
module Renderers
|
||||
|
||||
|
|
|
@ -14,10 +14,6 @@ module Middleman
|
|||
# Default sass options
|
||||
app.config.define_setting :sass, {}, 'Sass engine options'
|
||||
|
||||
# Location of SASS .sass-cache directory.
|
||||
# @return [String]
|
||||
app.config.define_setting :sass_cache_path, File.join(app.root_path, '.sass-cache'), 'Location of sass cache' # runtime compile of path
|
||||
|
||||
app.before_configuration do
|
||||
template_extensions :scss => :css,
|
||||
:sass => :css
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
# Load gem
|
||||
require 'slim'
|
||||
|
||||
module SafeTemplate
|
||||
def render(*)
|
||||
super.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
class Slim::Template
|
||||
include SafeTemplate
|
||||
|
||||
def precompiled_preamble(locals)
|
||||
"__in_slim_template = true\n" << super
|
||||
end
|
||||
end
|
||||
|
||||
module Middleman
|
||||
module Renderers
|
||||
|
||||
|
@ -29,10 +43,9 @@ module Middleman
|
|||
:context => self
|
||||
}
|
||||
|
||||
slim_embedded = defined?(::Slim::Embedded) ? ::Slim::Embedded : ::Slim::EmbeddedEngine
|
||||
|
||||
::Slim::Embedded::SassEngine.disable_option_validator!
|
||||
%w(sass scss markdown).each do |engine|
|
||||
slim_embedded.default_options[engine.to_sym] = context_hack
|
||||
::Slim::Embedded.default_options[engine.to_sym] = context_hack
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Middleman
|
||||
# Current Version
|
||||
# @return [String]
|
||||
VERSION = '3.2.2' unless const_defined?(:VERSION)
|
||||
VERSION = '3.3.0' unless const_defined?(:VERSION)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue