FIX: Change the approach to sanitization. Includes a more detailed API

for allowing classes and attributes for only certain tag names.
This commit is contained in:
Robin Ward
2014-07-03 16:54:56 -04:00
parent cfeae239a8
commit fc1ce96dbb
10 changed files with 128 additions and 58 deletions

View File

@ -258,20 +258,11 @@ describe PrettyText do
PrettyText.cook("**a*_b**").should match_html "<p><strong>a*_b</strong></p>"
end
pending "small links" do
PrettyText.cook("<small>\nhttp://a.com\n<small>").should match_html "<p><small><br><a href=\"http://a.com\" rel=\"nofollow\">http://a.com</a><br></small></p>"
end
it "does not apply italics when there is a space inside" do
PrettyText.cook("** hello**").should match_html "<p>** hello**</p>"
PrettyText.cook("**hello **").should match_html "<p>**hello **</p>"
end
pending "allows comments through" do
PrettyText.cook("boom <!--comment-->").should match_html "<p>boom <!--comment--></p>"
end
it "allows does not bold chinese intra word" do
PrettyText.cook("你**hello**").should match_html "<p>你**hello**</p>"
end
@ -279,11 +270,6 @@ describe PrettyText do
it "allows bold chinese" do
PrettyText.cook("**你hello**").should match_html "<p><strong>你hello</strong></p>"
end
pending "does not break a streak for mentions" do
Fabricate(:user, username: 'sam')
PrettyText.cook("<small>a @sam c</small>").should match_html "<p><small>a <a class='mention' href='/users/sam'>@sam</a> c</small></p>"
end
end
end