12 Commits 26342a2d5e ... 64b1209202

Auteur SHA1 Message Date
  Getty Ritter 64b1209202 add gooday preppers quip il y a 2 ans
  Getty Ritter 24ade85473 allow for description overrides il y a 2 ans
  Getty Ritter 435f77e86a opengraph for works il y a 2 ans
  Getty Ritter 57228a1403 a few typos il y a 2 ans
  Getty Ritter 5285ab7afa wording tweak il y a 2 ans
  Getty Ritter a9eeeb05fd remove comics il y a 2 ans
  Getty Ritter 018ec6c306 typo fix + unrepeat generator il y a 2 ans
  Getty Ritter daeb9a49b8 add st selvage il y a 2 ans
  Getty Ritter 1f0d7b3697 update woke koan date il y a 2 ans
  Getty Ritter 1452f002eb a bit more copyright stuff il y a 2 ans
  Getty Ritter cff1c32d5b add opengraph metadata il y a 2 ans
  Getty Ritter 258d9ca6c8 a bit of cleanup il y a 2 ans

+ 34 - 7
main.py

@@ -8,6 +8,7 @@ import pystache
 import shutil
 import sys
 import tempfile
+from typing import Optional
 import yaml
 
 class Datum:
@@ -39,6 +40,7 @@ class Work:
     title: str
     date: str
     contents: str
+    description: Optional[str] = None
 
 class Path:
     OUTDIR=tempfile.TemporaryDirectory()
@@ -68,13 +70,13 @@ class Path:
 
     @classmethod
     def list(cls, *paths):
-        stuff = []
+        stuff = set()
         tgt = f'{os.path.join(*paths)}/'
         for path in sys.argv[2:]:
             if tgt in path:
                 chunks = path.split('/')
                 idx = chunks.index(paths[-1])
-                stuff.append(chunks[idx +1])
+                stuff.add(chunks[idx +1])
         return stuff
 
 class Template:
@@ -94,7 +96,7 @@ def main():
     out_file = sys.argv[1]
 
     year = datetime.datetime.now().year
-    std_copy = f'© Getty Ritter {year}'
+    std_copy = f'©{year} Getty Ritter'
     no_copy = 'all rights reversed'
 
     # gather the quips and make their individual pages
@@ -104,9 +106,14 @@ def main():
         quips.append(q)
         with Path.write('quips', uuid, 'index.html') as f:
             f.write(Template.main({
-                'title': f"Quip {uuid}",
+                'title': f"Quip",
                 'contents': Template.quote({'quotelist': [q]}),
                 'copy': no_copy,
+                'opengraph': {
+                    'title': f'quip:{uuid}',
+                    'url': f'/quip/{uuid}/',
+                    'description': q.content,
+                },
             }))
 
     # sort 'em and make the combined page
@@ -124,10 +131,16 @@ def main():
         q = Quote.from_file(Path.data('quotes', uuid))
         quotes.append(q)
         with Path.write('quotes', uuid, 'index.html') as f:
+            contents = Template.quote({'quotelist': [q]})
             f.write(Template.main({
-                'title': f"Quote {uuid}",
-                'contents': Template.quote({'quotelist': [q]}),
+                'title': f"Quote",
+                'contents': contents,
                 'copy': no_copy,
+                'opengraph': {
+                    'title': f'quote:{uuid}',
+                    'url': f'/quote/{uuid}/',
+                    'description': f'{q.content}\n---{q.author}',
+                },
             }))
 
     # sort 'em and make their combined page
@@ -143,6 +156,8 @@ def main():
     with open(Path.data('works.json')) as f:
         categories = yaml.safe_load(f)
 
+    category_lookup = {c['slug']: c for c in categories}
+
     # make an index page for each category
     with Path.write('category', 'index.html') as f:
         f.write(Template.main({
@@ -153,7 +168,7 @@ def main():
                     for c in categories
                 ]
             }),
-            'copy': 'whatever',
+            'copy': std_copy,
         }))
 
     # create each category page
@@ -181,11 +196,23 @@ def main():
                 # report other works in their own year
                 copy = f'© Getty Ritter {w.date}'
 
+            if w.description is not None:
+                description = w.description
+            elif slug in category_lookup:
+                singular = category_lookup[slug]['singular']
+                description = f'{w.title}: a {singular}'
+            else:
+                description = '...'
             with Path.write(w.slug, 'index.html') as f:
                 f.write(Template.main({
                     'title': w.title,
                     'contents': text,
                     'copy': copy,
+                    'opengraph': {
+                        'title': w.title,
+                        'url': f'/{w.slug}/',
+                        'description': description,
+                    },
                 }))
             works.append(w)
         works.sort(key=lambda w: w.slug)

+ 2 - 0
quips/725a9180-eb50-4944-8c86-c41fe125c9ef

@@ -0,0 +1,2 @@
+content: Delusional goodday preppers have been buying beautiful candles from the shops for when the world is beautiful
+id: 725a9180-eb50-4944-8c86-c41fe125c9ef

+ 3 - 5
templates/main.mustache

@@ -1,9 +1,7 @@
-{{! title, contents, usejs=False, onLoad='', copy='©2022 Getty Ritter' }}
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
   <head>
-    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8;" />
+    <meta http-equiv="Content-Type" content="application/html; charset=utf-8;" />
     {{#opengraph}}
       <meta property="og:title" content="{{title}}"/>
       <meta property="og:type" content="website"/>

+ 22 - 19
works.json

@@ -1,22 +1,25 @@
 [ { "category": "Fascicles"
-  , "slug": "fascicles"
-  }
-, { "category": "Strophes"
-  , "slug": "strophes"
-  }
-, { "category": "Stories"
-  , "slug": "stories"
-  }
-, { "category": "Poems"
-  , "slug": "poems"
-  }
-, { "category": "Comics"
-  , "slug": "comics"
-  }
-, { "category": "Nonsense"
-  , "slug": "nonsense"
-  }
-, { "category": "Cocktails"
-  , "slug": "cocktails"
+    , "slug": "fascicles"
+    , "singular": "fascicle"
   }
+  , { "category": "Strophes"
+      , "slug": "strophes"
+      , "singular": "strophe"
+    }
+  , { "category": "Stories"
+      , "slug": "stories"
+      , "singular": "story"
+    }
+  , { "category": "Poems"
+      , "slug": "poems"
+      , "singular": "poem"
+    }
+  , { "category": "Nonsense"
+      , "slug": "nonsense"
+      , "singular": "work of nonsense"
+    }
+  , { "category": "Cocktails"
+      , "slug": "cocktails"
+      , "singular": "cocktail"
+    }
 ]

+ 0 - 6
works/comics/dominus-001/metadata.yaml

@@ -1,6 +0,0 @@
-{
-  "name": "Dominus #1: The Astronaut",
-  "category": "comic",
-  "date": "2011",
-  "slug": "dominus-001"
-}

+ 0 - 1
works/comics/dominus-001/text

@@ -1 +0,0 @@
-![The Astronaut](http://76.105.173.15/images/the_moon.png)

+ 6 - 0
works/nonsense/the-convent-of-st-selvage/metadata.yaml

@@ -0,0 +1,6 @@
+{
+  "category": "nonsense",
+  "name": "The Convent of St. Selvage",
+  "date": "2022",
+  "slug": "the-convent-of-st-selvage"
+}

Fichier diff supprimé car celui-ci est trop grand
+ 43 - 0
works/nonsense/the-convent-of-st-selvage/text


+ 1 - 1
works/nonsense/woke-koans/metadata.yaml

@@ -1,6 +1,6 @@
 {
   "category": "nonsense",
   "name": "Zen Kōans Where The Word \"Enlightened\" Has Been Replaced With \"Woke\"",
-  "date": "today",
+  "date": "2016",
   "slug": "woke-koans"
 }

+ 11 - 1
works/poems/the-festival-of-fears/metadata.yaml

@@ -1 +1,11 @@
-{"category": "poem", "name": "The Festival of Fears", "date": "2006", "slug": "the-festival-of-fears"}
+category: poem
+name: The Festival of Fears
+date: 2006
+slug: the-festival-of-fears
+description: |
+  For the Garaths at Sorn, by the seas great and black,  
+  As they waited for all of their wives to come back  
+  And fired their surrs at the tumelant whales  
+  From the grelleking ships with no wind in their sails,  
+  The longest of days in all the long years  
+  Was the wintry cold Festival of Fears.