|
|
@ -202,53 +202,54 @@ sub to_html |
|
|
|
$end ||= 'end'; |
|
|
|
$end ||= 'end'; |
|
|
|
|
|
|
|
|
|
|
|
my ($res, $temp); |
|
|
|
my ($res, $temp); |
|
|
|
my $pos = '1.0'; |
|
|
|
my $pos = '0.0'; |
|
|
|
my $chars = 0; |
|
|
|
my $chars = 0; |
|
|
|
my ($curtag, $prevtag) = ("", ""); |
|
|
|
my ($curtag, $prevtag) = ("", ""); |
|
|
|
my %all_tags; |
|
|
|
my %all_tags; |
|
|
|
|
|
|
|
|
|
|
|
while($self->{text}->index($pos) != $self->{text}->index('end')) |
|
|
|
while($self->{text}->index($pos) != $self->{text}->index('end')) |
|
|
|
{ |
|
|
|
{ |
|
|
|
%all_tags = (); |
|
|
|
%all_tags = (); |
|
|
|
$all_tags{$_} = $_ for $self->{text}->tagNames($pos); |
|
|
|
$all_tags{$_} = $_ for $self->{text}->tagNames($pos); |
|
|
|
delete $all_tags{'sel'}; |
|
|
|
delete $all_tags{'sel'}; |
|
|
|
delete $all_tags{'elide'}; |
|
|
|
delete $all_tags{'elide'}; |
|
|
|
delete $all_tags{''}; |
|
|
|
delete $all_tags{''}; |
|
|
|
|
|
|
|
|
|
|
|
if(scalar(keys %all_tags) == 0 && $prevtag eq "") |
|
|
|
if(scalar(keys %all_tags) == 0 && $prevtag eq "") |
|
|
|
{ |
|
|
|
{ |
|
|
|
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
|
|
|
$res .= $self->{text}->get($pos); |
|
|
|
$res .= $self->{text}->get($pos); |
|
|
|
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
|
|
|
$prevtag = ""; |
|
|
|
$prevtag = ""; |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$curtag = (keys %all_tags)[0] || ""; |
|
|
|
$curtag = (keys %all_tags)[0] || ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($prevtag =~ /$curtag/) |
|
|
|
if($prevtag =~ /$curtag/) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# tag added |
|
|
|
# tag added |
|
|
|
($temp = $prevtag) =~ s/$curtag//; |
|
|
|
($temp = $prevtag) =~ s/$curtag//; |
|
|
|
$res .= end_tag($temp); |
|
|
|
$res .= end_tag($temp); |
|
|
|
} |
|
|
|
} |
|
|
|
elsif($curtag =~ /$prevtag/) |
|
|
|
elsif($curtag =~ /$prevtag/) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# tag removed |
|
|
|
# tag removed |
|
|
|
($temp = $curtag) =~ s/$prevtag//; |
|
|
|
($temp = $curtag) =~ s/$prevtag//; |
|
|
|
$res .= $temp; |
|
|
|
$res .= $temp; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$prevtag = $curtag; |
|
|
|
$prevtag = $curtag; |
|
|
|
|
|
|
|
|
|
|
|
$res .= $self->{text}->get($pos); |
|
|
|
$res .= $self->{text}->get($pos); |
|
|
|
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
|
|
|
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $chr = chr(255); |
|
|
|
my $chr = chr(255); |
|
|
|
$res =~ s/$chr//g; |
|
|
|
$res =~ s/$chr//g; |
|
|
|
return $res; |
|
|
|
return $res; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub end_tag |
|
|
|
sub end_tag |
|
|
|
{ |
|
|
|
{ |
|
|
|
my ($tag) = @_; |
|
|
|
my ($tag) = @_; |
|
|
|