Skip to content

Instantly share code, notes, and snippets.

@ctm
Created March 2, 2019 16:25
Show Gist options
  • Save ctm/def95873ed7d40464bff24c1ac548680 to your computer and use it in GitHub Desktop.
Save ctm/def95873ed7d40464bff24c1ac548680 to your computer and use it in GitHub Desktop.
# This is just a portion of the (November 17th, 2007) file ...
def filtered_body(comment)
body = comment.body
if comment.posted_by =~ /href="mailto:jerseymcjones@gmail.com"/
parser = HTMLTree::XMLParser.new(false,false)
parser.feed("<html>#{body}</html>")
xml = parser.document
encheferize(xml.root)
body = ''
xml.write(body)
body.gsub!(%r{<html>|</html>},'')
comment.posted_by.gsub!('Jersey', 'Stockholm')
end
if comment.disappeared
body = '<span class="disappeared">' + body + '</span>'
end
body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment