my ($self, $app, $conf) = @_;
$self->{app} = $app;
- for my $k (qw[boxes format_timestamp page_type content_type site_config]) {
+ for my $k (qw[boxes format_timestamp page_type content_type site_config
+ declare insert_code]) {
$app->helper($k => $self->can("_$k"))
}
}
+use constant MARKERS => qw(begin_footer);
+my $marker_contents = {};
+
+sub _insert_code {
+ my ($c, $marker, $content) = @_;
+ if(!$marker_contents->{$marker}) {
+ $marker_contents->{$marker} = [];
+ }
+ push @{$marker_contents->{$marker}}, $content;
+}
+
+sub _declare {
+ my ($c, $name) = @_;
+ my $contents = $marker_contents->{$name} || [];
+
+ return join("\n", @$contents);
+}
+
sub _generate_site_config {
my $c = shift;
my $epoch = $c->stash('epoch');