]> git.xolatile.top Git - emil-3chen.org.git/commitdiff
--
authorEmil Williams <emilemilemil@cock.li>
Sun, 11 May 2025 04:06:08 +0000 (22:06 -0600)
committerEmil Williams <emilemilemil@cock.li>
Sun, 11 May 2025 04:06:08 +0000 (22:06 -0600)
perl/Triple.pm

index 0202e3b8f368f0fa02575834698e5a755adc6e04..f7635a9a3653a4a0ce47163cce25e1ba6eebd2c1 100644 (file)
@@ -16,8 +16,13 @@ use Secrets;
 our $debug = 0;
 
 use constant {
-    STATIC_PAGE => 0,
-    DYNAMIC_PAGE => 1,
+    STATIC_PAGE      => 0,
+    DYNAMIC_PAGE     => 1,
+
+    PAGE_TYPE        => 0,
+    PAGE_TT          => 1,
+    PAGE_TITLE       => 2,
+    PAGE_DESCRIPTION => 3,
 };
 
 our %page = (
@@ -54,7 +59,7 @@ sub Triple::main {
             my $dynamic = $page{$vars->{uri}};
             if ($dynamic) {
                 my @set = @{$dynamic};
-                $page = "dynamic $set[0], no?";
+                $page = "dynamic $set[PAGE_TYPE], no?";
             } else {
                 $page = %static{''};
             }
@@ -108,13 +113,13 @@ sub init {
         };
         foreach my $key (keys %page) {
             my @set = @{$page{$key}};
-            next if $set[0] != STATIC_PAGE;
+            next if $set[PAGE_TYPE] != STATIC_PAGE;
             syslog("info", "Marking Static '$key'");
             $vars->{"uri"} = "$key";
-            $vars->{"title"} = "$set[2]";
-            $vars->{"description"} = "$set[3]";
+            $vars->{"title"} = "$set[PAGE_TITLE]";
+            $vars->{"description"} = "$set[PAGE_DESCRIPTION]";
             my $temporary;
-            $template->process($set[1], $vars, \$temporary) or syslog("info", $template->error());
+            $template->process($set[PAGE_TT], $vars, \$temporary) or syslog("info", $template->error());
             $static{$key} = $temporary;
         }
     }