]> iEval git - plack-app-gruntmaster.git/commitdiff
Add learn
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 23 Dec 2013 07:29:54 +0000 (09:29 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 23 Dec 2013 07:29:54 +0000 (09:29 +0200)
gruntmaster-genallpages
lib/Gruntmaster/Page.pm
lib/Gruntmaster/Page/Learn.pm [new file with mode: 0644]

index 5ba2bfdbc814b8d1e4bc98e86c5821821a428276..ca70a725186b71c912c807b05eed59149b305ca7 100755 (executable)
@@ -9,6 +9,7 @@ sub generate{
   Gruntmaster::Page::generate $what;
 }
 
+generate "learn.html";
 generate "${_}index.html" for '', 'ct/';
 generate "$_/index.html" for grep {-d} <ct/*>;
 
index 7b5e9339cd9f613eb3c47eee1b24be05b8034a28..a07a10213cd65bf6aa142b2192693c28c8b63ac9 100644 (file)
@@ -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 (file)
index 0000000..8fce8c8
--- /dev/null
@@ -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 <a href="ipt-linux">Linux</a> | <a href="ipt-windows.exe">Windows</a> | <a href="ipt-mac">Mac OS X</a>.
+<p>Get the source from <a href="http://example.org/">meta::cpan</a>
+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
This page took 0.033682 seconds and 4 git commands to generate.