HTML-Encapsulate

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    could be a post, or any other request returning HTML) in the directory
    $download_dir, plus all images and other dependencies needed to render
    it.

    The main HTML document will be saved in $download_dir as 'index.html'.
    Other dependencies will be saved with filenames composed of an index
    number (1 for the first item saved, 2 for the second, etc.), plus an
    extension (taken from the source URL).

    By design, this function will dowload but not attempt to process
    non-html content (i.e. if the 'content-type' header does not end in
    html). Note also that I've been lazy, so it will still save the content
    with as "index.html" as for a HTML page.

    The content of the HTML is re-written so that links to dependencies
    refer to the downloaded files. External dependencies (anything not
    downloaded) are left as-is.

    The following dependencies *are* handled:

    *   "<img href="...">" linked images

lib/HTML/Encapsulate.pm  view on Meta::CPAN

(which could be a post, or any other request returning HTML) in the
directory C<$download_dir>, plus all images and other dependencies needed
to render it.

The main HTML document will be saved in C<$download_dir> as
'index.html'.  Other dependencies will be saved with filenames
composed of an index number (1 for the first item saved, 2 for the
second, etc.), plus an extension (taken from the source URL).

By design, this function will dowload but not attempt to process
non-html content (i.e. if the 'content-type' header does not end in
html).  Note also that I've been lazy, so it will still save the
content with as C<index.html> as for a HTML page.

The content of the HTML is re-written so that links to dependencies
refer to the downloaded files.  External dependencies (anything not
downloaded) are left as-is.

The following dependencies I<are> handled:

=over 4

t/data/html-encapsulate/iso-8859-1/mock_data/88fc2536dcb9da1666de4e5507f4aae6-response-001.html  view on Meta::CPAN

HTTP/1.1 200 OK
Content-Type: text/html
Title: Logon

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="en">
<head>
  <title>Test</title>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

  <link rel=stylesheet type="text/css" href="/css/global.css">
  <link rel=Stylesheet type="text/css" href="/css/global2.css">

  <style type="text/css">
  @import "/css/import.css";
 
  .backdrop { 
    background-image: url(backdrop.jpg)
  }

t/data/html-encapsulate/iso-8859-1/reference/nowhere/index.html  view on Meta::CPAN

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head><title>Test</title><meta content="text/html; charset=utf-8" http-equiv="content-type" /><link href="4.css" rel="stylesheet" type="text/css" /><link href="7.css" rel="Stylesheet" type="text/css" /><style type="text/css">
  @import url(9.css);
 
  .backdrop { 
    background-image: url(12.jpg)
  }
</style><script src="8.js" type="text/javascript">
</script> </head><body class="backdrop"><p class="white">An image: <img alt="foo" src="1.png" /><script type="text/javascript">
var dummy = 1;
</script><p class="bimage">A paragraph<form class="border green"><p>A form. Input Button <input name="button" src="2.png" type="button" value="a button" /><br /> Input Image <input name="image" src="3.png" type="image" value="an image" /></form><span...

t/data/html-encapsulate/utf-8/mock_data/88fc2536dcb9da1666de4e5507f4aae6-response-001.html  view on Meta::CPAN

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Title: Logon

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="en">
<head>
  <title>Test</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <link rel=stylesheet type="text/css" href="/css/global.css">
  <link rel=Stylesheet type="text/css" href="/css/global2.css">

  <style type="text/css">
  @import "/css/import.css";
 
  .backdrop { 
    background-image: url(backdrop.jpg)
  }

t/data/html-encapsulate/utf-8/reference/nowhere/index.html  view on Meta::CPAN

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head><title>Test</title><meta content="text/html; charset=utf-8" http-equiv="content-type" /><link href="4.css" rel="stylesheet" type="text/css" /><link href="7.css" rel="Stylesheet" type="text/css" /><style type="text/css">
  @import url(9.css);
 
  .backdrop { 
    background-image: url(12.jpg)
  }
</style><script src="8.js" type="text/javascript">
</script> </head><body class="backdrop"><p class="white">An image: <img alt="foo" src="1.png" /><script type="text/javascript">
var dummy = 1;
</script><p class="bimage">A paragraph<form class="border green"><p>A form. Input Button <input name="button" src="2.png" type="button" value="a button" /><br /> Input Image <input name="image" src="3.png" type="image" value="an image" /></form><span...

t/data/html-encapsulate/utf-8_charset-in-meta/mock_data/88fc2536dcb9da1666de4e5507f4aae6-response-001.html  view on Meta::CPAN

HTTP/1.1 200 OK
Content-Type: text/html
Title: Logon

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="en">
<head>
  <title>Test</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <link rel=stylesheet type="text/css" href="/css/global.css">
  <link rel=Stylesheet type="text/css" href="/css/global2.css">

  <style type="text/css">
  @import "/css/import.css";
 
  .backdrop { 
    background-image: url(backdrop.jpg)
  }

t/data/html-encapsulate/utf-8_charset-in-meta/reference/nowhere/index.html  view on Meta::CPAN

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head><title>Test</title><meta content="text/html; charset=utf-8" http-equiv="content-type" /><link href="4.css" rel="stylesheet" type="text/css" /><link href="7.css" rel="Stylesheet" type="text/css" /><style type="text/css">
  @import url(9.css);
 
  .backdrop { 
    background-image: url(12.jpg)
  }
</style><script src="8.js" type="text/javascript">
</script> </head><body class="backdrop"><p class="white">An image: <img alt="foo" src="1.png" /><script type="text/javascript">
var dummy = 1;
</script><p class="bimage">A paragraph<form class="border green"><p>A form. Input Button <input name="button" src="2.png" type="button" value="a button" /><br /> Input Image <input name="image" src="3.png" type="image" value="an image" /></form><span...



( run in 1.194 second using v1.01-cache-2.11-cpan-d7f47b0818f )