Skip to content

Commit

Permalink
rubify escape tags method
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 5, 2015
1 parent 9a6f180 commit 2ffc419
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/types/src/modules/String.rb
Expand Up @@ -541,9 +541,12 @@ def CutRegexMatch(input, regex, glob)
# @param [String] text to escape
# @return [String] escaped text
def EscapeTags(text)
text = Builtins.mergestring(Builtins.splitstring(text, "&"), "&")
text = Builtins.mergestring(Builtins.splitstring(text, "<"), "&lt;")
text = Builtins.mergestring(Builtins.splitstring(text, ">"), "&gt;")
return nil unless text
text = text.dup

text.gsub!("&", "&amp;")
text.gsub!("<", "&lt;")
text.gsub!(">", "&gt;")

text
end
Expand Down

0 comments on commit 2ffc419

Please sign in to comment.