Skip to content

A platform for community discussion. Free, open, simple.

FIX: Spoiler logic should live inside of spoiler plugin

Blake Erickson9207c370d914
diff --git a/lib/excerpt_parser.rb b/lib/excerpt_parser.rb
index 24fc89792f6..4a2f483f36f 100644
--- a/lib/excerpt_parser.rb
+++ b/lib/excerpt_parser.rb
@@ -123,11 +123,6 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
@current_length = 0
@start_excerpt = true
end
- # Preserve spoilers
- if attributes.include?(["class", "spoiler"])
- include_tag("span", attributes)
- @in_spoiler = true
- end
when "details"
@detail_contents = +"" if @in_details_depth == 0
diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rb
index 11da34414cc..1a9118d08c0 100644
--- a/spec/components/pretty_text_spec.rb
+++ b/spec/components/pretty_text_spec.rb
@@ -589,11 +589,6 @@ describe PrettyText do
expect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>", 100, markdown_images: true)).to eq("![car](http://cnn.com/a.gif)")
end
- it "should keep spoilers" do
- expect(PrettyText.excerpt("<div class='spoiler'><img src='http://cnn.com/a.gif'></div>", 100)).to match_html "<span class='spoiler'>[image]</span>"
- expect(PrettyText.excerpt("<span class='spoiler'>spoiler</div>", 100)).to match_html "<span class='spoiler'>spoiler</span>"
- end
-
it "should keep details if too long" do
expect(PrettyText.excerpt("<details><summary>expand</summary><p>hello</p></details>", 6)).to match_html "<details class='disabled'><summary>expand</summary></details>"
end