From 12f5cac9d95e04bb84e47952dd938031557b57c4 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Mon, 23 Dec 2013 09:29:54 +0200 Subject: [PATCH] Add learn --- gruntmaster-genallpages | 1 + lib/Gruntmaster/Page.pm | 1 + lib/Gruntmaster/Page/Learn.pm | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 lib/Gruntmaster/Page/Learn.pm diff --git a/gruntmaster-genallpages b/gruntmaster-genallpages index 5ba2bfd..ca70a72 100755 --- a/gruntmaster-genallpages +++ b/gruntmaster-genallpages @@ -9,6 +9,7 @@ sub generate{ Gruntmaster::Page::generate $what; } +generate "learn.html"; generate "${_}index.html" for '', 'ct/'; generate "$_/index.html" for grep {-d} ; diff --git a/lib/Gruntmaster/Page.pm b/lib/Gruntmaster/Page.pm index 7b5e933..a07a102 100644 --- a/lib/Gruntmaster/Page.pm +++ b/lib/Gruntmaster/Page.pm @@ -36,6 +36,7 @@ sub declaregen{ declaregen Ct => qr,^ct/index$,; declaregen 'Ct::Entry' => qr,^ct/$component/index$,; declaregen St => qr,^ct/$component/log/st$,; + declaregen Learn => qr,^learn$,; declaregen Log => qr,^${contest}log/index$,; declaregen 'Log::Entry' => qr,^${contest}log/$component/index$,; declaregen Submit => qr,^${contest}submit$,; diff --git a/lib/Gruntmaster/Page/Learn.pm b/lib/Gruntmaster/Page/Learn.pm new file mode 100644 index 0000000..8fce8c8 --- /dev/null +++ b/lib/Gruntmaster/Page/Learn.pm @@ -0,0 +1,35 @@ +package Gruntmaster::Page::Learn; + +use 5.014000; +use strict; +use warnings; +use parent qw/Exporter/; +our @EXPORT_OK = qw/generate/; +our $VERSION = '0.001'; + +use constant FORMATS => [qw/CPP/]; +use constant TITLE => 'Learn Perl'; + +use Fcntl qw/:flock/; +use HTML::Template::Compiled; +use IO::File; +use YAML::Any qw/LoadFile/; +use Gruntmaster::Page::Common qw/header footer/; + +my %templates = ( + en => <<'HTML', +Download interactive-perl-tutorial for Linux | Windows | Mac OS X. +

Get the source from meta::cpan +HTML +); + +$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; +$templates{$_} .= footer $_ for keys %templates; + +sub generate{ + my $template = $templates{$_[1]}; + my $htc = HTML::Template::Compiled->new(scalarref => \$template); + $htc->output +} + +1 -- 2.39.2