#!perl
use strict;
# ABSTRACT: build an advent calendar
# PODNAME: advcal
use lib 'lib';
#pod =head1 USAGE
#pod
#pod advcal [-aot] [long options...]
#pod -c --config the ini file to read for configuration
#pod -a --article-dir the root of articles
#pod --share-dir the root of shared files
#pod -o --output-dir output directory
#pod --today the day we treat as "today"; default to today
#pod
#pod -y --year-links place year links at the bottom of the page
#pod
#pod For more detailed information, see L<WWW::AdventCalendar>.
#pod
#pod =cut
my ($opt, $usage) = describe_options(
'%c %o',
[ 'config|c=s', 'the ini file to read for configuration' ],
[ 'article-dir|a=s', 'root of articles', { default => './articles' } ],
[ 'share-dir=s', 'root of shared files', { default => './share' } ],
[ 'output-dir|o=s', 'output directory', { default => './out' } ],
[ 'today=s', 'the day we treat as "today"; default to today' ],
[],
[ 'tracker-id|t=s', 'include Google Analytics; -t TRACKER-ID' ],
[ 'uri=s', 'base URI of the calendar, including trailing slash' ],
[ 'year-links|y', 'add year links to bottom of index.html' ],
);
my $arg = {};
my $colors = {
genericBlack => '#000',
genericWhite => '#fff',
generic00 => '#977',
generic01 => '#d9d9d9',
generic02 => '#b00',
generic03 => '#c0c0c0',
generic04 => '#797',
bodyBG => 'generic00',
bodyFG => 'genericBlack',
blotterBG => 'generic01',
blotterBorder => '#aaa',
contentBG => 'genericWhite',
contentBorder => '#aaa',
feedLinkFG => '#ff0',
headerFG => 'generic02',
linkFG => 'generic02',
linkDisabledFG => 'generic03',
linkHoverFG => '#d00',
linkHoverBG => '#ffc',
quoteBorder => 'generic04',
sectionBorder => 'generic03',
taglineBG => 'generic04',
taglineFG => 'genericWhite',
taglineBorder => '#575',
titleFG => 'headerFG',
calendarHeaderCellBorder => '#ddd',
calendarHeaderCellBG => '#f0f0f0',
calendarIgnoredDayBG => '#ccc',
calendarPastDayBG => '#aea',
calendarPastDayFG => 'genericBlack',
calendarPastDayHoverBG => '#f0f0f0',
calendarPastDayHoverFG => 'genericBlack',
calendarTodayBG => 'generic04',
calendarTodayFG => 'genericWhite',
calendarTodayHoverBG => '#bdb',
calendarTodayHoverFG => 'genericBlack',
calendarFutureDayBG => '#eaa',
calendarFutureDayFG => 'genericBlack',
calendarMissingDayFG => '#f00',
calendarMissingDayBG => 'genericBlack',
codeBG => '#222',
codeFG => '#ddd',
codeNumbersBG => 'generic04',
codeNumbersFG => 'genericWhite',
codeNumbersBorder => 'generic02',
};
if ($opt->tracker_id) {
warn <<END;
--tracker no longer does anything. If you want to track people reading your
advent calendar, you can update the templates.
END
}
if (my $file = $opt->config) {
die "configuration file '$file' does not exist\n" unless -f $file;
my $config = WWW::AdventCalendar::Config->new->read_config($file);
my $root = $config->section_named('_');
$arg = $root->payload;
my $palette_section = $config->section_named('Palette');
%$colors = (%$colors, %{ $palette_section->payload }) if $palette_section;
}
my %default_opt = %$opt;
my %specified_opt;
delete $_->{config} for \(%default_opt, %specified_opt);
my $cal = WWW::AdventCalendar->new({
%default_opt, # even command line defaults
%$arg, # but those are overridden by configuration
%specified_opt, # which is overridden by *explicit* switches
color_palette => Color::Palette->new({ colors => $colors }),
});
$cal->build;
__END__
=pod
=encoding UTF-8
=head1 NAME
advcal - build an advent calendar
=head1 VERSION
version 1.113
=head1 PERL VERSION
This module should work on any version of perl still receiving updates from
the Perl 5 Porters. This means it should work on any version of perl released
in the last two to three years. (That is, if the most recently released
version is v5.40, then this module should work on both v5.40 and v5.38.)
Although it may work on older versions of perl, no guarantee is made that the
minimum required version will not be increased. The version may be increased
for any reason, and there is no promise that patches will be accepted to lower
the minimum required perl.
=head1 USAGE
advcal [-aot] [long options...]
-c --config the ini file to read for configuration
-a --article-dir the root of articles
--share-dir the root of shared files
-o --output-dir output directory
--today the day we treat as "today"; default to today
-y --year-links place year links at the bottom of the page
For more detailed information, see L<WWW::AdventCalendar>.
=head1 AUTHOR
Ricardo SIGNES <cpan@semiotic.systems>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2022 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut