| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
72992
|
use strictures 1; |
|
|
2
|
|
|
|
|
17
|
|
|
|
2
|
|
|
|
|
56
|
|
|
2
|
|
|
|
|
|
|
package Mojito::Page; |
|
3
|
|
|
|
|
|
|
{ |
|
4
|
|
|
|
|
|
|
$Mojito::Page::VERSION = '0.24'; |
|
5
|
|
|
|
|
|
|
} |
|
6
|
2
|
|
|
2
|
|
1858
|
use Moo; |
|
|
2
|
|
|
|
|
33911
|
|
|
|
2
|
|
|
|
|
13
|
|
|
7
|
2
|
|
|
2
|
|
4750
|
use Sub::Quote qw(quote_sub); |
|
|
2
|
|
|
|
|
8435
|
|
|
|
2
|
|
|
|
|
136
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Name |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Mojito::Page - the page delegator class |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 Description |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
An object to delegate to the Page family of objects. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 Synopsis |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Mojito::Page; |
|
22
|
|
|
|
|
|
|
my $page_source = $params->{content}; |
|
23
|
|
|
|
|
|
|
my $pager = Mojito::Page->new( page_source => $page_source); |
|
24
|
|
|
|
|
|
|
my $web_page = $pager->render_page; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# delegates |
|
29
|
2
|
|
|
2
|
|
1215
|
use Mojito::Page::Parse; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
97
|
|
|
30
|
2
|
|
|
2
|
|
1538
|
use Mojito::Page::Render; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Mojito::Page::CRUD; |
|
32
|
|
|
|
|
|
|
use Mojito::Page::Git; |
|
33
|
|
|
|
|
|
|
use Mojito::Page::Publish; |
|
34
|
|
|
|
|
|
|
use Mojito::Template; |
|
35
|
|
|
|
|
|
|
use Mojito::Model::Link; |
|
36
|
|
|
|
|
|
|
use Mojito::Collection::CRUD; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
with 'Mojito::Role::Config'; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# roles |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has parser => ( |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
isa => sub { die "Need a PageParse object. Have ref($_[0]) instead." unless $_[0]->isa('Mojito::Page::Parse') }, |
|
45
|
|
|
|
|
|
|
lazy => 1, |
|
46
|
|
|
|
|
|
|
handles => [ |
|
47
|
|
|
|
|
|
|
qw( |
|
48
|
|
|
|
|
|
|
page_structure |
|
49
|
|
|
|
|
|
|
) |
|
50
|
|
|
|
|
|
|
], |
|
51
|
|
|
|
|
|
|
writer => '_build_parse', |
|
52
|
|
|
|
|
|
|
default => sub { Mojito::Page::Parse->new } |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has render => ( |
|
56
|
|
|
|
|
|
|
is => 'ro', |
|
57
|
|
|
|
|
|
|
isa => sub { die "Need a PageRender object" unless $_[0]->isa('Mojito::Page::Render') }, |
|
58
|
|
|
|
|
|
|
handles => [ |
|
59
|
|
|
|
|
|
|
qw( |
|
60
|
|
|
|
|
|
|
render_page |
|
61
|
|
|
|
|
|
|
render_body |
|
62
|
|
|
|
|
|
|
intro_text |
|
63
|
|
|
|
|
|
|
) |
|
64
|
|
|
|
|
|
|
], |
|
65
|
|
|
|
|
|
|
writer => '_build_render', |
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has editer => ( |
|
69
|
|
|
|
|
|
|
is => 'ro', |
|
70
|
|
|
|
|
|
|
isa => sub { die "Need a PageEdit object" unless $_[0]->isa('Mojito::Page::CRUD') }, |
|
71
|
|
|
|
|
|
|
handles => [ |
|
72
|
|
|
|
|
|
|
qw( |
|
73
|
|
|
|
|
|
|
create |
|
74
|
|
|
|
|
|
|
read |
|
75
|
|
|
|
|
|
|
update |
|
76
|
|
|
|
|
|
|
delete |
|
77
|
|
|
|
|
|
|
db |
|
78
|
|
|
|
|
|
|
collection |
|
79
|
|
|
|
|
|
|
) |
|
80
|
|
|
|
|
|
|
], |
|
81
|
|
|
|
|
|
|
writer => '_build_edit', |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
has collector => ( |
|
85
|
|
|
|
|
|
|
is => 'ro', |
|
86
|
|
|
|
|
|
|
isa => sub { die "Need a Collection::CRUD object" unless $_[0]->isa('Mojito::Collection::CRUD') }, |
|
87
|
|
|
|
|
|
|
handles => [ qw( ) ], |
|
88
|
|
|
|
|
|
|
writer => '_build_collect', |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
has tmpl => ( |
|
92
|
|
|
|
|
|
|
is => 'ro', |
|
93
|
|
|
|
|
|
|
isa => sub { die "Need a Template object" unless $_[0]->isa('Mojito::Template') }, |
|
94
|
|
|
|
|
|
|
handles => [ |
|
95
|
|
|
|
|
|
|
qw( |
|
96
|
|
|
|
|
|
|
template |
|
97
|
|
|
|
|
|
|
home_page |
|
98
|
|
|
|
|
|
|
recent_links |
|
99
|
|
|
|
|
|
|
collect_page_form |
|
100
|
|
|
|
|
|
|
collections_index |
|
101
|
|
|
|
|
|
|
collection_page |
|
102
|
|
|
|
|
|
|
sort_collection_form |
|
103
|
|
|
|
|
|
|
fillin_create_page |
|
104
|
|
|
|
|
|
|
fillin_edit_page |
|
105
|
|
|
|
|
|
|
calendar_month_page |
|
106
|
|
|
|
|
|
|
wrap_page |
|
107
|
|
|
|
|
|
|
) |
|
108
|
|
|
|
|
|
|
], |
|
109
|
|
|
|
|
|
|
writer => '_build_template', |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has linker => ( |
|
113
|
|
|
|
|
|
|
is => 'ro', |
|
114
|
|
|
|
|
|
|
isa => sub { die "Need a Link Model object" unless $_[0]->isa('Mojito::Model::Link') }, |
|
115
|
|
|
|
|
|
|
handles => [ |
|
116
|
|
|
|
|
|
|
qw( |
|
117
|
|
|
|
|
|
|
get_recent_links |
|
118
|
|
|
|
|
|
|
get_feed_links |
|
119
|
|
|
|
|
|
|
view_collections_index |
|
120
|
|
|
|
|
|
|
view_collection_nav |
|
121
|
|
|
|
|
|
|
get_atom_feed |
|
122
|
|
|
|
|
|
|
) |
|
123
|
|
|
|
|
|
|
], |
|
124
|
|
|
|
|
|
|
writer => '_build_link', |
|
125
|
|
|
|
|
|
|
); |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
has gitter => ( |
|
128
|
|
|
|
|
|
|
is => 'ro', |
|
129
|
|
|
|
|
|
|
isa => sub { die "Need a PageGit object" unless $_[0]->isa('Mojito::Page::Git') }, |
|
130
|
|
|
|
|
|
|
handles => [ |
|
131
|
|
|
|
|
|
|
qw( |
|
132
|
|
|
|
|
|
|
commit_page |
|
133
|
|
|
|
|
|
|
rm_page |
|
134
|
|
|
|
|
|
|
diff_page |
|
135
|
|
|
|
|
|
|
search_word |
|
136
|
|
|
|
|
|
|
get_author_for |
|
137
|
|
|
|
|
|
|
) |
|
138
|
|
|
|
|
|
|
], |
|
139
|
|
|
|
|
|
|
writer => '_build_git', |
|
140
|
|
|
|
|
|
|
); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
has publisher => ( |
|
143
|
|
|
|
|
|
|
is => 'ro', |
|
144
|
|
|
|
|
|
|
isa => sub { die "Need a PagePublish object" unless $_[0]->isa('Mojito::Page::Publish') }, |
|
145
|
|
|
|
|
|
|
handles => [ qw( ) ], |
|
146
|
|
|
|
|
|
|
writer => '_build_publish', |
|
147
|
|
|
|
|
|
|
); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 Methods |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 BUILD |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Create the handler objects |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub BUILD { |
|
158
|
|
|
|
|
|
|
my $self = shift; |
|
159
|
|
|
|
|
|
|
my $constructor_args_href = shift; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
# Pass the config to the delegatees so they don't have to build it. |
|
162
|
|
|
|
|
|
|
$constructor_args_href->{config} = $self->config; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# pass the options into the subclasses |
|
165
|
|
|
|
|
|
|
$self->_build_parse(Mojito::Page::Parse->new($constructor_args_href)); |
|
166
|
|
|
|
|
|
|
$self->_build_render(Mojito::Page::Render->new($constructor_args_href)); |
|
167
|
|
|
|
|
|
|
$self->_build_edit(Mojito::Page::CRUD->new($constructor_args_href)); |
|
168
|
|
|
|
|
|
|
$self->_build_collect(Mojito::Collection::CRUD->new($constructor_args_href)); |
|
169
|
|
|
|
|
|
|
$self->_build_git(Mojito::Page::Git->new($constructor_args_href)); |
|
170
|
|
|
|
|
|
|
$self->_build_template(Mojito::Template->new($constructor_args_href)); |
|
171
|
|
|
|
|
|
|
$self->_build_link(Mojito::Model::Link->new($constructor_args_href)); |
|
172
|
|
|
|
|
|
|
$self->_build_publish(Mojito::Page::Publish->new($constructor_args_href)); |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
1 |