Skip to content

Instantly share code, notes, and snippets.

@phillipuniverse
Forked from dtjm/haml_converter.rb
Created April 21, 2012 20:22
Show Gist options
  • Save phillipuniverse/2439399 to your computer and use it in GitHub Desktop.
Save phillipuniverse/2439399 to your computer and use it in GitHub Desktop.
HAML plugin for jekyll
# _plugins/haml_converter.rb
module Jekyll
class HamlConverter < Converter
safe true
def setup
return if @setup
require 'haml'
@setup = true
rescue
STDERR.puts 'do `gem install haml`'
raise FatalException.new("Missing dependency: haml")
end
def matches(ext)
ext =~ /haml/i
end
def output_ext(ext)
".html"
end
def convert(content)
setup
engine = Haml::Engine.new(content)
engine.render
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment