ghwikipp: view: Add a hook for a preamble before the cooked content.

From fb863d87ef848d6a0247f406eea51326dbcf24d5 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 16 May 2024 21:20:53 +0000
Subject: [PATCH] view: Add a hook for a preamble before the cooked content.

This is unused by the general code right now, but SDL's wiki has a local
source mod that uses it.
---
 index.php      | 3 ++-
 templates/view | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/index.php b/index.php
index 593cb94..b77c16a 100644
--- a/index.php
+++ b/index.php
@@ -1097,12 +1097,13 @@ function build_index($base, $dname, &$output)
 
     $published_path = "$cooked_data/$document.html";
 
+    $preamble = '';  // unused, but you can hack something into this source code if you need it!
     $cooked = '';
     obtain_git_repo_lock();
     if (!file_exists($published_path)) {
         print_template('not_yet_a_page');
     } else {
-        print_template('view', [ 'cooked' => file_get_contents($published_path) ]);
+        print_template('view', [ 'cooked' => file_get_contents($published_path), 'preamble' => $preamble ]);
     }
     release_git_repo_lock();
 
diff --git a/templates/view b/templates/view
index ad14715..d12c302 100644
--- a/templates/view
+++ b/templates/view
@@ -2,6 +2,7 @@
 <link rel="stylesheet" href="/static_files/pandoc.css" />
 @include html_startcontent@
 
+@preamble@
 @cooked@
 
 <div class="viewtoolbar">