From: Konrad Meyer Date: 2007-08-11T08:06:19+09:00 Subject: Re: Creating a over a range while preserving nesting --nextPart2155894.2EC8YW2PYK Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 10 August 2007 08:28:38 am Burke Libbey wrote: > While this is a rails-related question, it has more to do with ruby in > general. >=20 > The user selects a range by highlighting it. This is detected with > javascript and fed to ruby. I want to take this range and highlight it. >=20 > I'm doing that by adding around the region. > So that works ok, except that this often causes tag nesting problems. > What I want to do is intelligently add more tag pairs to preserve > nesting. >=20 > For example, the range: >=20 > this is a test that uses pretty > bizarre markup. >=20 > Should become: >=20 > this is a test > that uses pretty bizarre markup. >=20 > I'm not looking for someone to write the code for me (although if you > did, I wouldn't complain); I just need someone to point me in the right > direction. Should I start from scratch with RegExes, or is there a > suitable library? >=20 > Thanks. >=20 > /burke You might look into Hpricot by _why or stdlib REXML. =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart2155894.2EC8YW2PYK Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGvO9vCHB0oCiR2cwRAjRvAKC0XGz7fLow6ng8Ko61fav4LRee8wCcDqed jR02QbJe5zIziT+4DgTD2MU= =mA1c -----END PGP SIGNATURE----- --nextPart2155894.2EC8YW2PYK--