-
-
Save migrs/214684 to your computer and use it in GitHub Desktop.
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
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 |
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
%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 |
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
<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