Convert HTML document to use relative links ?



Is there is program to make all links relative in HTML documents
saved in wget -x fashion ? (http://foo.com/a/b.html saved as
./foo.com/a/b.html.)

For example,

- if ./foo.com/a/b.html contains <img src="/images/d.jpg">
and ./foo.com/images/d.jpg
exists, replace that tag <img src="../images/d.jpg">

- if ./foo.com/a/b.html contains <a href="http://bar.org/c.html";>
and ./bar.org/c.html
exists, replace that tag by <a href="../../bar.org/c.html">

I know about wget -k and it doesn't do what I need. My goal is use
wget or some such to have an exact mirror of the web site and then
make a _copy_ of the mirror that can be navigated off-line.

Thanks in advance.

--
André Majorel <http://www.teaser.fr/~amajorel/>
bugs.debian.org, a spammer's favourite.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: Convert HTML document to use relative links ?
    ... I know about wget -k and it doesn't do what I need. ... wget or some such to have an exact mirror of the web site and then ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Convert HTML document to use relative links ?
    ... I know about wget -k and it doesn't do what I need. ... wget or some such to have an exact mirror of the web site and then ... wget -k foo.com would pull from local exact copy as a local relative mirror. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: wget/curl cannot work on debian amd64
    ... I have a problem with using wget and curl on debian amd64 ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Non-free repo on DVD!
    ... So i found this scrip on the web: ... wget: invalid option -- f ... Try `wget --help' for more options. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: wget --post-data issue
    ... The roll number always have 10 as default, and there is a text-area to ... How can I use wget with --post-data option to send the ... I favor curl for stuff like this. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)