line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## |
2
|
|
|
|
|
|
|
# name: Stardoc::Kwim |
3
|
|
|
|
|
|
|
# abstract: Stardoc Kwim Module |
4
|
|
|
|
|
|
|
# author: Ingy döt Net |
5
|
|
|
|
|
|
|
# license: perl |
6
|
|
|
|
|
|
|
# copyright: 2011 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# XXX Remove this early dep on WikiText. |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1931
|
use 5.008003; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
11
|
|
|
|
|
|
|
package Stardoc::Kwim; |
12
|
1
|
|
|
1
|
|
861
|
use WikiText 0.15 (); |
|
1
|
|
|
|
|
248
|
|
|
1
|
|
|
|
|
20
|
|
13
|
1
|
|
|
1
|
|
15
|
use base 'WikiText'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
201
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub to_html { |
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
19
|
0
|
|
|
|
|
|
my $parser_class = ref($self) . '::Parser'; |
20
|
0
|
0
|
|
|
|
|
eval "require $parser_class; 1" |
21
|
|
|
|
|
|
|
or die "Can't load $parser_class:\n$@"; |
22
|
0
|
|
|
|
|
|
require WikiText::HTML::Emitter; |
23
|
0
|
|
|
|
|
|
my $parser = $parser_class->new( |
24
|
|
|
|
|
|
|
receiver => WikiText::HTML::Emitter->new(break_lines => 1), |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $parser->parse($self->{wikitext}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use Stardoc::Kwim; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $html = Stardoc::Kwim->new($kwim)->to_html; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This module can convert Kwim markup to HTML. |