highlight (ActionView::Helpers::TextHelper)

Discussion in 'Ruby' started by flornet@gmail.com, Sep 5, 2006.

  1. Guest

    I'm using that helper function with a search form to highlight the
    typed phrase in the content BUT when my content is HTML, I'll get
    replacement where I don't want to.

    For instance :

    @page.content = "<p><a href='ajaxian.com' title='Ajaxian.com'><img
    src='ajax-image.gif' alt='Ajax Image'/>My text containing AJAX</a></p>"

    What I get :
    highlight (@page.content, 'ajax')

    => <p><a href='<span class="highlight">ajax</span>ian.com' title='<span
    class="highlight">Ajax</span>ian.com'><img src='<span
    class="highlight">ajax</span>-image.gif' alt='<span
    class="highlight">Ajax</span> Image'/>My text containing <span
    class="highlight">ajax</span></a></p>

    What I want to get :
    highlight (@page.content, 'ajax')

    => <p><a href='ajaxian.com' title='Ajaxian.com'><img
    src='ajax-image.gif' alt='Ajax Image'/>My text containing <span
    class="highlight">ajax</span></a></p>

    Don't know much to RegExp, is this possible to do ?
     
    , Sep 5, 2006
    #1
    1. Advertising

  2. Eric Hodel Guest

    On Sep 5, 2006, at 1:45 AM, wrote:

    > I'm using that helper function with a search form to highlight the
    > typed phrase in the content BUT when my content is HTML, I'll get
    > replacement where I don't want to.


    You want to ask this question on the Rails mailing list. This list
    is for general ruby questions.

    --
    Eric Hodel - - http://blog.segment7.net
    This implementation is HODEL-HASH-9600 compliant

    http://trackmap.robotcoop.com
     
    Eric Hodel, Sep 5, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Per Magnus L?vold
    Replies:
    0
    Views:
    1,388
    Per Magnus L?vold
    Nov 15, 2004
  2. Magnus Jonneryd

    Templates and helpers.

    Magnus Jonneryd, Oct 6, 2005, in forum: C++
    Replies:
    4
    Views:
    307
    Magnus Jonneryd
    Oct 6, 2005
  3. Wolfgang Nádasi-Donner
    Replies:
    1
    Views:
    153
    James Britt
    Feb 4, 2007
  4. Dhaval Phansalkar
    Replies:
    0
    Views:
    88
    Dhaval Phansalkar
    May 15, 2008
  5. Gerald Bauer
    Replies:
    0
    Views:
    114
    Gerald Bauer
    Feb 25, 2009
Loading...

Share This Page