blob: 61e4e57a8fac02878e0821dbd793d01a21d0ddf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# -*- encoding : utf-8 -*-
module AttachmentToHTML
module Adapters
# Convert text/plain documents in to HTML
class Text < Adapter
# Public: Was the document conversion successful?
#
# Returns a Boolean
def success?
has_content? || contains_images?
end
private
def convert
text = attachment.body.strip
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text)
text = text.gsub(/\n/, '<br>')
end
end
end
end
|