« get me outta code hell

data: language: support multiple children in #wrapSanitized - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-29 16:01:21 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-30 13:23:08 -0400
commitec1ab18897d8dcd20d13fa5b5e1096b80a21ce95 (patch)
treee7a9944c98b8507d64049831ddc77877231be0ef /src/data
parent3ec9473bf3fb6438a331890138c0f81264495c63 (diff)
data: language: support multiple children in #wrapSanitized
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/language.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index 60d089b7..4481af55 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -1,8 +1,8 @@
 import { Temporal, toTemporalInstant } from '@js-temporal/polyfill';
 
-import {isLanguageCode} from '#validators';
-import {Tag} from '#html';
+import * as html from '#html';
 import {empty, withAggregate} from '#sugar';
+import {isLanguageCode} from '#validators';
 
 import {
   getExternalLinkStringOfStyleFromDescriptors,
@@ -274,8 +274,11 @@ export class Language extends Thing {
   // content is a string *that may contain HTML* and doesn't need to
   // sanitized any further. It'll still .toString() to just the string
   // contents, if needed.
-  #wrapSanitized(output) {
-    return new Tag(null, null, output);
+  #wrapSanitized(content) {
+    return html.tags(content, {
+      [html.joinChildren]: '',
+      [html.noEdgeWhitespace]: true,
+    });
   }
 
   // Similar to the above internal methods, but this one is public.
@@ -296,7 +299,7 @@ export class Language extends Thing {
 
     return (
       (typeof arg === 'string'
-        ? new Tag(null, null, escapeHTML(arg))
+        ? this.#wrapSanitized(escapeHTML(arg))
         : arg));
   }