Commit | Line | Data |
5802b80a |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
3 | |
4 | use HTML::Zoom; |
5 | use Test::More; |
6 | |
ffa1cdfa |
7 | ok 1, 'stub for wrapping or layout helpers'; |
8 | |
5802b80a |
9 | done_testing; |
10 | |
11 | =head2 wrap_with |
12 | |
13 | my $layout = HTML::Zoom->from_html(<<HTML); |
14 | <html> |
15 | <head> |
16 | <title>Default Title</title> |
17 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
18 | <meta name="keywords" content="my special website" /> |
19 | <link rel="shortcut icon" href="/favicon.ico" /> |
20 | <link rel="stylesheet" href="/css/core.css" type="text/css" /> |
21 | </head> |
22 | </body id="content-area"> |
23 | <div>Default Content</div> |
24 | </body> |
25 | </html> |
26 | HTML |
27 | |
28 | my $content = HTML::Zoom->from_html(<<HTML); |
29 | <html> |
30 | <head> |
31 | <title>My Awesome Page</title> |
32 | </head> |
33 | </body> |
34 | <h1>Special Page</h1> |
35 | <p>Here is some content</p> |
36 | </body> |
37 | </html> |
38 | HTML |
39 | |
40 | $content |
41 | ->template($layout) ## is a wrap object of some sort |
42 | ->match('title') |
43 | ->match('body') |
44 | ->apply |
45 | |
46 | ## ^^ would be similar to: |
47 | |
48 | my (@title, @body); |
49 | $content |
50 | ->select('title') |
51 | ->collect_content({into => \@title}) |
52 | ->select('body') |
53 | ->collect_content({into => \@body}) |
54 | ->run; |
55 | |
56 | $layout |
57 | ->select('title') |
58 | ->replace_content(\@title); |
59 | ->select('body') |
60 | ->replace_content(\@body); |
61 | ->... |
62 | |
63 | =cut |