« get me outta code hell

data: break up content.js, flash.js, sorting-rule.js - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/content/LyricsEntry.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-26 14:07:13 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-26 14:07:13 -0400
commit1f37e5d6b0c6fccc9c46aabd7bd402375131d452 (patch)
treee441757a73dd2b2cb346ce33b90bf185c614fe7c /src/data/things/content/LyricsEntry.js
parentaa3cb2dd34780fd97873340c3faf7388993fa8d8 (diff)
data: break up content.js, flash.js, sorting-rule.js
Diffstat (limited to 'src/data/things/content/LyricsEntry.js')
-rw-r--r--src/data/things/content/LyricsEntry.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/data/things/content/LyricsEntry.js b/src/data/things/content/LyricsEntry.js
new file mode 100644
index 00000000..88e4464d
--- /dev/null
+++ b/src/data/things/content/LyricsEntry.js
@@ -0,0 +1,43 @@
+import {V} from '#composite';
+import Thing from '#thing';
+
+import {exitWithoutDependency, exposeConstant} from '#composite/control-flow';
+import {contentString} from '#composite/wiki-properties';
+
+import {hasAnnotationPart} from '#composite/things/content';
+
+import {ContentEntry} from './ContentEntry.js';
+
+export class LyricsEntry extends ContentEntry {
+  static [Thing.wikiData] = 'lyricsData';
+
+  static [Thing.getPropertyDescriptors] = () => ({
+    // Update & expose
+
+    originDetails: contentString(),
+
+    // Expose only
+
+    isLyricsEntry: exposeConstant(V(true)),
+
+    isWikiLyrics: hasAnnotationPart(V('wiki lyrics')),
+    helpNeeded: hasAnnotationPart(V('help needed')),
+
+    hasSquareBracketAnnotations: [
+      exitWithoutDependency('isWikiLyrics', V(false), V('falsy')),
+      exitWithoutDependency('body', V(false)),
+
+      {
+        dependencies: ['body'],
+        compute: ({body}) =>
+          /\[.*\]/m.test(body),
+      },
+    ],
+  });
+
+  static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(ContentEntry, {
+    fields: {
+      'Origin Details': {property: 'originDetails'},
+    },
+  });
+}