Browse Source

Don't clean HTML too much

tags/v0.2.0
aeris 2 years ago
parent
commit
91be33ac99
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      lib/cross-post/twitter.rb

+ 8
- 1
lib/cross-post/twitter.rb View File

@@ -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