Skip to content

Instantly share code, notes, and snippets.

@brandonmwest
Created August 18, 2013 17:51
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 brandonmwest/6262972 to your computer and use it in GitHub Desktop.
Save brandonmwest/6262972 to your computer and use it in GitHub Desktop.
Example Jekyll plugin (generator)
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
def output_ext(ext)
".html"
end
def convert(content)
begin
engine = Haml::Engine.new(content)
engine.render
rescue StandardError => e
puts "!!! HAML Error: " + e.message
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment