Don't clean HTML too much

master
aeris 5 years ago
parent 6881206ca1
commit 91be33ac99
  1. 9
      lib/cross-post/twitter.rb

@ -31,8 +31,15 @@ class CrossPost
parts.each { |p| last = @client.update p, in_reply_to_status: last }
end
WHITESPACE_TAGS = {
'br' => { before: "\n", after: '' },
'div' => { before: "\n", after: "\n" },
'p' => { before: "\n", after: "\n" }
}.freeze
def post_status(status)
content = Sanitize.clean(status.content).strip
content = status.content
content = Sanitize.clean(content, whitespace_elements: WHITESPACE_TAGS).strip
content = CGI.unescape_html content
media = status.media_attachments.collect { |f| open f.url }

Loading…
Cancel
Save