Skip to content

Instantly share code, notes, and snippets.

@tamouse
Forked from dtjm/haml_converter.rb
Created October 4, 2013 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamouse/6819709 to your computer and use it in GitHub Desktop.
Save tamouse/6819709 to your computer and use it in GitHub Desktop.
# _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
---
---
<!-- _layouts/home.haml -->
%html
%head
%title= page.title
%body
#container
#header HEADER
#content
= content
#footer FOOTER
---
layout: home
title: Home Page
---
%h1 Hello World?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment