« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/content.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/content.js')
-rw-r--r--src/data/things/content.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/data/things/content.js b/src/data/things/content.js
index 60b2c8e0..cf8fa1f4 100644
--- a/src/data/things/content.js
+++ b/src/data/things/content.js
@@ -8,6 +8,7 @@ import {contentString, referenceList, simpleDate, soupyFind, thing}
   from '#composite/wiki-properties';
 
 import {
+  exitWithoutDependency,
   exposeConstant,
   exposeDependency,
   exposeDependencyOrContinue,
@@ -19,6 +20,7 @@ import {
   contentArtists,
   hasAnnotationPart,
   withAnnotationParts,
+  withHasAnnotationPart,
   withSourceText,
   withSourceURLs,
   withWebArchiveDate,
@@ -159,6 +161,29 @@ export class LyricsEntry extends ContentEntry {
     isWikiLyrics: hasAnnotationPart({
       part: input.value('wiki lyrics'),
     }),
+
+    hasSquareBracketAnnotations: [
+      withHasAnnotationPart({
+        part: input.value('wiki lyrics'),
+      }),
+
+      exitWithoutDependency({
+        dependency: '#hasAnnotationPart',
+        mode: input.value('falsy'),
+        value: input.value(false),
+      }),
+
+      exitWithoutDependency({
+        dependency: 'body',
+        value: input.value(false),
+      }),
+
+      {
+        dependencies: ['body'],
+        compute: ({body}) =>
+          /\[.*\]/m.test(body),
+      },
+    ],
   });
 }