Philip Wittamore 9 місяців тому
батько
коміт
62028ec03d
4 змінених файлів з 404 додано та 0 видалено
  1. 105 0
      blog/index.php
  2. 90 0
      blog/search.php
  3. 83 0
      blog/static.php
  4. 126 0
      blog/style.css

+ 105 - 0
blog/index.php

@@ -0,0 +1,105 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <link rel="stylesheet" href="/style.css" />
+    <title>Bloggings</title>
+  </head>
+  <body>
+    <header>
+      <center>
+      <h1>Bloggings</h1>
+      <img src="images/shadocks-pumping-300.gif" alt="shadocks pumping">
+      <br><br>
+      <a 
+      href="static.php">Static</a>&nbsp;|&nbsp;<a
+      href="https://shaarli.wittamore.com" target="_blank">Links</a>&nbsp;|&nbsp;<a
+      href="https://git.wittamore.com" target="_blank">Git</a>&nbsp;|&nbsp;<a 
+      href="search.php">Search</a>&nbsp;|&nbsp;<a
+          href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp"
+          >FR</a
+        >
+      </center>
+      <hr />
+    </header>
+    <p>
+    This <a href="/articles/2023/minimalist-blog.html">minimalist blog</a> uses simple html. No Javascript, grids, or
+    fancy formats. It can be read in a terminal text browser like
+    <a href="https://lynx.browser.org/">Lynx</a>, a simple 
+    graphical browser like <a href="https://dillo.org/">Dillo</a>, or a state
+    of the art browser like <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>.
+    <a href="/images/browsers/index.php">(see examples)</a>
+    </p>
+    <!-- list start -->
+<?php
+// build reverse article subdirs (years)
+$yeardirs = [];
+$revyeardirs = [];
+$articlesubdir = new DirectoryIterator("./articles/");
+foreach ($articlesubdir as $dirinfo) {
+    if ($dirinfo->isDir() && !$dirinfo->isDot()) {
+        $yeardirs[] = $dirinfo->getFilename();
+    }
+}
+rsort($yeardirs);
+
+// iterate through years
+if (is_array($yeardirs)) {
+    foreach ($yeardirs as $key => $dirname) {
+        echo "<h2>" . $dirname . "</h2>";
+        echo "<ul>";
+        $items = [];
+        $thisdir = new DirectoryIterator("./articles/" . $dirname);
+        // iterate through files
+        foreach ($thisdir as $file) {
+            if ($file != "." && $file != "..") {
+                $content = file_get_contents($file->getPathname());
+                preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
+                $filedate = date("Y-m-d");
+                if (isset($date[1]) && strtotime($date[1])) {
+                    $filedate = date("Y-m-d", strtotime($date[1]));
+                }
+
+                preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+                $title = "?";
+                if (isset($titre[1])) {
+                    $title = $titre[1];
+                }
+
+                $items[] =
+                    "<li><b>" .
+                    $filedate .
+                    ' </b><a href="' .
+                    $file->getPathname() .
+                    '">' .
+                    $title .
+                    "</a></li>";
+                 
+            }
+        }
+
+        rsort($items);
+        foreach ($items as $key => $val) {
+            echo $val;
+        }
+        echo "</ul>";
+    }
+} else {
+    echo "Not an array";
+}
+?>
+    <!-- list end -->
+    <p>&nbsp;</p>
+    <hr />
+    <center>
+      <h5>
+        A minimalist blog by
+        <a
+          href="mailto:%70%68%69%6C%69%70%40%77%69%74%74%61%6D%6F%72%65%2E%63%6F%6D"
+          >Philip Wittamore</a
+        >
+      </h5>
+    </center>
+  </body>
+</html>

+ 90 - 0
blog/search.php

@@ -0,0 +1,90 @@
+<?php
+$string = "";
+if (isset($_POST["s"])) {
+    $string = $_POST["s"];
+}
+?>
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <link rel="stylesheet" href="/style.css" />
+    <title>Bloggings</title>
+  </head>
+  <body>
+    <header>
+      <h1>Bloggings</h1>
+      <p>
+      <a href="index.html">Home</a> | <a href="https://searx.wittamore.com" target="_blank">SearxNG</a>
+      </p>
+      <hr />
+    </header>
+    <h2>Search</h2>
+    <form action="search.php" method="post">
+    <input name="s" type="text">
+    <input type="submit">
+    </form>
+    <!-- list start -->
+
+<?php if (!empty($string)) {
+    echo "<h2>Results</h2>";
+    echo 'Search terms: <b>"' . $string . '"</b>';
+    echo "<h3>Static Pages</h3>";
+    $dir = new RecursiveDirectoryIterator("./static");
+    echo "<ul>";
+    $i=0;
+    foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
+        if ($file != "." && $file != "..") {
+            if (!is_dir($file)) {
+                $content = file_get_contents($file->getPathname());
+                if (strpos($content, $string) !== false) {
+                    $i++;
+                    preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+                    $title = "?";
+                    if (isset($titre[1])) {
+                        $title = $titre[1];
+                    }
+                    echo '<li><a href="' . $file . '">' . $title . "</a></li>";
+                }
+            }
+        }
+    }
+    if ($i == 0) echo "<i>No match</i>";
+    echo "</ul>";
+    echo "<h3>Articles</h3>";
+    $dir = new RecursiveDirectoryIterator("./articles");
+    echo "<ul>";
+    $i=0;
+    foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
+        if ($file != "." && $file != "..") {
+            if (!is_dir($file)) {
+                $content = file_get_contents($file->getPathname());
+                if (strpos($content, $string) !== false) {
+                    $i++;
+                    preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+                    $title = "?";
+                    if (isset($titre[1])) {
+                        $title = $titre[1];
+                    }
+                    echo '<li><a href="' . $file . '">' . $title . "</a></li>";
+                }
+            }
+        }
+    }
+    if ($i == 0) echo "<i>No match</i>";
+    echo "</ul>";
+} ?>
+
+    <!-- list end -->
+    <p>&nbsp;</p>
+    <hr />
+    <center>
+    <h5>A minimalist blog by <a href="mailto:%70%68%69%6C%69%70%40%77%69%74%74%61%6D%6F%72%65%2E%63%6F%6D">Philip Wittamore</a></h5>
+    </center>
+  </body>
+</html>
+
+
+
+

+ 83 - 0
blog/static.php

@@ -0,0 +1,83 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <link rel="stylesheet" href="/style.css" />
+    <title>Bloggings</title>
+  </head>
+  <body>
+    <header>
+      <center>
+      <h1>Bloggings</h1>
+      <img src="images/shadocks-pumping-300.gif" alt="shadocks pumping">
+      <br><br>
+      <a href="index.html">Blog</a>&nbsp;|&nbsp;<a 
+      href="https://shaarli.wittamore.com" target="_blank">Links</a>&nbsp;|&nbsp;<a
+      href="https://git.wittamore.com" target="_blank">Git</a>&nbsp;|&nbsp;<a 
+      href="search.php">Search</a>&nbsp;|&nbsp;<a
+          href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp"
+          >FR</a
+        >      </center>
+      <hr />
+    </header>
+    <h1>Static Pages</h1>
+    <!-- list start -->
+<?php
+// iterate through years
+$items = [];
+echo "<ul>";
+// iterate through files
+$i = 0;
+$thisdir = new DirectoryIterator("./static");
+foreach ($thisdir as $file) {
+    if ($file != "." && $file != "..") {
+        $i++;
+        $content = file_get_contents($file->getPathname());
+        preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
+        $filedate = date("Y-m-d");
+
+        if (isset($date[1]) && strtotime($date[1])) {
+            $filedate = date("Y-m-d", strtotime($date[1]));
+        }
+
+        preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+        $title = "?";
+
+        if (isset($titre[1])) {
+            $title = ucfirst($titre[1]);
+        }
+        $items[$i][0] = $i;
+        $items[$i][1] = $file->getPathname();
+        $items[$i][2] = $title;
+    }
+}
+$values = array_column($items, 2);
+array_multisort($values, SORT_ASC, $items);
+
+$i = 0;
+while ($i < count($items)) {
+    echo "<li>" .
+        '<a href="' .
+        $items[$i][1] .
+        '">' .
+        $items[$i][2] .
+        "</a></li>";
+    $i++;
+}
+echo "</ul>";
+?>
+    <!-- list end -->
+    <p>&nbsp;</p>
+    <hr />
+    <center>
+      <h5>
+        A minimalist blog by
+        <a
+          href="mailto:%70%68%69%6C%69%70%40%77%69%74%74%61%6D%6F%72%65%2E%63%6F%6D"
+          >Philip Wittamore</a
+        >
+      </h5>
+    </center>
+  </body>
+</html>

+ 126 - 0
blog/style.css

@@ -0,0 +1,126 @@
+
+body,
+html {
+  height: 100%;
+  color: #d0cfba;
+  margin: 10px;
+  font-family: monospace;
+  font-size: 16px;
+  line-height:1.5;
+  letter-spacing: 0.6;
+  background-color: #282828;
+}
+html {
+    display: table;
+    margin: auto;
+    width:100%;
+    max-width:80ch;
+}
+body {
+    display: table-cell;
+}
+p,li,ul,table,pre,code {
+  max-width: 32em; 
+  max-width: 80ch;
+  text-align:justify;
+}
+h1 {
+  color: goldenrod;
+  text-align: center;
+}
+h2,
+h3,
+h4 {
+  color: #3aa25d;
+}
+h5,
+h6 {
+  color: mediumorchid;
+}
+a {
+  color: #85a09b;
+}
+ul {line-height:2;}
+p {
+}
+strong,
+em {
+  color: #8da29b;
+  padding-left: 2px;
+  padding-right: 2px;
+}
+b {color:#b3bd29;}
+
+small {color: SeaGreen;}
+img {
+  max-width:100%;
+}
+hr {
+  height: 0;
+  border: 0;
+  border-top: 1px solid SeaGreen;
+  margin: 1em 0;
+  padding: 0;
+}
+table {
+  border-collapse: collapse;
+}
+td {
+  border: 1px solid antiquewhite;
+  padding: 4px;
+}
+th {
+  border: 1px solid antiquewhite;
+  color: black;
+  background-color: antiquewhite;
+  padding: 4px;
+  text-align: center;
+}
+pre {
+  font-family: monospace;
+  white-space: pre-wrap;
+}
+code {
+  color: darkseagreen;
+  font-family: monospace;
+  background: darkslategrey;
+  white-space: pre-wrap;
+  display:block;
+  padding:4px;
+  text-align:left;
+}
+iframe { border: 1px solid darkslategrey;}
+
+figure { 
+  margin: 0;
+  margin-top:30px;
+  background: seagreen;
+  width:400px;
+   }
+figure img {
+	width:400px;
+}
+figcaption { 
+  margin-bottom:10px;
+  padding: 10px;
+  background: seagreen;
+  color: #fff;
+  font-size:16px;
+  width:380px;
+}
+
+@media only screen and (max-width: 600px) {
+  body {
+    padding:2px;
+    font-size:14px;
+    margin: 0;
+  }
+  ul {padding:0;}
+  li {
+    padding:0;
+    text-align:left;
+  }
+  iframe {
+  	max-width:100%;
+  }
+}