| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Kwiki::ShellBlocks; |
|
2
|
1
|
|
|
1
|
|
31485
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
36
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
1602
|
use Kwiki::Plugin '-Base'; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Kwiki::Installer '-Base'; |
|
6
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
const class_id => 'shell_blocks'; |
|
9
|
|
|
|
|
|
|
const class_title => 'Shell Blocks'; |
|
10
|
|
|
|
|
|
|
const css_file => 'shell_blocks.css'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub register { |
|
13
|
|
|
|
|
|
|
my $registry = shift; |
|
14
|
|
|
|
|
|
|
$registry->add(wafl => shell => 'Kwiki::ShellBlocks::Wafl'); |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Kwiki::ShellBlocks::Wafl; |
|
18
|
|
|
|
|
|
|
use base 'Spoon::Formatter::WaflBlock'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_html { |
|
21
|
|
|
|
|
|
|
return join '', |
|
22
|
|
|
|
|
|
|
qq{}, |
|
23
|
|
|
|
|
|
|
join("\n", map $self->render_line($_), split(/\n/, $self->block_text)), |
|
24
|
|
|
|
|
|
|
qq{}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub render_line { |
|
28
|
|
|
|
|
|
|
my $source = shift; |
|
29
|
|
|
|
|
|
|
$source =~ s/^(\s*)//; |
|
30
|
|
|
|
|
|
|
my $spaces = $1; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ($source =~ s/^([%\$]|\w:[\w\\]+>)//) { |
|
33
|
|
|
|
|
|
|
$source = "$1$source"; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
else { |
|
36
|
|
|
|
|
|
|
$source = "$source"; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$source =~ s{((?:\s|^)#\s.+)}{}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $spaces.$source; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package Kwiki::ShellBlocks; |
|
47
|
|
|
|
|
|
|
__DATA__ |