From: John Lam Date: 2005-04-29T00:05:37+09:00 Subject: Re: Is there a Ruby library that does HTML entity parsing? Steve, I've been using the URI lib quite a bit, but it doesn't parse entities. One feature that would be nice to add is one that calculates the URL for the directory that contains a document, given its complete URL. For example, consider: http://www.foo.com/bar/something.htm This document clearly lives in http://www.foo.com/bar/ This is required if you want to resolve document-relative URL links as in: ... which would send you to: http://www.foo.com/bar/otherpage.htm I've hacked this thing in for my own code, which was my first foray into ranges etc: def getDocumentRelativeUri(documentUri, uri_str) doc = documentUri.to_s return CGI.unescapeHTML(doc[0..doc.rindex('/')] + uri_str) end -John http://www.iunknown.com ________________________________ From: Steve Kellock [mailto:skellock@gmail.com] Sent: Thu 4/28/2005 10:30 AM To: ruby-talk ML Subject: Re: Is there a Ruby library that does HTML entity parsing? John, If you haven't yet, check out the URI lib that ships with ruby. It's pretty hot $%@*. Not sure if handles QSV's though. Maybe you could tell me? :) Steve On 4/28/05, John Lam wrote: > Simple stuff like > > mypage.htm?foo=abc&bar=1 => mypage.htm?foo=abc&bar=1 > > and its reverse? > > Thanks > -John > http://www.iunknown.com > >