class Rouge::Formatters::HTML
def escape_special_html_chars(value)
Returns either the given `value` argument string as is or a new string with the
a substitution is imminent.
a substitution occurs. This method however invokes `String#gsub` only if
`String#gsub` will always return a new string instance irrespective of whether
HTML from this formatter.
A performance-oriented helper method to escape `&`, `<` and `>` for the rendered
def escape_special_html_chars(value) escape_regex = /[&<>]/ return value unless value =~ escape_regex value.gsub(escape_regex, TABLE_FOR_ESCAPE_HTML) end