Sha256: 3f3ef8d54fcae35b21a3a934cddc9b31fd2f90e9ec79504a6c745266a56d165c
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module Flutterby module Filters def apply!(file) body = file.source # Apply all filters file.filters.each do |filter| meth = "process_#{filter}" # Set the file's extension to the requested filter. The filter # itself can, of course, override this (eg. the "md" filter can default # the extension to "html".) # file.ext = filter # Now apply the actual filter! # if Filters.respond_to?(meth) body = Filters.send(meth, body, file) end end file.body = body end def process_erb(input, file) tilt("erb", input).render(file.view) end def process_slim(input, file) tilt("slim", input).render(file.view) end def process_md(input, file) file.ext = "html" Slodown::Formatter.new(input).complete.to_s end def process_scss(input, file) Sass::Engine.new(input, syntax: :scss).render end def tilt(format, body) Tilt[format].new { body } end extend self end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
flutterby-0.0.13 | lib/flutterby/filters.rb |
flutterby-0.0.12 | lib/flutterby/filters.rb |
flutterby-0.0.11 | lib/flutterby/filters.rb |
flutterby-0.0.10 | lib/flutterby/filters.rb |