line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::BBCode::Markdown; |
2
|
|
|
|
|
|
|
$Parse::BBCode::Markdown::VERSION = '0.15_001'; # TRIAL |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
488
|
$Parse::BBCode::Markdown::VERSION = '0.15001';use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
48
|
|
7
|
1
|
|
|
1
|
|
372
|
use URI::Escape; |
|
1
|
|
|
|
|
901
|
|
|
1
|
|
|
|
|
47
|
|
8
|
1
|
|
|
1
|
|
4
|
use base qw/ Parse::BBCode /; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
512
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %default_tags = ( |
11
|
|
|
|
|
|
|
'b' => '*%s*', |
12
|
|
|
|
|
|
|
'i' => '__%s__', |
13
|
|
|
|
|
|
|
'u' => '_%s_', |
14
|
|
|
|
|
|
|
# ![alt text](/path/to/img.jpg "Title") |
15
|
|
|
|
|
|
|
'img' => '![%s](%A)', |
16
|
|
|
|
|
|
|
'url' => 'url:[%s](%{link}A)', |
17
|
|
|
|
|
|
|
'email' => 'url:[%s](mailto:%{email}A)', |
18
|
|
|
|
|
|
|
'size' => '%s', |
19
|
|
|
|
|
|
|
'color' => '%s', |
20
|
|
|
|
|
|
|
'list' => 'block:%{parse}s', |
21
|
|
|
|
|
|
|
'*' => { |
22
|
|
|
|
|
|
|
parse => 1, |
23
|
|
|
|
|
|
|
output => "* %s\n", |
24
|
|
|
|
|
|
|
close => 0, |
25
|
|
|
|
|
|
|
class => 'block', |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
'quote' => { |
28
|
|
|
|
|
|
|
parse => 1, |
29
|
|
|
|
|
|
|
class => 'block', |
30
|
|
|
|
|
|
|
code => sub { |
31
|
|
|
|
|
|
|
my ($parser, $attr, $content, $attribute_fallback) = @_; |
32
|
|
|
|
|
|
|
$$content =~ s/^/> /gm; |
33
|
|
|
|
|
|
|
$$content =~ s/^> >/>>/gm; |
34
|
|
|
|
|
|
|
"$attribute_fallback:\n$$content\n"; |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
'code' => { |
38
|
|
|
|
|
|
|
code => sub { |
39
|
|
|
|
|
|
|
my ($parser, $attr, $content, $attribute_fallback) = @_; |
40
|
|
|
|
|
|
|
$$content =~ s/^/| /gm; |
41
|
|
|
|
|
|
|
return "Code $attribute_fallback:\n" . ('-' x 20) . "\n$$content\n" . ('-' x 20); |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
class => 'block', |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
'' => sub { |
46
|
|
|
|
|
|
|
my $text = $_[2]; |
47
|
|
|
|
|
|
|
$text; |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my %optional_tags = ( |
52
|
|
|
|
|
|
|
# Parse::BBCode::HTML->optional(), |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my %default_escapes = ( |
56
|
|
|
|
|
|
|
Parse::BBCode::HTML->default_escapes |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub defaults { |
61
|
1
|
|
|
1
|
1
|
1
|
my ($class, @keys) = @_; |
62
|
|
|
|
|
|
|
return @keys |
63
|
1
|
50
|
|
|
|
12
|
? (map { $_ => $default_tags{$_} } grep { defined $default_tags{$_} } @keys) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
64
|
|
|
|
|
|
|
: %default_tags; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub default_escapes { |
68
|
1
|
|
|
1
|
1
|
1
|
my ($class, @keys) = @_; |
69
|
|
|
|
|
|
|
return @keys |
70
|
1
|
50
|
|
|
|
6
|
? (map { $_ => $default_escapes{$_} } grep { defined $default_escapes{$_} } @keys) |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
: %default_escapes; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub optional { |
75
|
0
|
|
|
0
|
1
|
|
my ($class, @keys) = @_; |
76
|
0
|
0
|
|
|
|
|
return @keys ? (grep defined, @optional_tags{@keys}) : %optional_tags; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |