mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 04:34:13 -06: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
|
unless in_pre
|
||||||
|
|
||||||
t.gsub!("'", "'")
|
t.gsub!("'", "'")
|
||||||
|
|
||||||
t = process_escapes t
|
|
||||||
|
|
||||||
t.gsub!(""", '"')
|
t.gsub!(""", '"')
|
||||||
|
|
||||||
if do_dashes
|
if do_dashes
|
||||||
@ -176,22 +173,6 @@ class HtmlPrettify < String
|
|||||||
|
|
||||||
protected
|
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
|
# The string, with each instance of "<tt>--</tt>" translated to an
|
||||||
# em-dash HTML entity.
|
# em-dash HTML entity.
|
||||||
|
@ -24,6 +24,8 @@ describe HtmlPrettify do
|
|||||||
|
|
||||||
t 'src="test.png"> yay', "src=“test.png”> yay"
|
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"
|
t ERB::Util.html_escape('<img src="test.png"> yay'), "<img src=“test.png”> yay"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user