line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: TEXT.pm 284 2006-12-01 07:51:49Z chronos $ |
2
|
|
|
|
|
|
|
package BBCode::Tag::TEXT; |
3
|
5
|
|
|
5
|
|
31
|
use base qw(BBCode::Tag); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
663
|
|
4
|
5
|
|
|
5
|
|
29
|
use BBCode::Util qw(encodeHTML multilineText); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
273
|
|
5
|
5
|
|
|
5
|
|
29
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
154
|
|
6
|
5
|
|
|
5
|
|
44
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2113
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub Class($):method { |
10
|
250
|
|
|
250
|
1
|
717
|
return qw(TEXT INLINE); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub NamedParams($):method { |
14
|
125
|
|
|
125
|
1
|
395
|
return qw(STR); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DefaultParam($):method { |
18
|
147
|
|
|
147
|
1
|
372
|
return 'STR'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub toBBCode($):method { |
22
|
108
|
|
|
108
|
1
|
300
|
my $this = shift; |
23
|
108
|
|
|
|
|
288
|
local $_ = $this->param('STR'); |
24
|
108
|
|
|
|
|
318
|
s/\[/[[/g; |
25
|
108
|
|
|
|
|
163
|
s/\]/]]/g; |
26
|
108
|
|
|
|
|
141
|
s/&/[ENT=amp]/g; |
27
|
108
|
|
|
|
|
159
|
s/<(?=UR[IL]:)/[ENT=lt]/gi; |
28
|
108
|
|
|
|
|
342
|
return multilineText $_; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub toHTML($):method { |
32
|
90
|
|
|
90
|
1
|
127
|
my $this = shift; |
33
|
90
|
|
|
|
|
270
|
my $html = encodeHTML($this->param('STR')); |
34
|
90
|
|
|
|
|
277
|
$html =~ s/
/\n/g; |
35
|
90
|
|
|
|
|
205
|
$html =~ s#(?=\n)# #g; |
36
|
90
|
|
|
|
|
253
|
return multilineText $html; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub toText($):method { |
40
|
5
|
|
|
5
|
1
|
12
|
return multilineText shift->param('STR'); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |