mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +08:00
FEATURE: stop escaping special chars in title prettify
This feature is confusting and just leads to inconsistency
This commit is contained in:
parent
9364d8ce71
commit
82ca0e368e
|
@ -120,9 +120,6 @@ class HtmlPrettify < String
|
|||
unless in_pre
|
||||
|
||||
t.gsub!("'", "'")
|
||||
|
||||
t = process_escapes t
|
||||
|
||||
t.gsub!(""", '"')
|
||||
|
||||
if do_dashes
|
||||
|
@ -176,22 +173,6 @@ class HtmlPrettify < String
|
|||
|
||||
protected
|
||||
|
||||
# Return the string, with after processing the following backslash
|
||||
# escape sequences. This is useful if you want to force a "dumb" quote
|
||||
# or other character to appear.
|
||||
#
|
||||
# Escaped are:
|
||||
# \\ \" \' \. \- \`
|
||||
#
|
||||
def process_escapes(str)
|
||||
str = str.gsub('\\\\', '\')
|
||||
str.gsub!('\"', '"')
|
||||
str.gsub!("\\\'", ''')
|
||||
str.gsub!('\.', '.')
|
||||
str.gsub!('\-', '-')
|
||||
str.gsub!('\`', '`')
|
||||
str
|
||||
end
|
||||
|
||||
# The string, with each instance of "<tt>--</tt>" translated to an
|
||||
# em-dash HTML entity.
|
||||
|
|
|
@ -24,6 +24,8 @@ describe HtmlPrettify do
|
|||
|
||||
t 'src="test.png"> yay', "src=“test.png”> yay"
|
||||
|
||||
t '\\\\mnt\\c', "\\\\mnt\\c"
|
||||
|
||||
t ERB::Util.html_escape('<img src="test.png"> yay'), "<img src=“test.png”> yay"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user