line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# You may distribute under the terms of the GNU General Public License |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# (C) Paul Evans, 2008-2010 -- leonerd@leonerd.org.uk |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Circle::TaggedString; |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
95
|
|
8
|
4
|
|
|
4
|
|
28
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
94
|
|
9
|
4
|
|
|
4
|
|
14
|
use base qw( String::Tagged ); |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
1953
|
|
10
|
|
|
|
|
|
|
String::Tagged->VERSION( '0.11' ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.173320'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new_from_formatting |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
17
|
0
|
|
|
|
|
0
|
my ( $orig ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
return $class->clone( $orig, |
20
|
|
|
|
|
|
|
only_tags => [qw( bold under italic reverse monospace blockquote )], |
21
|
|
|
|
|
|
|
convert_tags => { |
22
|
|
|
|
|
|
|
bold => "b", |
23
|
|
|
|
|
|
|
under => "u", |
24
|
|
|
|
|
|
|
italic => "i", |
25
|
|
|
|
|
|
|
reverse => "rv", |
26
|
|
|
|
|
|
|
monospace => "m", |
27
|
|
|
|
|
|
|
blockquote => "bq", |
28
|
|
|
|
|
|
|
# TODO: fg/bg |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub squash |
34
|
|
|
|
|
|
|
{ |
35
|
3
|
|
|
3
|
0
|
11
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
6
|
my @output; |
38
|
|
|
|
|
|
|
$self->iter_substr_nooverlap( sub { |
39
|
3
|
|
|
3
|
|
281
|
my ( $str, %format ) = @_; |
40
|
3
|
50
|
|
|
|
13
|
push @output, %format ? [ $str, %format ] : $str; |
41
|
3
|
|
|
|
|
42
|
} ); |
42
|
|
|
|
|
|
|
|
43
|
3
|
50
|
33
|
|
|
73
|
return $output[0] if @output == 1 and !ref $output[0]; |
44
|
0
|
|
|
|
|
|
return \@output; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
0x55AA; |