]> piware.de Git - chordpro-web.git/commitdiff
Partial fix for chord-only paragraphs
authorMartin Pitt <martin@piware.de>
Sat, 1 Jul 2023 12:27:55 +0000 (14:27 +0200)
committerMartin Pitt <martin@piware.de>
Sun, 2 Jul 2023 07:08:19 +0000 (09:08 +0200)
chordpro-web.js
chordpro.css

index 188646a6b65d9cbfc798a057875d487aceababa9..45f800dc35ca9aeea9164957ff43bae7e159fa82 100644 (file)
@@ -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')
index 5b25d95b160a28f5deed028db6967d43bc7b5ad9..e2e75c408d800c54e5707f602d67dd1c279e381b 100644 (file)
@@ -19,6 +19,11 @@ h2 {
   line-height: 2.3em;
 }
 
+.chord + .chord {
+  width: unset;
+  margin-left: 0.3ex;
+}
+
 .chord {
   position: relative;
   top: -1em;