+#!/usr/bin/env perl
+
package SCSite;
use IO::All;
sub default_config {
(
- pages_dir => 'share/content',
- template_dir => 'share/skin',
+ pages_dir => 'share/pages',
+ template_dir => 'share/templates',
+ static_dir => 'share/static',
feed_id_prefix => 'http://shadow.cat',
)
}
my $zoom = $self->_layout_zoom;
my %filters = %{$self->filters};
$zoom->select('.page.title')->replace_content($page->title)
- ->select('meta[name=description]')->replace_content($page->description)
- ->select('meta[name=keywords]')->replace_content($page->keywords)
- ->select('.main')->replace_content(\$page->body)
+ ->select('.page.subtitle')->${\sub {
+ $page->subtitle
+ ? $_[0]->replace_content($page->subtitle)
+ : $_[0]->replace('')
+ }}
+ ->select('.page.published_at')->replace_content($page->published_at)
+ ->select('meta[name=description]')
+ ->set_attribute(content => $page->description)
+ ->select('meta[name=keywords]')
+ ->set_attribute(content => $page->keywords)
+ ->select('meta[name=created]')
+ ->set_attribute(content => $page->created)
+ ->select('.page.body')->replace_content(\$page->body)
->apply(sub {
foreach my $fname (sort keys %filters) {
my $cb = $filters{$fname}->callback_for($page);
my $class = shift;
my @config_keys = keys %{{$class->default_config}};
require Getopt::Long;
- my %config;
+ my %config = map +($_ => $ENV{"SCS_${\uc $_}"}), @config_keys;
Getopt::Long::GetOptions(
map +("$_=s" => \$config{$_}), @config_keys
);
$new->run(@_)
}
+around _run_cli => sub {
+ my ($orig, $self) = (shift, shift);
+ if (@_ >= 2 and $_[0] eq 'dev' and $_[1] eq 'server') {
+ require SCSite::DevMode;
+ Moo::Role->apply_roles_to_object($self, 'SCSite::DevMode');
+ return $self->_run_dev_server(@_[2..$#_]);
+ }
+ return $self->$orig(@_);
+};
+
__PACKAGE__->run_if_script;