Skip to content

Commit

Permalink
Remove constructor and add uri attribute to HTML class.
Browse files Browse the repository at this point in the history
  • Loading branch information
racke committed Aug 8, 2016
1 parent ec2628a commit dd3a308
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions lib/Template/Flute/HTML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ use Template::Flute::Container;
use Template::Flute::List;
use Template::Flute::Form;
use Template::Flute::UriAdjust;
use Template::Flute::Types -types;

use Scalar::Util qw/blessed/;

use Moo;

=head1 NAME
Template::Flute::HTML - HTML Template Parser
Expand All @@ -27,28 +30,19 @@ Template::Flute::HTML - HTML Template Parser
$html_object->parse('<div class="example">Hello world</div>');
$html_object->parse_file($html_file, $spec);
=head1 CONSTRUCTOR
=head2 new
Create a Template::Flute::HTML object.
=cut
# constructor
=head1 ATTRIBUTES
sub new {
my ($class, $self);
=head2 uri
$class = shift;
URI value for adjusting the HTML to base URI.
my %args = @_;
=cut

$self = {%args, containers => {}, lists => {}, pagings => {}, forms => {},
params => {}, values => {}, query => {}, file => undef};

bless $self, $class;
}
has uri => (
is => 'ro',
isa => Maybe [ InstanceOf ['URI'] | Str ],
);

=head1 METHODS
Expand Down Expand Up @@ -418,7 +412,7 @@ sub _parse_handler {
$id = $elt->id();
$elt_name = $elt->att('name');

if ($self->{uri}) {
if ($self->uri) {
my %targets = (a => {link_att => 'href'},
base => {link_att => 'href'},
img => {link_att => 'src'},
Expand Down

0 comments on commit dd3a308

Please sign in to comment.