replace index.php with index.html

The index doesn’t have to be a PHP file since there is no need to
generate the list of chapters anew every time the ToC is opened.

Instead, the list of chapters is generated once, ahead of time, and
saved to the index.html.

As an added bonus, this allows the ToC to be generated and used
as a local file.
master
BodgeMaster 2023-10-03 19:03:44 +02:00
parent bea947d6ff
commit 6a2f7e3d34
23 changed files with 39 additions and 28 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/index.html

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Unlikely Encounter </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Unlikely Encounter </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Unlikely Encounter </h1> <h1> Unlikely Encounter </h1>
<p class="light"> <p class="light">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Wake Up! </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Wake Up! </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Wake Up! </h1> <h1> Wake Up! </h1>
<p> <p>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> A Simple Errand </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> A Simple Errand </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> A Simple Errand</h1> <h1> A Simple Errand</h1>
<p class="comment"> <p class="comment">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Eventful Evening </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Eventful Evening </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Eventful Evening</h1> <h1> Eventful Evening</h1>
<p class="comment"> <p class="comment">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Library At Night </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Library At Night </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Library At Night</h1> <h1> Library At Night</h1>
<p class="comment"> <p class="comment">

15
deployment-script.sh Normal file
View File

@ -0,0 +1,15 @@
cp html_resources/index_template.html index.html
function genlinks {
for FILE in $(find . -maxdepth 1 -type f -name "*.html"); do
echo -ne " <li><a href=\"$FILE\">\n"
grep -oe "<title>.*</title>" $FILE | sed -e 's/<title> / /;s| </title>||'
echo " </a></li>"
done
}
sed -ne '/ <!-- chapter_list_here -->/q;p' html_resources/index_template.html > index.html
# for some fucking reason, there is no way to tell wc to only print the number so we do cat abuse to get rid of the filename
LINE_NUMBER=$(("$(cat index.html | wc -l)"+2))
genlinks >> index.html
tail -n+$LINE_NUMBER html_resources/index_template.html >> index.html

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Who died today? </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Who died today? </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Who Died Today?</h1> <h1> Who Died Today?</h1>
<p class="comment"> <p class="comment">

View File

@ -1,5 +1,5 @@
<!DOCTYPE html><html><head><title> &lt;Post Apocalypse Story&lt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Post Apocalypse Story&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body>
<h1> &lt;Post Apocalypse Story&lt; </h1> <h1> &lt;Post Apocalypse Story&gt; </h1>
<p class="comment"> <p class="comment">
Yeah, there is no real title yet. Yeah, there is no real title yet.
</p> </p>
@ -7,11 +7,6 @@
Table of Contents: Table of Contents:
</p> </p>
<ul> <ul>
<?php <!-- chapter_list_here -->
//TODO: get list of all html files
//TODO: get the chapter numbers from the filenames
//TODO: get the chapter titles from within the files
//TODO: build a list of links sorted by chapter number
?>
</ul> </ul>
<script>let spans = ["<span class=\"paper_green\">", "<span>"];let paper_sections = document.getElementsByClassName("paper");for (let i = 0; i < paper_sections.length; i++) {let lines = paper_sections[i].innerHTML.split("\n");let result = "";for (let j = 0; j < lines.length; j++) {result = result + spans[j%2] + lines[j] + " ".repeat(80-lines[j].length) + "</span>\n";}paper_sections[i].innerHTML = result;}</script></body></html> <script>let spans = ["<span class=\"paper_green\">", "<span>"];let paper_sections = document.getElementsByClassName("paper");for (let i = 0; i < paper_sections.length; i++) {let lines = paper_sections[i].innerHTML.split("\n");let result = "";for (let j = 0; j < lines.length; j++) {result = result + spans[j%2] + lines[j] + " ".repeat(80-lines[j].length) + "</span>\n";}paper_sections[i].innerHTML = result;}</script></body></html>

View File

@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<a href="index.php"> <a href="index.html">
<button class="back">&lt;</button> <button class="back">&lt;</button>
</a> </a>
<h1> Layout Test Page </h1> <h1> Layout Test Page </h1>

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html><head><title> Chapter Name </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Chapter Name </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<script>let spans = ["<span class=\"paper_green\">", "<span>"];let paper_sections = document.getElementsByClassName("paper");for (let i = 0; i < paper_sections.length; i++) {let lines = paper_sections[i].innerHTML.split("\n");let result = "";for (let j = 0; j < lines.length; j++) {result = result + spans[j%2] + lines[j] + " ".repeat(80-lines[j].length) + "</span>\n";}paper_sections[i].innerHTML = result;}</script></body></html> <script>let spans = ["<span class=\"paper_green\">", "<span>"];let paper_sections = document.getElementsByClassName("paper");for (let i = 0; i < paper_sections.length; i++) {let lines = paper_sections[i].innerHTML.split("\n");let result = "";for (let j = 0; j < lines.length; j++) {result = result + spans[j%2] + lines[j] + " ".repeat(80-lines[j].length) + "</span>\n";}paper_sections[i].innerHTML = result;}</script></body></html>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;chapter name&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;chapter name&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> &lt;chapter name&gt;</h1> <h1> &lt;chapter name&gt;</h1>
<p class="comment"> <p class="comment">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Escape From Dome City </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Escape From Dome City </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Escape From Dome City</h1> <h1> Escape From Dome City</h1>
<p> <p>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> First Steps Outside </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> First Steps Outside </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> First Steps Outside</h1> <h1> First Steps Outside</h1>
<p> <p>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;Emily Lab Incident&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Emily Lab Incident&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> &lt;Emily Lab Incident&gt; </h1> <h1> &lt;Emily Lab Incident&gt; </h1>
<p> <p>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Basic Needs </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Basic Needs </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Basic Needs</h1> <h1> Basic Needs</h1>
<p> <p>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;Emily First Contact&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Emily First Contact&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> &lt;Emily First Contact&gt;</h1> <h1> &lt;Emily First Contact&gt;</h1>
<p class="comment"> <p class="comment">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Alone </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Alone </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> Alone</h1> <h1> Alone</h1>
<p class="comment"> <p class="comment">

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;Story End Outline&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Story End Outline&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1>&lt;Story End Outline&gt;</h1> <h1>&lt;Story End Outline&gt;</h1>
<p class="comment"> <p class="comment">
This is not intended to be a chapter. It&apos;s more of an overview for This is not intended to be a chapter. It&apos;s more of an overview for

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;Reaching Nova Metropolis&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Reaching Nova Metropolis&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> <h1>
&lt;Reaching Nova Metropolis&gt; &lt;Reaching Nova Metropolis&gt;
</h1> </h1>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;Nova Metropolis&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;Nova Metropolis&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1>&lt;Nova Metropolis&gt;</h1> <h1>&lt;Nova Metropolis&gt;</h1>
<p> <p>
Michelle continues driving the bus for a couple hours without further Michelle continues driving the bus for a couple hours without further

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> Landing Troubles </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> Landing Troubles </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1>Landing Troubles</h1> <h1>Landing Troubles</h1>
<p> <p>
The escape pod <span class="comment">Is there a word that makes this sound The escape pod <span class="comment">Is there a word that makes this sound

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><title> &lt;End&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.php"><button class="back">&lt;</button></a> <!DOCTYPE html><html><head><title> &lt;End&gt; </title><link rel="stylesheet" type="text/css" href="html_resources/style.css"></head><body><a href="index.html"><button class="back">&lt;</button></a>
<h1> &lt;End&gt;</h1> <h1> &lt;End&gt;</h1>
<p class="comment"> <p class="comment">