Created
August 10, 2010 16:34
-
-
Save dtjm/517556 to your computer and use it in GitHub Desktop.
HAML plugin for jekyll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
--- | |
<!-- _layouts/home.haml --> | |
%html | |
%head | |
%title= page.title | |
%body | |
#container | |
#header HEADER | |
#content | |
= content | |
#footer FOOTER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: home | |
title: Home Page | |
--- | |
%h1 Hello World? |
This plguin isn't converting my haml layouts to html
But it works for the content pages, any ideas?
@topher6345 what's the suffix of your layout files? Might wanna make them .html
to make the plugin pick them up.
I have an error with new version of haml gem.
http://blog.haml.info/post/42998475354/haml-4-0-has-been-released says that markup filters have been moved to separate gem 'haml-contrib'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does
home.haml
actually work? I can't seem to get my layout to generate correctly with haml?