Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
add Standardista module and auto_escape_html convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Oct 19, 2008
1 parent b2eca41 commit 748511a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion init.rb
@@ -1,3 +1,4 @@
Haml::init_rails(binding) unless defined? Haml::Template
require 'standardista'
ActionView::Base.send :include, StandardistaHelper

ActionView::Base.send :include, Standardista::Helpers
18 changes: 12 additions & 6 deletions lib/standardista.rb
Expand Up @@ -24,10 +24,16 @@
Sass::Plugin.update_stylesheets
end

module StandardistaHelper
# override tag helper from Rails to disable self-closing tags
# (there is no such thing in HTML)
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}>"
module Standardista
def self.auto_escape_html
Haml::Template::options[:escape_html] = true
end
end

module Helpers
# override tag helper from Rails to disable self-closing tags
# (there is no such thing in HTML)
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}>"
end
end
end

0 comments on commit 748511a

Please sign in to comment.