diff --git a/app.py b/app.py index 21b0494..06a83d7 100644 --- a/app.py +++ b/app.py @@ -527,7 +527,7 @@ def analyze(draft: Draft): sids.append(None) prev_blank = True continue - if stripped[0] in "#([": + if stripped[0] in "#[": # annotation line ([Chorus], (yeah), # notes) — no highlighting, # no scheme letter, and it doesn't split the stanza either sids.append(None) diff --git a/static/index.html b/static/index.html index 16f4849..c8540d2 100644 --- a/static/index.html +++ b/static/index.html @@ -675,7 +675,7 @@ function render(){ h += `${text}`; } } - const lcls = 'lmark' + (/^\s*#/.test(line) ? ' hdr' : /^\s*[([]/.test(line) ? ' anno' : ''); + const lcls = 'lmark' + (/^\s*#/.test(line) ? ' hdr' : /^\s*\[/.test(line) ? ' anno' : ''); html += (line ? `${h}` : '') + '\n'; }); highlight.innerHTML = html; @@ -1117,7 +1117,7 @@ document.getElementById('exportBtn').addEventListener('click', async ()=>{ }); // 2) base text (ink, or dim for headers/annotations) - const isHdr = /^\s*#/.test(line), isAnno = /^\s*[([]/.test(line); + const isHdr = /^\s*#/.test(line), isAnno = /^\s*\[/.test(line); x.font = isHdr ? '700 ' + font : font; x.fillStyle = isHdr ? '#8a7d6c' : isAnno ? '#6a5f52' : ink; x.fillText(line, PAD, y); diff --git a/tests/test_rhymes.py b/tests/test_rhymes.py index 8b59772..495a38a 100644 --- a/tests/test_rhymes.py +++ b/tests/test_rhymes.py @@ -267,23 +267,28 @@ def test_weak_phrase_attaches_but_never_founds(): assert "were up" not in highlighted("it were up to him\nit were up to her") -def test_annotation_lines_ignored(): +def test_bracket_and_hash_lines_ignored(): text = ("[Chorus]\n" "the cat\n" "a hat\n" "# note: tighten this verse\n" - "(yeah)\n" "so blue\n" "so true") res = analyze(Draft(text=text)) assert "chorus" not in highlighted(text) assert "note" not in highlighted(text) - # annotations don't split the stanza or earn scheme letters + # [ and # lines don't split the stanza or earn scheme letters (st,) = res["stanzas"] - assert st["lines"] == [1, 2, 5, 6] + assert st["lines"] == [1, 2, 4, 5] assert st["scheme"] == "aabb" +def test_paren_lines_are_lyrics(): + # ( lines are real lyrics now (MF DOOM style), not ignored ad-libs + text = "the city bright tonight\n(shining all the light)" + group_with(text, "tonight", "light") + + def test_perfect_subgroup_fuses_with_slant_family(): # shoulder/older/colder (perfect, OW L D ER) live inside the bigger # OW-schwa family — one color for the whole column