« get me outta code hell

html: chunkwrap: always provide at least one chunk - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-26 09:48:33 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-03-26 09:48:33 -0300
commit7e1bac49bcac96d7fee9348248974576f94db194 (patch)
tree71fc0f87979816deffecca2ccad4405d32391040 /src
parent3fb5231731e038325fb6e094e36afac4a400ddcc (diff)
html: chunkwrap: always provide at least one chunk
Diffstat (limited to 'src')
-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;