2 use warnings FATAL => 'all';
10 sub show_landing_html {
12 title => "Welcome to the Demo Home",
14 new_user_link => 'create_user.html',
18 sub show_landing_events {
19 as_events(\&landing, (
20 title => "Welcome to the Demo Home",
22 new_user_link => 'create_user.html',
28 \'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ',
29 \'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
32 <!-- here is a comment -->,
33 <title>, ($data{title} || 'Hello World'), </title>,
43 <p>, "Hi, I'm version: $data{site_version}", </p>,
44 <p>, "Here's some interesting things about me", </p>,
45 <img src="smilyface.png" alt="smiles" />,
47 <li>, <a href="/user">, "My Users", </li>,
48 <li>, <a href="/user/$data{new_user_link}">, "Create", "New User", </li>,
52 sub process_templates {
53 my ($templates, %data) = @_;
54 for my $template(@$templates) {
55 my @processed = $template->(%data);
56 $data{content} = \@processed;
58 return @{$data{content}};
62 my ($template, %data) = @_;
63 my @content = process_templates([$template, \&layout], %data);
64 return join '', HTML::Tags::to_html_string(@content);
68 my ($template, %data) = @_;
69 my @content = process_templates([$template, \&layout], %data);
70 return [HTML::Tags::to_zoom_events(@content)];
74 ok my $html = BasicPage->show_landing_html;
75 ok my $zoom = HTML::Zoom->from_html($html);
76 ok my $events = BasicPage->show_landing_events;
78 is_deeply $zoom->to_events, $events,
79 'Made HZoom events from XMLTags';
81 #use Data::Dump 'dump';
83 #warn dump $zoom->to_events;
84 #warn "======================";