From: Martin Pitt <martin@piware.de>
Date: Sat, 1 Jul 2023 12:27:55 +0000 (+0200)
Subject: Partial fix for chord-only paragraphs
X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=dc37808f4ff0e78b86994aa20ac3563b322e4b23;p=chordpro-web.git

Partial fix for chord-only paragraphs
---

diff --git a/chordpro-web.js b/chordpro-web.js
index 188646a..45f800d 100644
--- a/chordpro-web.js
+++ b/chordpro-web.js
@@ -44,8 +44,9 @@ function renderChordpro(text) {
 
             // split line into parts on chords
             const parts = [];
-            line.split(/(\[[^\]]+\])/).forEach(part => parts.push(
-                part[0] == '[' ? html`<span class="chord">${part.slice(1, -1)}</span>` : part
+            line.split(/(\[[^\]]+\])/).forEach(part => parts.push(part[0] == '['
+                ? html`<span class="chord">${part.slice(1, -1)}</span>`
+                : (part ? html`<span class="text">${part}</span>` : null)
             ));
             verseHasChords ||= parts.length > 1;
             parts.push('\n')
diff --git a/chordpro.css b/chordpro.css
index 5b25d95..e2e75c4 100644
--- a/chordpro.css
+++ b/chordpro.css
@@ -19,6 +19,11 @@ h2 {
   line-height: 2.3em;
 }
 
+.chord + .chord {
+  width: unset;
+  margin-left: 0.3ex;
+}
+
 .chord {
   position: relative;
   top: -1em;