1 |
package neb::Tree::Tag; |
package neb::Tree::Tag; |
2 |
use strict; |
use strict; |
3 |
|
use English; |
4 |
use Carp; |
use Carp; |
5 |
use neb::Tree::Node; |
use neb::Tree::Node; |
6 |
use neb::Tree::Container; |
use neb::Tree::Container; |
11 |
sub init |
sub init |
12 |
{ |
{ |
13 |
my $self = shift; |
my $self = shift; |
14 |
$self->name(@_); |
my $name = shift; |
15 |
|
|
16 |
|
$self->name($name); |
17 |
$self->{ATTRS} = {}; |
$self->{ATTRS} = {}; |
18 |
|
$self->SUPER::init(@_); |
19 |
$DEBUG = $main::DEBUG; |
$DEBUG = $main::DEBUG; |
20 |
} |
} |
21 |
|
|
29 |
return $self->{NAME}; |
return $self->{NAME}; |
30 |
} |
} |
31 |
|
|
32 |
|
sub url |
33 |
|
{ |
34 |
|
my $self = shift; |
35 |
|
|
36 |
|
return $self->location . '::' . $self->name; |
37 |
|
} |
38 |
|
|
39 |
sub attribute |
sub attribute |
40 |
{ |
{ |
41 |
my $self = shift; |
my $self = shift; |
94 |
sub canonical_end |
sub canonical_end |
95 |
{ |
{ |
96 |
my $self = shift; |
my $self = shift; |
97 |
return '</' . $self->name . ($self->attribute('name') ? " " . $self->attribute('name') : '' ) . '>'; |
return '</' . $self->name . '>'; |
98 |
} |
} |
99 |
|
|
100 |
|
|
119 |
} |
} |
120 |
} |
} |
121 |
|
|
122 |
$code .= ">\"; \# Tag::code_start\n"; |
$code .= ">\";"; |
123 |
|
$code .= "\# Tag::code_start\n" if ($DEBUG); |
124 |
|
|
125 |
return $code; |
return $code; |
126 |
} |
} |
127 |
|
|
128 |
sub code_end |
sub code_middle |
129 |
{ |
{ |
130 |
my $self = shift; |
my $self = shift; |
131 |
|
|
132 |
my $code = ''; |
return $self->SUPER::code; |
133 |
|
} |
134 |
|
|
135 |
$code .= "# Tag::code_end:\n\t" if ($DEBUG); |
sub code_end |
136 |
|
{ |
137 |
|
my $self = shift; |
138 |
|
my $code = ''; |
139 |
|
|
140 |
|
$code .= "# Tag::code_end\n\t" if ($DEBUG); |
141 |
$code .= sprintf ("\$OUTPUT .= \"%s\";\n", $self->canonical_end); |
$code .= sprintf ("\$OUTPUT .= \"%s\";\n", $self->canonical_end); |
142 |
|
|
143 |
return $code; |
return $code; |
146 |
sub code |
sub code |
147 |
{ |
{ |
148 |
my $self = shift; |
my $self = shift; |
149 |
return $self->code_start . $self->SUPER::code . $self->code_end; |
|
150 |
|
return $self->code_start . $self->code_middle . $self->code_end; |
151 |
} |
} |
152 |
|
|
153 |
1; |
1; |