Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposed fix for comment bug #343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/cfm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def render(text)

def add_nofollow( html)
#redcarpet isn't adding nofollow like it is suppose to.
if html.match(/rel=["']nofollow["']/)
return html
end
html.scan(/(\<a href=["'].*?["']\>.*?\<\/a\>)/).flatten.each do |link|
if link.match(/\<a href=["'](http:\/\/|www){0,1}((coderwall.com)(\/.*?){0,1}|\/.*?)["']\>(.*?)\<\/a\>/)
else
Expand Down
10 changes: 10 additions & 0 deletions spec/helpers/protips_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
expect(helper.users_background_image).to be_nil
end
end

describe "comments" do
context "has comments" do
it "renders comment links correctly" do
expect(formatted_comment("http://www.google.com")).to eq "<p><a href=\"http://www.google.com\" rel=\"nofollow\">http://www.google.com</a></p>\n"
end
end
end


end

end