def shell_quote(str)
if Redmine::Platform.mswin?
- '"' + str.gsub(/"/, '\\"') + '"'
+ '"' + str.gsub('"', '\\"') + '"'
else
- "'" + str.gsub(/'/, "'\"'\"'") + "'"
+ "'" + str.gsub("'", "'\"'\"'") + "'"
end
end
# original language for extension development
langattr = " data-language=\"#{CGI.escapeHTML language}\"" if language.present?
if Redmine::SyntaxHighlighting.language_supported?(language)
- text.gsub!(/x%x%/, '&')
+ text.gsub!("x%x%", '&')
content = "<code class=\"#{CGI.escapeHTML language} syntaxhl\"#{langattr}>" +
Redmine::SyntaxHighlighting.highlight_by_language(text, language)
else
retrieve text
text.gsub!( /<\/?notextile>/, '' )
- text.gsub!( /x%x%/, '&' )
+ text.gsub!( "x%x%", '&' )
clean_html text if filter_html
text.strip!
text
def clean_white_space( text )
# normalize line breaks
- text.gsub!( /\r\n/, "\n" )
+ text.gsub!( "\r\n", "\n" )
text.tr!( "\r", "\n" )
- text.gsub!( /\t/, ' ' )
+ text.gsub!( "\t", ' ' )
text.gsub!( /^ +$/, '' )
text.gsub!( /\n{3,}/, "\n\n" )
text.gsub!( /"$/, "\" " )
}
def clean_html( text, tags = BASIC_TAGS )
- text.gsub!( /<!\[CDATA\[/, '' )
+ text.gsub!( "<![CDATA[", '' )
text.gsub!( /<(\/*)(\w+)([^>]*)>/ ) do
raw = $~
tag = raw[2].downcase