replacement for strip_tags in the old helper

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@56 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2007-12-08 06:07:13 +00:00
parent 5f1c2d57e7
commit 4f496fa0b2
1 changed files with 8 additions and 1 deletions

View File

@ -68,11 +68,18 @@ class Page < ActiveRecord::Base
# #
def update_html def update_html
# need to filter HTML first... remove <script> and chunks and the like... # need to filter HTML first... remove <script> and chunks and the like...
res = RedCloth.new(self.redcloth.to_s.strip_tags, [ :no_span_caps ]) res = RedCloth.new(strip_tags(self.redcloth.to_s), [ :no_span_caps ])
self.html = res.to_html( self.html = res.to_html(
# no link references. messes up lines starting with [[WikiWord]] # no link references. messes up lines starting with [[WikiWord]]
:block_textile_table, :block_textile_lists, :block_textile_prefix, :block_textile_table, :block_textile_lists, :block_textile_prefix,
:inline_textile_image, :inline_textile_link, :inline_textile_code, :inline_textile_image, :inline_textile_link, :inline_textile_code,
:inline_textile_span, :glyphs_textile) :inline_textile_span, :glyphs_textile)
end end
##
# Removes HTML tags from a string
#
def strip_tags(str)
str.gsub(/\</, "&lt;").gsub(/\>/, "&gt;")
end
end end