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