Release notes: a story for big releases, and the 2.0 story

A CHANGELOG section may open with prose before its first bullet. The build bakes it
into the page and version.json, and "What's new" tells it in full with a link to every
change on GitHub instead of the first sentences of five bullets. The 2.0.0 section gets
its story and every change grouped under headings, Architect runs included.
This commit is contained in:
Frederic Jung 2026-10-30 16:28:19 +01:00
parent dbd2fa7b55
commit abd55c0846
No known key found for this signature in database
8 changed files with 150 additions and 49 deletions

View file

@ -3,7 +3,9 @@
const NOTE_MAX=5,NOTE_CH=140;
function slimNote(n){const m=String(n).match(/^(.+?[.!?])(\s|$)/);let t=m?m[1]:String(n);if(t.length>NOTE_CH)t=t.slice(0,NOTE_CH-1).replace(/\s+\S*$/,'')+'…';return t;}
const notesLong=ns=>ns.length>NOTE_MAX||ns.some(n=>slimNote(n)!==n);
function notesHtml(ns,ver){const more=Math.max(0,ns.length-NOTE_MAX);
// A release with a story tells it in full, then points to every change on GitHub.
const storyHtml=(ps,ver)=>`<div class="story">${ps.map(p=>`<p>${esc(p).replace(/\*\*(.+?)\*\*/g,'<b>$1</b>')}</p>`).join('')}</div><p style="margin:6px 0 0"><a class="b pink sm" href="https://github.com/fjaeckel/seriesoftubes/releases/tag/v${esc(ver)}" target="_blank" rel="noopener">${tr('release_notes.read_the_full_notes_on_github')}</a></p>`;
function notesHtml(ns,ver){if(RELEASE_STORY.length&&ver===APP_VERSION&&ns===RELEASE_NOTES)return storyHtml(RELEASE_STORY,ver);const more=Math.max(0,ns.length-NOTE_MAX);
return `<ul class="notes">${ns.slice(0,NOTE_MAX).map(n=>`<li>${esc(slimNote(n))}</li>`).join('')}${more?`<li class="meta">${trn('release_notes.and_n_more_change',more)}</li>`:''}</ul>`+
(notesLong(ns)?`<p style="margin:6px 0 0"><a class="b pink sm" href="https://github.com/fjaeckel/seriesoftubes/releases/tag/v${esc(ver)}" target="_blank" rel="noopener">${tr('release_notes.read_the_full_notes_on_github')}</a></p>`:'');}
function newerVer(a,b){const x=String(a).split('.').map(Number),y=String(b).split('.').map(Number);for(let i=0;i<3;i++){if((x[i]||0)>(y[i]||0))return true;if((x[i]||0)<(y[i]||0))return false;}return false;}