diff --git a/docs/assets/app.js b/docs/assets/app.js index 58b9891..e0ee332 100644 --- a/docs/assets/app.js +++ b/docs/assets/app.js @@ -15307,12 +15307,7 @@ function _askRenderSourceCards(data, userQuery, opts = {}) { ? `
↳ ${askEscape(s.headerText)}
` : ''; const arts = s.articles?.length ? `
Articles: ${s.articles.map(askEscape).join(', ')}
` : ''; - const esPara = _askEsPara(s); - const localPara = esPara || state.paragraphById?.get(s.paraId); - const rawText = localPara && typeof renderParagraphHtml === 'function' - ? renderParagraphHtml(localPara.text, localPara.footnotes) - : askEscape(s.text || ''); - const text = annotateTreatyText(rawText, s.committee, s.citedArticles); + const text = annotateTreatyText(_askParaHtml(s), s.committee, s.citedArticles); const why = _askRenderWhyMatched(userQuery, s, ret.articleBoost); const actions = _askRenderSourceActions(s); return ` @@ -15346,6 +15341,19 @@ function _askEsPara(s) { const es = state.esById.get(s.paraId); return es ? { text: es.text, footnotes: es.footnotes || [] } : null; } +// The paragraph Ask returned, as shown: the corpus record when it is loaded +// (Spanish in ES mode), so footnote markers become the usual footnote buttons; +// otherwise the backend text with its [[fn:N]] markers removed — the backend +// sends no footnote texts. +function _askDisplayPara(s) { + if (!s) return null; + return _askEsPara(s) || state.paragraphById?.get(s.paraId) || null; +} +function _askParaHtml(s, fallbackText) { + const p = _askDisplayPara(s); + if (p) return renderParagraphHtml(p.text, p.footnotes); + return askEscape(stripFnMarkers(fallbackText ?? s?.text ?? '')); +} function _askRenderSourceActions(s) { const paraId = s.paraId || ''; @@ -15537,14 +15545,16 @@ function renderAskResult(primaryData, counterData) { ${hint ? `
${hint}
` : ''} `; }; - const topEs = _askEsPara(topSource); - const answerText = topEs ? stripFnMarkers(topEs.text) : data.answer; + // The answer is the top source's text (verbatim); render it like the source cards. + const answerHtml = topSource && (!data.answer || stripFnMarkers(data.answer).trim() === stripFnMarkers(topSource.text || '').trim()) + ? _askParaHtml(topSource, data.answer) + : askEscape(stripFnMarkers(data.answer || '')); const answer = data.answer ? `
Top match · verbatim
First-ranked paragraph below. Read all sources for context — General Comments rarely give a single answer.
${buildSourceContext(topSource)} -
${annotateTreatyText(askEscape(answerText), topSource?.committee, topSource?.citedArticles)}
+
${annotateTreatyText(answerHtml, topSource?.committee, topSource?.citedArticles)}
` : ''; @@ -16148,7 +16158,9 @@ function wireAskTab() { const card = actBtn.closest('.ask-source'); if (act === 'copy') { // Paragraph text + short tag for easy paste-into-notes. - const txt = card?.querySelector('.ask-source-text')?.innerText?.trim() || ''; + const shown = _askDisplayPara({ paraId }); + const txt = shown ? stripFnMarkers(shown.text).trim() + : stripFnMarkers(card?.querySelector('.ask-source-text')?.innerText || '').trim(); const tag = card?.querySelector('.ask-citation')?.innerText?.trim() || ''; const meta = card?.querySelector('.ask-source-meta')?.innerText?.trim() || ''; const payload = [txt, tag ? `\n— ${tag} (${meta})` : ''].join('').trim(); diff --git a/docs/index.html b/docs/index.html index 497e35a..c590425 100644 --- a/docs/index.html +++ b/docs/index.html @@ -155,8 +155,8 @@ } - - + +