Created
March 2, 2019 16:25
-
-
Save ctm/def95873ed7d40464bff24c1ac548680 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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