#!perl
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
,
%$arg
,
%specified_opt
,
color_palette
=> Color::Palette->new({
colors
=>
$colors
}),
});
$cal
->build;