[object Object]

← back to Studio Zero

studio-zero: robust calendar title parser (whole-line bold titles + numbered/quoted fallbacks) — extracts all ~12 from live output

15180947dc9e3e93b8d3d2233e0296e382fdd25c · 2026-07-25 00:04:52 -0700 · Steve

Files touched

Diff

commit 15180947dc9e3e93b8d3d2233e0296e382fdd25c
Author: Steve <steve@designerwallcoverings.com>
Date:   Sat Jul 25 00:04:52 2026 -0700

    studio-zero: robust calendar title parser (whole-line bold titles + numbered/quoted fallbacks) — extracts all ~12 from live output
---
 public/index.html | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/public/index.html b/public/index.html
index 7bc6aff..5de516c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -331,8 +331,21 @@ function renderOutput(step,text,demo,cost,maxPlan,equiv){
 }
 
 function parseTitles(text){
-  const out=[];String(text).split('\n').forEach(l=>{const m=l.match(/^\s*(?:\d+[\.\)]|[-*])\s+(.+?)\s*$/);if(m){let t=m[1].replace(/\*\*/g,'').replace(/^["“]|["”]$/g,'').trim();if(t.length>3&&t.length<160)out.push(t);}});
-  return out.slice(0,12);
+  const lines=String(text).split('\n');
+  const titles=[], seen=new Set();
+  const META=/^(type|why|seo|format|priority|goal|upload|video|phase|cadence|length|strategic|target|audience|hook|cta)\b/i;
+  const push=raw=>{
+    let t=String(raw).replace(/\*\*/g,'').replace(/^\s*\d+[\.\)]\s*/,'').replace(/^[\s"'“”‘’]+|[\s"'“”‘’:]+$/g,'').replace(/\s+/g,' ').trim();
+    const key=t.toLowerCase();
+    if(t.length>=8 && t.length<=160 && !META.test(t) && !seen.has(key)){ seen.add(key); titles.push(t); }
+  };
+  // Pass A — whole-line bold titles (the live format: **"Title"**, optionally number-prefixed)
+  for(const l of lines){ const m=l.match(/^\s*(?:\d+[\.\)]\s*)?\*\*(.+?)\*\*\s*$/); if(m) push(m[1]); }
+  // Pass B — numbered plain lines (demo format: "1. Title")
+  if(titles.length<12){ for(const l of lines){ const m=l.match(/^\s*\d+[\.\)]\s+(.+?)\s*$/); if(m) push(m[1]); } }
+  // Pass C — quoted titles anywhere (last-resort fallback)
+  if(titles.length<6){ for(const l of lines){ const m=l.match(/[“"]([^”"]{15,140})[”"]/); if(m) push(m[1]); } }
+  return titles.slice(0,12);
 }
 function renderCalendar(text){
   const titles=parseTitles(text);const wrap=$('#calWrap');

← 98efd98 studio-zero: route live generation through Claude Max plan (  ·  back to Studio Zero  ·  studio-zero: export — download full channel plan as standalo edefa92 →