Created
April 29, 2011 19:02
-
-
Save toritori0318/948810 to your computer and use it in GitHub Desktop.
これをperlに置き換えるのを考え中…
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
ALLOWED_TAGS = %w(redpre pre code notextile) | |
def escape_html_tags(text) | |
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment