84 |
return "<code>$dump</code>"; |
return "<code>$dump</code>"; |
85 |
} |
} |
86 |
|
|
87 |
|
sub popup { my $self = shift; $self->popup_dropdown('popup', @_); } |
88 |
|
sub dropdown { my $self = shift; $self->popup_dropdown('dropdown', @_); } |
89 |
|
|
90 |
|
our $re_html = qr{<(?:!--.+?--|(\w+).+?/\1)>}s; # relaxed html check for one semi-valid tag |
91 |
|
|
92 |
|
sub popup_dropdown { |
93 |
|
my ( $self, $type, $name, $content, $full ) = @_; |
94 |
|
|
95 |
|
$content = $self->html_dump($content) if ref $content; |
96 |
|
|
97 |
|
$content = qq|<span>$content</span>| unless $content =~ m{^\s*<(span|a|code).+?/\1>\s*}; |
98 |
|
|
99 |
|
warn "## $type [$name] = ", length( $content ), " bytes" if $self->debug; |
100 |
|
|
101 |
|
if ( $name =~ m{::} && $name !~ $re_html ) { |
102 |
|
return qq|<a class="frey-$type" target="$name" href="/$name">$name $content</a>\n|; |
103 |
|
} else { |
104 |
|
return qq|<span class="frey-$type">$name $content</span>\n|; |
105 |
|
} |
106 |
|
} |
107 |
|
|
108 |
sub dom2html { |
sub dom2html { |
109 |
# warn "## dom2html ",dump( @_ ); |
# warn "## dom2html ",dump( @_ ); |
110 |
return Continuity::Widget::DomNode->create( @_ )->to_string; |
return Continuity::Widget::DomNode->create( @_ )->to_string; |
153 |
return if ! defined $path || $path eq ''; |
return if ! defined $path || $path eq ''; |
154 |
$path =~ s!^/!!; |
$path =~ s!^/!!; |
155 |
|
|
156 |
if ( $path =~ m{<.*>}s ) { |
if ( $path =~ $re_html ) { |
157 |
push @{ $self->head }, $path; |
push @{ $self->head }, $path; |
158 |
} elsif ( -e $path ) { |
} elsif ( -e $path ) { |
159 |
if ( $path =~ m/\.(?:js|css)$/ ) { |
if ( $path =~ m/\.(?:js|css)$/ ) { |
186 |
|
|
187 |
our $icon_html; |
our $icon_html; |
188 |
|
|
|
sub popup { my $self = shift; $self->popup_dropdown('popup', @_); } |
|
|
sub dropdown { my $self = shift; $self->popup_dropdown('dropdown', @_); } |
|
|
|
|
|
sub popup_dropdown { |
|
|
my ( $self, $type, $name, $content, $full ) = @_; |
|
|
|
|
|
if ( ref($content) ) { |
|
|
$content = $self->html_dump($content); |
|
|
# my $l = length($content); |
|
|
# $content = qq|<span>$l bytes</span>| if ! $full && $l > $self->dump_max_bytes; |
|
|
} else { |
|
|
$content = qq|<span>$content</span>|; |
|
|
} |
|
|
|
|
|
warn "## $type [$name] = ", length( $content ), " bytes" if $self->debug; |
|
|
|
|
|
if ( $name =~ m{::} && ! $name =~ m{<(\w+).+?/\1>} ) { |
|
|
return qq|<a class="frey-$type" target="$name" href="/$name">$name $content</a>\n|; |
|
|
} else { |
|
|
return qq|<span class="frey-$type">$name $content</span>\n|; |
|
|
} |
|
|
} |
|
|
|
|
189 |
sub page { |
sub page { |
190 |
my $self = shift; |
my $self = shift; |
191 |
my $a = {@_}; |
my $a = {@_}; |