diff --git a/network-poc/static/index.html b/network-poc/static/index.html index c80e4e9..7db35a8 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2840,26 +2840,62 @@ ${fixableFiles}`; const agentNames = { manager: 'Manageri', coder: 'Koodari', tester: 'DevOps', qa: 'QA', data: 'Data' }; const agentColors = { manager: '#d29922', coder: '#3fb950', tester: '#58a6ff', qa: '#a371f7', data: '#d2a8ff' }; + // Syntaksikorostus: kevyt regex-pohjainen highlighter + function highlightCode(code, filename) { + let h = code.replace(/&/g,'&').replace(/$1'); + // Stringit (kolmois- ja yksittäiset) + h = h.replace(/("""[\s\S]*?"""|'''[\s\S]*?''')/g, '$1'); + h = h.replace(/((?$1'); + // Avainsanat + h = h.replace(/\b(def|class|import|from|return|if|elif|else|for|in|while|try|except|finally|with|as|raise|yield|async|await|True|False|None|not|and|or|is|lambda)\b/g, '$1'); + // Dekoraattorit + h = h.replace(/^(\s*@\w+)/gm, '$1'); + // Numerot + h = h.replace(/\b(\d+\.?\d*)\b/g, '$1'); + } else if (filename.endsWith('.html')) { + h = h.replace(/(<\/?[\w-]+)/g, '$1'); + h = h.replace(/([\w-]+)=/g, '$1='); + h = h.replace(/((?$1'); + } else if (filename === 'Dockerfile') { + h = h.replace(/^(FROM|RUN|COPY|WORKDIR|EXPOSE|CMD|ENV|ARG|ENTRYPOINT|ADD|VOLUME|LABEL|USER)/gm, '$1'); + h = h.replace(/(#[^\n]*)/g, '$1'); + h = h.replace(/((?$1'); + } + return h; + } + const stepsHtml = steps.map((s, i) => { const color = agentColors[s.agent] || '#8b949e'; const icon = s.status === 'done' ? '✓' : '◷'; const outputPreview = (s.output || '').substring(0, 500); + const highlighted = outputPreview ? highlightCode(outputPreview, s.label) : ''; return ` -