line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoMojo::Formatter::Main; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
17154
|
use parent 'MojoMojo::Formatter'; |
|
26
|
|
|
|
|
71
|
|
|
26
|
|
|
|
|
235
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
MojoMojo::Formatter::Main - MojoMojo's main formatter, dispatching between |
8
|
|
|
|
|
|
|
Textile and MultiMarkdown |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This is the main MojoMojo formatter, which transforms lightweight plain text |
13
|
|
|
|
|
|
|
markup into XHTML. It reads the site preference main_formatter and calls the |
14
|
|
|
|
|
|
|
corresponding formatter, either L<Text::Textile>, or L<Text::MultiMarkdown>. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 format_content_order |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Format order can be 1-99. The main formatter runs on 15. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
620
|
|
|
620
|
1
|
2431
|
sub format_content_order { 15 } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 format_content |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Calls the formatter. Takes a ref to the content as well as the context object. |
29
|
|
|
|
|
|
|
The latter is needed in order to determine the main formatter via a call to |
30
|
|
|
|
|
|
|
C<< $c->pref('main_formatter') >>. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub format_content { |
35
|
124
|
|
|
124
|
1
|
1076
|
my ( $class, $content, $c ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# dispatch to the preferred formatter |
38
|
124
|
100
|
|
|
|
623
|
if ($c->pref('main_formatter') eq 'MojoMojo::Formatter::Textile') { |
39
|
30
|
|
|
|
|
5819
|
require MojoMojo::Formatter::Textile; |
40
|
30
|
|
|
|
|
192
|
$$content = MojoMojo::Formatter::Textile->main_format_content($content); |
41
|
|
|
|
|
|
|
} else { |
42
|
94
|
|
|
|
|
19302
|
require MojoMojo::Formatter::Markdown; |
43
|
94
|
|
|
|
|
631
|
$$content = MojoMojo::Formatter::Markdown->main_format_content($content); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SEE ALSO |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L<MojoMojo>, L<Module::Pluggable::Ordered>, L<Text::Textile> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHORS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Marcus Ramberg <mramberg@cpan.org> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 LICENSE |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify |
58
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |