« get me outta code hell

data: contentString (#composite/wiki-properties) - 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>2024-01-05 22:11:32 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-06 12:50:31 -0400
commitf3b6d680c0d78583c14243bcc60d39c8f0c6014d (patch)
treeb8ce379a2e01a03273f086cf66165f5d10ce824a
parent01a1e04649907aaf73564b3442f683cab73c3a78 (diff)
data: contentString (#composite/wiki-properties)
-rw-r--r--src/data/composite/wiki-properties/contentString.js15
-rw-r--r--src/data/composite/wiki-properties/index.js1
-rw-r--r--src/data/composite/wiki-properties/simpleString.js2
3 files changed, 16 insertions, 2 deletions
diff --git a/src/data/composite/wiki-properties/contentString.js b/src/data/composite/wiki-properties/contentString.js
new file mode 100644
index 00000000..b0e82444
--- /dev/null
+++ b/src/data/composite/wiki-properties/contentString.js
@@ -0,0 +1,15 @@
+// String type that's slightly more specific than simpleString. If the
+// property is a generic piece of human-reading content, this adds some
+// useful valiation on top of simpleString - but still check if more
+// particular properties like `name` are more appropriate.
+//
+// This type adapts validation for single- and multiline content.
+
+import {isContentString} from '#validators';
+
+export default function() {
+  return {
+    flags: {update: true, expose: true},
+    update: {validate: isContentString},
+  };
+}
diff --git a/src/data/composite/wiki-properties/index.js b/src/data/composite/wiki-properties/index.js
index 17d51bb8..46b8564c 100644
--- a/src/data/composite/wiki-properties/index.js
+++ b/src/data/composite/wiki-properties/index.js
@@ -8,6 +8,7 @@ export {default as additionalNameList} from './additionalNameList.js';
 export {default as color} from './color.js';
 export {default as commentary} from './commentary.js';
 export {default as commentatorArtists} from './commentatorArtists.js';
+export {default as contentString} from './contentString.js';
 export {default as contribsPresent} from './contribsPresent.js';
 export {default as contributionList} from './contributionList.js';
 export {default as dimensions} from './dimensions.js';
diff --git a/src/data/composite/wiki-properties/simpleString.js b/src/data/composite/wiki-properties/simpleString.js
index 18d65146..7bf317ac 100644
--- a/src/data/composite/wiki-properties/simpleString.js
+++ b/src/data/composite/wiki-properties/simpleString.js
@@ -4,8 +4,6 @@
 
 import {isString} from '#validators';
 
-// TODO: Not templateCompositeFrom.
-
 export default function() {
   return {
     flags: {update: true, expose: true},