This project is archived and is in readonly mode.

#2017 ✓resolved
Duff OMelia

Should not html_escape auto_link block form

Reported by Duff OMelia | February 19th, 2009 @ 06:35 PM | in 3.x

When a block is given to auto_link, it allow us to customize the text of the link. Right now, the result of that block gets html_escaped. This works, unless the user wants the text of the link to actually be html tags. For example, in my site, I'm using auto_link to automatically show an image tag like so:


auto_link(stripped) { | each | each[/\.(jpg|gif|png|bmp|tif)$/] ? %Q{<img src="#{each}" width="160px" class="embeddedImage" /> } : each }

This code used to work when the result of the block wasn't html_escape'd. I think that if the user of the block form wants the link text html_escaped, they can do so in the block.

I attached a patch to make the adjustment. I'd also love to know if there's a better way to do what I'm trying to do. Thanks!

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages