« get me outta code hell

data, content, html: FlashAct.nameHTML - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-02-09 17:28:21 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-02-09 17:28:21 -0400
commit3c98e89daad1e312907c6f5f614b44b38f65408e (patch)
tree69dee2add4069c8331dae0880c266bee7b6313a6
parentdf5ff85bdc2d56cbb8ef4d104dd7b82867ecca73 (diff)
data, content, html: FlashAct.nameHTML
-rw-r--r--src/content/dependencies/generateArtistInfoPageAlbumArtistOnlyChunkItem.js12
-rw-r--r--src/content/dependencies/generateContentEntry.js9
-rw-r--r--src/content/dependencies/generateFlashActGalleryPage.js13
-rw-r--r--src/content/dependencies/generateFlashActSidebarSideMapBox.js2
-rw-r--r--src/content/dependencies/generateUnsafeMunchy.js8
-rw-r--r--src/content/dependencies/linkFlashAct.js21
-rw-r--r--src/content/dependencies/linkFlashActInline.js24
-rw-r--r--src/data/things/content/CreditingSourcesEntry.js4
-rw-r--r--src/data/things/content/ReferencingSourcesEntry.js4
-rw-r--r--src/data/things/flash/FlashAct.js27
-rw-r--r--src/html.js39
11 files changed, 129 insertions, 34 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageAlbumArtistOnlyChunkItem.js b/src/content/dependencies/generateArtistInfoPageAlbumArtistOnlyChunkItem.js
new file mode 100644
index 00000000..314813f5
--- /dev/null
+++ b/src/content/dependencies/generateArtistInfoPageAlbumArtistOnlyChunkItem.js
@@ -0,0 +1,12 @@
+export default {
+  relations: (relation) => ({
+    template:
+      relation('generateArtistInfoPageChunkItem'),
+  }),
+
+  generate: (relations, {language}) =>
+    relations.template.slots({
+      content:
+        language.$('artistPage.creditList.entry.album.albumArtistOnly'),
+    }),
+};
diff --git a/src/content/dependencies/generateContentEntry.js b/src/content/dependencies/generateContentEntry.js
index 7712d9f6..80a155fe 100644
--- a/src/content/dependencies/generateContentEntry.js
+++ b/src/content/dependencies/generateContentEntry.js
@@ -29,8 +29,9 @@ export default {
   }),
 
   data: (entry) => ({
-    isWikiEditorCommentary:
-      entry.isWikiEditorCommentary,
+    isWikiEditorEntry:
+      entry.isWikiEditorCommentary ||
+      entry.isWikiEditorSource,
   }),
 
   slots: {
@@ -89,7 +90,7 @@ export default {
                       html.tag('span', {class: 'content-entry-accent'},
                         language.$(titleCapsule, 'accent.withAnnotation', {annotation}));
 
-                    if (data.isWikiEditorCommentary) {
+                    if (data.isWikiEditorEntry) {
                       workingCapsule += '.wikiEditor';
                     }
                   }
@@ -106,7 +107,7 @@ export default {
             relations.colorStyle.clone()
               .slot('color', slots.color),
 
-          data.isWikiEditorCommentary &&
+          data.isWikiEditorEntry &&
             {class: 'wiki-commentary'},
 
           relations.bodyContent.slot('mode', 'multiline')),
diff --git a/src/content/dependencies/generateFlashActGalleryPage.js b/src/content/dependencies/generateFlashActGalleryPage.js
index 896ee224..4097d765 100644
--- a/src/content/dependencies/generateFlashActGalleryPage.js
+++ b/src/content/dependencies/generateFlashActGalleryPage.js
@@ -1,5 +1,3 @@
-import striptags from 'striptags';
-
 export default {
   relations: (relation, act) => ({
     layout:
@@ -9,7 +7,7 @@ export default {
       relation('linkFlashIndex'),
 
     flashActNavLink:
-      relation('linkFlashAct', act),
+      relation('linkFlashActInline', act),
 
     flashActNavAccent:
       relation('generateFlashActNavAccent', act),
@@ -31,18 +29,23 @@ export default {
 
   data: (act) => ({
     name: act.name,
+    nameHTML: act.nameHTML,
     color: act.color,
 
     flashNames:
       act.flashes.map(flash => flash.name),
   }),
 
-  generate: (data, relations, {language}) =>
+  generate: (data, relations, {html, language}) =>
     language.encapsulate('flashPage', pageCapsule =>
       relations.layout.slots({
         title:
           language.$(pageCapsule, 'title', {
-            flash: striptags(data.name),
+            flash:
+              html.ifelse([
+                html.permit(data.nameHTML, {strip: true}),
+                language.sanitize(data.name),
+              ]),
           }),
 
         color: data.color,
diff --git a/src/content/dependencies/generateFlashActSidebarSideMapBox.js b/src/content/dependencies/generateFlashActSidebarSideMapBox.js
index 4b97f21d..7cae184f 100644
--- a/src/content/dependencies/generateFlashActSidebarSideMapBox.js
+++ b/src/content/dependencies/generateFlashActSidebarSideMapBox.js
@@ -17,7 +17,7 @@ export default {
     sideActLinks:
       sprawl.flashSideData
         .map(side => side.acts
-          .map(act => relation('linkFlashAct', act))),
+          .map(act => relation('linkFlashActInline', act))),
   }),
 
   data: (sprawl, act, flash) => ({
diff --git a/src/content/dependencies/generateUnsafeMunchy.js b/src/content/dependencies/generateUnsafeMunchy.js
deleted file mode 100644
index df8231ef..00000000
--- a/src/content/dependencies/generateUnsafeMunchy.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default {
-  slots: {
-    contentSource: {type: 'string'},
-  },
-
-  generate: (slots, {html}) =>
-    new html.Tag(null, null, slots.contentSource),
-};
diff --git a/src/content/dependencies/linkFlashAct.js b/src/content/dependencies/linkFlashAct.js
index 069bedf4..dcad71e0 100644
--- a/src/content/dependencies/linkFlashAct.js
+++ b/src/content/dependencies/linkFlashAct.js
@@ -1,20 +1,21 @@
 export default {
   relations: (relation, flashAct) => ({
-    unsafeMunchy:
-      relation('generateUnsafeMunchy'),
-
     link:
       relation('linkThing', 'localized.flashActGallery', flashAct),
   }),
 
   data: (flashAct) => ({
-    name: flashAct.name,
+    name:
+      flashAct.name,
+
+    nameHTML:
+      flashAct.nameHTML,
   }),
 
-  generate: (data, relations) =>
-    relations.link.slots({
-      content:
-        relations.unsafeMunchy
-          .slot('contentSource', data.name),
-    }),
+  generate: (data, relations, {html, language}) =>
+    relations.link.slot('content',
+      html.ifelse([
+        html.permit(data.nameHTML),
+        language.sanitize(data.name),
+      ])),
 };
diff --git a/src/content/dependencies/linkFlashActInline.js b/src/content/dependencies/linkFlashActInline.js
new file mode 100644
index 00000000..ba2a4883
--- /dev/null
+++ b/src/content/dependencies/linkFlashActInline.js
@@ -0,0 +1,24 @@
+// junk component which only exists because you can't
+// "extend" the slots of underlying linkThing.
+
+export default {
+  relations: (relation, flashAct) => ({
+    link:
+      relation('linkThing', 'localized.flashActGallery', flashAct),
+  }),
+
+  data: (flashAct) => ({
+    name:
+      flashAct.name,
+
+    nameHTML:
+      flashAct.nameHTML,
+  }),
+
+  generate: (data, relations, {html, language}) =>
+    relations.link.slot('content',
+      html.ifelse([
+        html.permit(data.nameHTML, {inline: true}),
+        language.sanitize(data.name),
+      ])),
+};
diff --git a/src/data/things/content/CreditingSourcesEntry.js b/src/data/things/content/CreditingSourcesEntry.js
index 0f7e266e..6b9880f1 100644
--- a/src/data/things/content/CreditingSourcesEntry.js
+++ b/src/data/things/content/CreditingSourcesEntry.js
@@ -3,6 +3,8 @@ import Thing from '#thing';
 
 import {exposeConstant} from '#composite/control-flow';
 
+import {hasAnnotationPart} from '#composite/things/content';
+
 import {ContentEntry} from './ContentEntry.js';
 
 export class CreditingSourcesEntry extends ContentEntry {
@@ -13,5 +15,7 @@ export class CreditingSourcesEntry extends ContentEntry {
     // Expose only
 
     isCreditingSourcesEntry: exposeConstant(V(true)),
+
+    isWikiEditorSource: hasAnnotationPart(V('wiki editor')),
   });
 }
diff --git a/src/data/things/content/ReferencingSourcesEntry.js b/src/data/things/content/ReferencingSourcesEntry.js
index 4b27b313..de7deba0 100644
--- a/src/data/things/content/ReferencingSourcesEntry.js
+++ b/src/data/things/content/ReferencingSourcesEntry.js
@@ -3,6 +3,8 @@ import Thing from '#thing';
 
 import {exposeConstant} from '#composite/control-flow';
 
+import {hasAnnotationPart} from '#composite/things/content';
+
 import {ContentEntry} from './ContentEntry.js';
 
 export class ReferencingSourcesEntry extends ContentEntry {
@@ -13,5 +15,7 @@ export class ReferencingSourcesEntry extends ContentEntry {
     // Expose only
 
     isReferencingSourceEntry: exposeConstant(V(true)),
+
+    isWikiEditorSource: hasAnnotationPart(V('wiki editor')),
   });
 }
diff --git a/src/data/things/flash/FlashAct.js b/src/data/things/flash/FlashAct.js
index 66d4ee1b..d1c64b4b 100644
--- a/src/data/things/flash/FlashAct.js
+++ b/src/data/things/flash/FlashAct.js
@@ -1,13 +1,26 @@
-
 import {input, V} from '#composite';
 import Thing from '#thing';
-import {isContentString} from '#validators';
+import {isContentString, isString} from '#validators';
 
 import {withPropertyFromObject} from '#composite/data';
-import {exposeConstant, exposeDependency, exposeUpdateValueOrContinue}
-  from '#composite/control-flow';
-import {color, directory, name, soupyFind, soupyReverse, thing, thingList}
-  from '#composite/wiki-properties';
+
+import {
+  exitWithoutDependency,
+  exposeConstant,
+  exposeDependency,
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
+
+import {
+  color,
+  directory,
+  name,
+  simpleString,
+  soupyFind,
+  soupyReverse,
+  thing,
+  thingList
+} from '#composite/wiki-properties';
 
 export class FlashAct extends Thing {
   static [Thing.referenceType] = 'flash-act';
@@ -20,6 +33,7 @@ export class FlashAct extends Thing {
     side: thing(V(FlashSide)),
 
     name: name(V('Unnamed Flash Act')),
+    nameHTML: simpleString(),
     directory: directory(),
     color: color(),
 
@@ -63,6 +77,7 @@ export class FlashAct extends Thing {
   static [Thing.yamlDocumentSpec] = {
     fields: {
       'Act': {property: 'name'},
+      'Act HTML': {property: 'nameHTML'},
       'Directory': {property: 'directory'},
 
       'Color': {property: 'color'},
diff --git a/src/html.js b/src/html.js
index 4cac9525..cde86a5c 100644
--- a/src/html.js
+++ b/src/html.js
@@ -296,6 +296,14 @@ export function isBlank(content) {
   return false;
 }
 
+export function ifelse(options) {
+  for (const option of options) {
+    if (!isBlank(option)) return option;
+  }
+
+  return blank();
+}
+
 export const validators = {
   isBlank(value) {
     if (!isBlank(value)) {
@@ -411,6 +419,37 @@ export function escape(string, {attribute = false} = {}) {
   return string;
 }
 
+export function permit(string, adjustment) {
+  if (typeof string === 'string') {
+    if (string.length) {
+      return new Tag(null, null, adjust(string, adjustment));
+    } else {
+      return blank();
+    }
+  } else if (string === null) {
+    return blank();
+  } else {
+    throw new TypeError(`expected string or null`);
+  }
+}
+
+export function adjust(string, {
+  inline = false,
+  strip = false,
+} = {}) {
+  // zalgo
+
+  if (inline || strip) {
+    string = string.replace(/<br\/?>/g, ' ');
+  }
+
+  if (strip) {
+    string = striptags(string);
+  }
+
+  return string;
+}
+
 export class Tag {
   #tagName = '';
   #content = null;