From: Max Williams Date: 2009-07-20T18:50:40+09:00 Subject: Re: Hpricot - strip out images and show first x words 7stud -- wrote: >> So, ideally i would preserve the start and end tags and >> strip the content down to 25 words. > > It's easy enough to slap a "

" on the end. But something else you > might not have considered is: what if the 25th word is inside a tag, for > instance: > > on the end isn't enough because there could be a load of unfinished tags - for example, half a p tag with half an a tag inside it. Anything really. That's why ideally i would just consider the inner content of tags and when it comes to tags inside tags, either remove them completely or leave them as they are. This seems like such a common thing on the net, to have a short section followed by 'read more' for example, that i thought there would be an easy way to do it. -- Posted via http://www.ruby-forum.com/.