Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Is there a Ruby library that does HTML entity parsing?
John Lam
4/28/2005 3:49:00 PM
Thanks for the pointer, Ilmari! Just checked and it works fine under Windows.
-John
http://www.iu...
________________________________
From: Ilmari Heikkinen [mailto:kig@misfiring.net]
Sent: Thu 4/28/2005 11:40 AM
To: ruby-talk ML
Subject: Re: Is there a Ruby library that does HTML entity parsing?
On 28.4.2005, at 18:05, John Lam wrote:
> 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.fo...
som...
>
> This document clearly lives in
>
>
http://www.fo...
>
This can also be done using File.split / dirname / basename:
File.dirname "
http://foo.com/bar/stuff....
#=> "
http://foo.com...
File.basename "
http://foo.com/bar/stuff....
#=> "stuff.html"
File.split "
http://foo.com/bar/stuff....
#=> ["
http://foo.com...
, "stuff.html"]
File.join( File.dirname("
http://foo.com/bar/doc....
),
"relative_link.html" )
# => "
http://foo.com/bar/relative_link....
Though that probably breaks on Windows since it has backslashes for
directory separators.
Cheers,
Ilmari Heikkinen
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Is there a Ruby library that does HTML entity parsing?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password