mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
Allow images in the daily digest for top scoring posts
This commit is contained in:
@@ -105,6 +105,25 @@ test
|
||||
|
||||
describe "Excerpt" do
|
||||
|
||||
context "images" do
|
||||
it "should dump images" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif'>",100).should == "[image]"
|
||||
end
|
||||
|
||||
it "should keep alt tags" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif' alt='car' title='my big car'>",100).should == "[car]"
|
||||
end
|
||||
|
||||
it "should keep title tags" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>",100).should == "[car]"
|
||||
end
|
||||
|
||||
it "should convert images to markdown if the option is set" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>", 100, markdown_images: true).should == ""
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "should have an option to strip links" do
|
||||
PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>",100, strip_links: true).should == "cnn"
|
||||
end
|
||||
@@ -113,18 +132,6 @@ test
|
||||
PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>",100).should == "<a href='http://cnn.com'>cnn</a>"
|
||||
end
|
||||
|
||||
it "should dump images" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif'>",100).should == "[image]"
|
||||
end
|
||||
|
||||
it "should keep alt tags" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif' alt='car' title='my big car'>",100).should == "[car]"
|
||||
end
|
||||
|
||||
it "should keep title tags" do
|
||||
PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>",100).should == "[car]"
|
||||
end
|
||||
|
||||
it "should deal with special keys properly" do
|
||||
PrettyText.excerpt("<pre><b></pre>",100).should == ""
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user