From 1fe833d95243a1da47ceca6dd8b74f1d3714c069 Mon Sep 17 00:00:00 2001 From: Jefersson Nathan Date: Tue, 16 Mar 2021 10:01:31 +0100 Subject: [PATCH 1/4] Correct case Future refactors will be easier with grep/sed/ag/etc. Signed-off-by: Jefersson Nathan --- web/cgi-bin/horas/horascommon.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/cgi-bin/horas/horascommon.pl b/web/cgi-bin/horas/horascommon.pl index cc0db1290a4..c67a3e2c34a 100644 --- a/web/cgi-bin/horas/horascommon.pl +++ b/web/cgi-bin/horas/horascommon.pl @@ -272,7 +272,7 @@ sub getrank { if (-e "$datafolder/Latin/$tn.txt" || $dayname[0] =~ /Epi0/i || ($transfer{$nday}) =~ /tempora/i) { $dofw = $dayofweek; - if ($hora =~ /(vespera|completorium)/i && $testmode !~ /(Saint|Common)/i) { + if ($hora =~ /(Vespera|Completorium)/i && $testmode !~ /(Saint|Common)/i) { my $a = getweek(1); my @a = split('=', $a); $dn[0] = $a[0]; @@ -427,7 +427,7 @@ sub getrank { if (exists($transfer{$cday}) && $transfer{$cday} !~ /Tempora/i) { $cday = $transfer{$cday}; } if ($tname =~ /Nat/ && $cday =~ /Nat/) { $cday = 'none'; } - if ($hora =~ /(vespera|completorium)/i) { + if ($hora =~ /(Vespera|Completorium)/i) { if ($cday !~ /(tempora|DU)/i) { $cday = "$kalendar{$cday}"; } my $cdayd = $cday; if (!$cdayd || $cdayd !~ /([0-9]+\-[0-9]+)/) { $cdayd = nextday($month, $day, $year); } From f406a7fbf6a44a7301a1c9bfae9788f2944312b7 Mon Sep 17 00:00:00 2001 From: Jefersson Nathan Date: Tue, 16 Mar 2021 10:02:26 +0100 Subject: [PATCH 2/4] Add Template::Semantic as a dependency Signed-off-by: Jefersson Nathan --- Build.PL | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Build.PL b/Build.PL index a5d59fb5ccb..f15b42def4e 100755 --- a/Build.PL +++ b/Build.PL @@ -12,18 +12,19 @@ my $build = Module::Build->new( dist_author => 'Divinum Officium', dist_abstract => 'Generates texts for the traditional Roman liturgy.', requires => { - 'perl' => '5.10.1', - 'CGI' => 0, - 'CGI::Carp' => 0, - 'CGI::Cookie' => 0, - 'Encode' => 0, - 'File::Basename' => 0, - 'FindBin' => 0, - 'Time::Local' => 0, - 'Test::Cmd' => 0, - 'Test::Carp' => 0, - 'DateTime' => 0, - 'List::MoreUtils' => 0, + 'perl' => '5.10.1', + 'CGI' => 0, + 'CGI::Carp' => 0, + 'CGI::Cookie' => 0, + 'Encode' => 0, + 'File::Basename' => 0, + 'FindBin' => 0, + 'Time::Local' => 0, + 'Test::Cmd' => 0, + 'Test::Carp' => 0, + 'DateTime' => 0, + 'List::MoreUtils' => 0, + 'Template::Semantic' => 0, }, ); From 81f4da4e5cf833a61205b9af67b7c5c5f1a24eab Mon Sep 17 00:00:00 2001 From: Jefersson Nathan Date: Tue, 16 Mar 2021 10:04:22 +0100 Subject: [PATCH 3/4] Update dependencies when building the docker image Signed-off-by: Jefersson Nathan --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1d442bfe051..c50f3d7e2fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM perl:5.28-slim +FROM perl:5.28 MAINTAINER Ben Yanke # Set envs @@ -32,6 +32,10 @@ RUN mkdir -p /var/run/apache2 /var/lock/apache2 /var/log/apache2 ; chown -R www- WORKDIR /var/www COPY --chown=www-data:www-data web /var/www/web +# Update dependencies +COPY --chown=www-data:www-data Build.PL /var/www/Build.PL +RUN cpanm . + # Write build info to be available at $url/buildinfo RUN echo "Build date: `date`" > /var/www/web/buildinfo From 23d43a3b691c00835c331ade9123fc04f82d1849 Mon Sep 17 00:00:00 2001 From: Jefersson Nathan Date: Tue, 16 Mar 2021 10:06:30 +0100 Subject: [PATCH 4/4] Extract template from logic Signed-off-by: Jefersson Nathan --- web/cgi-bin/horas/officium.pl | 2 +- web/cgi-bin/horas/webdia.pl | 27 ++++----------------------- web/template/home.html | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 web/template/home.html diff --git a/web/cgi-bin/horas/officium.pl b/web/cgi-bin/horas/officium.pl index 12d1ac3e8c1..a32d35098d0 100755 --- a/web/cgi-bin/horas/officium.pl +++ b/web/cgi-bin/horas/officium.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use utf8; # Name : Laszlo Kiss diff --git a/web/cgi-bin/horas/webdia.pl b/web/cgi-bin/horas/webdia.pl index 54072c1b6de..050907f34e5 100644 --- a/web/cgi-bin/horas/webdia.pl +++ b/web/cgi-bin/horas/webdia.pl @@ -7,6 +7,9 @@ #use warnings; #use strict "refs"; #use strict "subs"; + +use Template::Semantic; + my $a = 4; #*** htmlHead($title, $flag) @@ -16,30 +19,8 @@ sub htmlHead { my $flag = shift; if (!$title) { $title = ' '; } - # print "Content-type: text/html; charset=ISO-8859-1\n\n"; print "Content-type: text/html; charset=utf-8\n\n"; - print << "PrintTag"; - - - - - - - - $title -PrintTag + print Template::Semantic->process("../../template/home.html", { 'TITLE' => $title }); if ($flag == 2) { horasjs(); } print ""; } diff --git a/web/template/home.html b/web/template/home.html new file mode 100644 index 00000000000..0d8474c8545 --- /dev/null +++ b/web/template/home.html @@ -0,0 +1,20 @@ + + + + + + + + Divinum Officium