]> Lady’s Gitweb - Beorn/commitdiff
Support subtitle
authorLady <redacted>
Tue, 9 Aug 2022 01:04:45 +0000 (18:04 -0700)
committerLady <redacted>
Sat, 29 Apr 2023 03:43:42 +0000 (20:43 -0700)
README.markdown
build.js

index 2207d3a2e480140000aeddef0f27f67ced4659d4..a0f30435443d0395c67ae446c3d2c4d95060fa1f 100644 (file)
@@ -113,6 +113,7 @@ file extension. A sample `.rsync-filter` might be as follows :—
 -s .gitignore
 -s /README*
 -s /build.js
+-s /deno.json
 -s index#*.xhtml
 -s #*.rdf
 ```
index 36953290fd9f0b28a69ea25753ea18e0ffa7e98e..785b86f94b9db7e39c28ffd0f381725e15ae1d81 100755 (executable)
--- a/build.js
+++ b/build.js
@@ -54,6 +54,7 @@ const AWOL = "http://bblfish.net/work/atom-owl/2006-06-06/";
 const DC11 = "http://purl.org/dc/elements/1.1/";
 const FOAF = "http://xmlns.com/foaf/0.1/";
 const RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+const RDFS = "http://www.w3.org/2000/01/rdf-schema#";
 const SIOC = "http://rdfs.org/sioc/ns#";
 const XML = "http://www.w3.org/XML/1998/namespace";
 const XHTML = "http://www.w3.org/1999/xhtml";
@@ -523,7 +524,7 @@ const context = {
   },
   rights: { namespace: DC11, localName: "rights", type: "text" },
   // source is not supported at this time
-  // subtitle is not supported at this time
+  subtitle: { namespace: RDFS, localName: "label", type: "text" },
   summary: { namespace: DC11, localName: "abstract", type: "text" },
   title: { namespace: DC11, localName: "title", type: "text" },
   // updated is provided by the build script
@@ -571,6 +572,7 @@ const fillOutHead = (document, metadata, type) => {
   const {
     title,
     author,
+    subtitle,
     summary,
   } = metadata;
   titleElement.textContent = Object(title) instanceof String
@@ -610,6 +612,20 @@ const fillOutHead = (document, metadata, type) => {
         .href("../../feed.atom")``,
     );
   } else {
+    // The provided document is not an entry document.
+    if (subtitle) {
+      // The entry has a subtitle.
+      head.appendChild(
+        LMN.meta({
+          name: "description",
+          content: Object(subtitle) instanceof String
+            ? summary
+            : Array.from(subtitle).map(($) => $.textContent).join(""),
+        })``,
+      );
+    } else {
+      /* do nothing */
+    }
     head.appendChild(
       LMN.link
         .rel("alternate")
@@ -1007,6 +1023,7 @@ await (async () => { // this is the run script
     const {
       id,
       title,
+      subtitle,
       rights,
       updated,
     } = feedMetadata;
@@ -1016,6 +1033,7 @@ await (async () => { // this is the run script
       "bjørn-content",
     ).item(0);
     if (contentPlaceholder != null) {
+      // There is a content placeholder.
       const { parentNode: contentParent } = contentPlaceholder;
       const contentElement = contentParent.insertBefore(
         LMN.nav.about(`${id}`)`${"\n"}`,
@@ -1029,6 +1047,17 @@ await (async () => { // this is the run script
         title,
       );
       addContent(contentHeader, "\n");
+      if (subtitle) {
+        // The feed has a subtitle.
+        addContent(
+          contentHeader.appendChild(LMN.p.property(`${RDFS}label`)``),
+          subtitle,
+        );
+        addContent(contentHeader, "\n");
+      } else {
+        // The feed has no subtitle.
+        /* do nothing */
+      }
       addContent(contentElement, "\n");
       const entriesElement = contentElement.appendChild(
         LMN.ul.rel(`${AWOL}entry`)`${"\n"}`,
@@ -1039,6 +1068,7 @@ await (async () => { // this is the run script
         LMN.footer`${"\n\t"}`,
       );
       if (rights) {
+        // The feed has a rights statement.
         addContent(
           contentFooter.appendChild(
             LMN.div.property(`${DC11}rights`)``,
@@ -1046,6 +1076,9 @@ await (async () => { // this is the run script
           rights,
         );
         addContent(contentFooter, "\n\t");
+      } else {
+        // The feed has no rights statement.
+        /* do nothing */
       }
       contentFooter.appendChild(
         LMN.p.id("entry.updated")`Last updated: ${LMN.time.property(
This page took 0.028881 seconds and 4 git commands to generate.