« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/html.js b/src/util/html.js
index 227fee3c..f59f9192 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -706,8 +706,16 @@ export class Tag {
       }
     }
 
-    if (seenChunkwrapSplitter) {
-      content += '</span>';
+    if (chunkwrapSplitter) {
+      if (seenChunkwrapSplitter) {
+        content += '</span>';
+      } else {
+        // Since chunkwraps take responsibility for wrapping *away* from the
+        // parent element, we generally always want there to be at least one
+        // chunk that gets wrapped as a single unit. So if no chunkwrap has
+        // been seen at all, just wrap everything in one now.
+        content = `<span class="chunkwrap">${content}</span>`;
+      }
     }
 
     content += blockwrapClosers;