Class: SiteFuel::Processor::HAMLProcessor

Inherits:
AbstractStringBasedProcessor show all
Defined in:
lib/sitefuel/processors/HAMLProcessor.rb

Instance Attribute Summary

Attributes inherited from AbstractStringBasedProcessor

#document

Attributes inherited from AbstractProcessor

#execution_list, #original_size, #processed_size, #resource_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractStringBasedProcessor

filter_string, #generate, #generate_string, #open_file, #open_string, process_file, process_string, #processor_symbol, processor_type, #save

Methods inherited from AbstractProcessor

#add_filter, #add_filterset, #clear_filters, #create_file, #drop_filter, #execute, file_pattern_match?, #filter?, filter?, filters, filters_in_filterset, filterset?, filterset_ignore, filtersets, find_processors, #finish_filters, #initialize, processes_file?, processor_name, #processor_symbol, processor_type, #run_filter, #run_filterset, #save, #setup_filters

Methods included from ClassLogging

#debug, #error, #fatal, #info, #warn

Methods included from Configurable

#configuration_options, #configure, #ensure_configurable_option, #post_configuration, #pre_configuration, #set_configuration

Methods included from Logging

#debug, #error, #fatal, #info, #logger=, #warn

Constructor Details

This class inherits a constructor from SiteFuel::Processor::AbstractProcessor

Class Method Details

.default_filtersetObject



28
29
30
# File 'lib/sitefuel/processors/HAMLProcessor.rb', line 28

def self.default_filterset
  :generate
end

.file_patternsObject



24
25
26
# File 'lib/sitefuel/processors/HAMLProcessor.rb', line 24

def self.file_patterns
  ['.haml']
end

.filterset_generateObject



32
33
34
# File 'lib/sitefuel/processors/HAMLProcessor.rb', line 32

def self.filterset_generate
  [:generate, :minify]
end

Instance Method Details

#filter_generateObject

generate the raw .html file from a .haml file



37
38
39
40
41
42
43
# File 'lib/sitefuel/processors/HAMLProcessor.rb', line 37

def filter_generate
  # to silence instance variable not initialized warnings from haml
  silently {
    engine = Haml::Engine.new(document)
    @document = engine.render
  }
end

#filter_minifyObject

run the HTMLProcessor’s whitespace filter



46
47
48
# File 'lib/sitefuel/processors/HAMLProcessor.rb', line 46

def filter_minify
  @document = HTMLProcessor.filter_string(:whitespace, document)
end