Skip to content

Instantly share code, notes, and snippets.

@maiha
Created October 20, 2009 20:29
Embed
What would you like to do?
module Inline
include Haml::Filters::Base
def self.[](key)
@@data[key.to_s] rescue nil
end
def render(str)
@@data = Hash[*str.split(/^\s*@@\s*(\w+)\s*\n/m)[1..-1]]
return nil
end
end
%h1 Inline Filter
.describe= Inline[:describe]
.author created by #{Inline[:author]}
:inline
@@ describe
This filter easily separates structure and data.
You can use in-file-templates like sinatra.
@@ author
maiha@wota.jp
<h1>Inline Filter</h1>
<div class='describe'>
This filter easily separates structure and data.
You can use in-file-templates like sinatra.
</div>
<div class='author'>created by maiha@wota.jp</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment