Minor Cleanups
Remove a no-longer-needed function. ' -> &39; Fix regexp for tag chunk.
This commit is contained in:
parent
f6508de6dd
commit
ca1e8de89c
|
@ -18,7 +18,7 @@ class Category < Chunk::Abstract
|
||||||
def initialize(match_data, content)
|
def initialize(match_data, content)
|
||||||
super(match_data, content)
|
super(match_data, content)
|
||||||
@hidden = match_data[1]
|
@hidden = match_data[1]
|
||||||
@list = match_data[2].split(',').map { |c| c.to_s.is_utf8? ? html_escape(c.strip) : nil }
|
@list = match_data[2].split(',').map { |c| c.to_s.is_utf8? ? c.strip.escapeHTML : nil }
|
||||||
@list.compact!
|
@list.compact!
|
||||||
@unmask_text = ''
|
@unmask_text = ''
|
||||||
if @hidden
|
if @hidden
|
||||||
|
|
|
@ -78,14 +78,6 @@ module Chunk
|
||||||
@content.delete_chunk(self)
|
@content.delete_chunk(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def html_escape(string)
|
|
||||||
string.gsub( /&/, "&" ).
|
|
||||||
gsub( /</, "<" ).
|
|
||||||
gsub( />/, ">" ).
|
|
||||||
gsub( /'/, "'" ).
|
|
||||||
gsub( /"/, """ )
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Literal
|
||||||
|
|
||||||
# A literal chunk that protects HTML tags from wiki rendering.
|
# A literal chunk that protects HTML tags from wiki rendering.
|
||||||
class Tags < AbstractLiteral
|
class Tags < AbstractLiteral
|
||||||
TAGS_PATTERN = Regexp.new('<[a-zA-Z]+[^>]*?>', Regexp::MULTILINE)
|
TAGS_PATTERN = Regexp.new('<[-a-zA-Z]+[^>]*?>', Regexp::MULTILINE)
|
||||||
def self.pattern() TAGS_PATTERN end
|
def self.pattern() TAGS_PATTERN end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2215,7 +2215,7 @@ class String
|
||||||
self.gsub( /&/, "&" ).
|
self.gsub( /&/, "&" ).
|
||||||
gsub( /</, "<" ).
|
gsub( /</, "<" ).
|
||||||
gsub( />/, ">" ).
|
gsub( />/, ">" ).
|
||||||
gsub(/'/, "'" ).
|
gsub(/'/, "'" ).
|
||||||
gsub(/"/, """ )
|
gsub(/"/, """ )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
"name": "IE_Comments",
|
"name": "IE_Comments",
|
||||||
"input": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->",
|
"input": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->",
|
||||||
"output": "",
|
"output": "",
|
||||||
"xhtml": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->"
|
"xhtml": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "IE_Comments_2",
|
"name": "IE_Comments_2",
|
||||||
"input": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
|
"input": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
|
||||||
"output": "<script>alert('XSS');</script>",
|
"output": "<script>alert('XSS');</script>",
|
||||||
"xhtml": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
|
"xhtml": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
|
||||||
"rexml": "Ill-formed XHTML!"
|
"rexml": "Ill-formed XHTML!"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_difficult_wiki_words
|
def test_difficult_wiki_words
|
||||||
@revision.content = "[[It's just awesome GUI!]]"
|
@revision.content = "[[It's just awesome GUI!]]"
|
||||||
assert_equal "<p><span class='newWikiWord'>It's just awesome GUI!" +
|
assert_equal "<p><span class='newWikiWord'>It's just awesome GUI!" +
|
||||||
"<a href='../show/It%27s+just+awesome+GUI%21'>?</a></span></p>",
|
"<a href='../show/It%27s+just+awesome+GUI%21'>?</a></span></p>",
|
||||||
test_renderer(@revision).display_content
|
test_renderer(@revision).display_content
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue