#!/usr/bin/perl -w
use strict;
use HTML::TreeBuilder;
use HTML::Element;
my $root = HTML::TreeBuilder->new_from_file("index.section.html");
my @imgs = $root->find_by_tag_name('img');
foreach my $img (@imgs) {
my $new_parent = HTML::Element->new('a', 'href' => $img->attr('src'), 'rel' => 'lightbox');
$img->attr('class',"thumbnail");
$new_parent->push_content($img);
$img->replace_with($new_parent);
}
print $root->as_HTML();
$root->delete; # erase this tree because we're done with it
####
Ajax Requests