Class: Middleman::Renderers::Haml
- Defined in:
- middleman-core/lib/middleman-core/renderers/haml.rb
Overview
Haml Renderer
Constant Summary
Constants included from Contracts
Instance Attribute Summary
Attributes inherited from Extension
Instance Method Summary collapse
- #add_exposed_to_context(context) ⇒ Object
-
#initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block) ⇒ Haml
constructor
A new instance of Haml.
Methods inherited from Extension
activated_extension, #after_build, #after_configuration, after_extension_activated, #after_extension_activated, #before_build, #before_configuration, clear_after_extension_callbacks, config, define_setting, expose_to_application, expose_to_config, expose_to_template, global_config, helpers, #manipulate_resource_list, option, #ready, resources
Methods included from Contracts
Constructor Details
#initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block) ⇒ Haml
Returns a new instance of Haml.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'middleman-core/lib/middleman-core/renderers/haml.rb', line 47 def initialize(app, = ::Middleman::EMPTY_HASH, &block) super ::Haml::Options.defaults[:context] = nil ::Haml::Options.send :attr_accessor, :context ::Haml::TempleEngine. context: nil if defined?(::Haml::TempleEngine) [::Haml::Filters::Sass, ::Haml::Filters::Scss, ::Haml::Filters::Markdown].each do |f| f.class_exec do def self.(text, ) = .dup [:context] = [:context] text = template_class.new(nil, 1, ) { text }.render super(text, ) end end end ::Tilt.prefer(::Middleman::Renderers::HamlTemplate, :haml) # Add haml helpers to context ::Middleman::TemplateContext.include ::Haml::Helpers end |
Instance Method Details
#add_exposed_to_context(context) ⇒ Object
71 72 73 74 75 |
# File 'middleman-core/lib/middleman-core/renderers/haml.rb', line 71 def add_exposed_to_context(context) super context.init_haml_helpers if context.respond_to?(:init_haml_helpers) end |