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

white_list doesn't do textile replacements on "site":http://whatever.com formats #3

Open
mpt opened this issue Feb 7, 2011 · 0 comments

Comments

@mpt
Copy link

mpt commented Feb 7, 2011

in white_list_formatted_content/init.rb:

def body_html_with_formatting
  body_html = auto_link(body) { |text| truncate(text, 50) }
  textilized = RedCloth.new(body_html, [ :hard_breaks ])
  textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
  white_list(textilized.to_html)
end

Since auto_link is called first, RedCloth will never see something of the form "site":, and so will never set up the link properly. I got around this by overriding this method in a separate file under my /lib directory:

def body_html_with_formatting
  # COMMENTED OUT to fix problem where "site":<url> was never getting processed
  #body_html = auto_link(body) { |text| truncate(text, 50) }
  textilized = RedCloth.new(body, [ :hard_breaks ])
  textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
  white_list(textilized.to_html)
end

Anyone else?

Jack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant