Created
March 19, 2011 19:00
-
-
Save defunkt/877708 to your computer and use it in GitHub Desktop.
Handing Mustache normal Ruby objects
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
class Highlighter | |
def ruby(text) | |
"<pre class='ruby'>#{text}</pre>" | |
end | |
def python(text) | |
"<pre class='python'>#{text}</pre>" | |
end | |
end | |
tpl = <<-END | |
{{#hl.ruby}} | |
def alert(thing) | |
puts thing | |
end | |
{{/hl.ruby}} | |
END | |
puts Mustache.render(tpl, :hl => Highlighter.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment