From 74442c1962d9ae3f334ea7a683c382efad988cef Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 27 May 2026 17:43:36 +0000 Subject: [PATCH] Show external lookup links when Greek word is not found in BDBT --- src/App.jsx | 79 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index a1d08e6..f54e83f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -237,13 +237,32 @@ export function buildExportHtml(project) { `).join(''); const greekTable = wordTableHtml(greekRows); const extendedDefinitions = chunk.greekWords - .filter((word) => word.definitionHtml) - .map((word) => ` -
-

${word.strongNumber} — ${word.lexeme || ''}

-
${word.definitionHtml}
-
- `) + .map((word) => { + if (word.definitionHtml) { + return ` +
+

${word.strongNumber} — ${word.lexeme || ''}

+
${word.definitionHtml}
+
+ `; + } + if ((word.shortDefinition === 'No definition found.' || word.shortDefinition === 'Lookup failed.') && word.query) { + const raw = word.query.trim(); + const normalized = /^\d+$/.test(raw) ? `G${raw}` : raw.toUpperCase(); + const isStrongs = /^G\d+$/.test(normalized); + const num = isStrongs ? normalized.slice(1) : null; + const links = isStrongs && num + ? `BibleHub · Blue Letter Bible · StudyLight` + : `BibleHub · Blue Letter Bible`; + return ` +
+

${raw} — definition not found in auto-lookup

+

Look it up manually: ${links}

+
+ `; + } + return ''; + }) .join(''); return ` @@ -854,6 +873,25 @@ const App = () => { const isGreekStrongNumber = (query) => /^G\d+$/i.test(query.trim()); const isHebrewStrongNumber = (query) => /^H\d+$/i.test(query.trim()); + const externalLookupLinks = (query) => { + const raw = query.trim(); + const normalized = /^\d+$/.test(raw) ? `G${raw}` : raw.toUpperCase(); + const isStrongs = /^G\d+$/.test(normalized); + const num = isStrongs ? normalized.slice(1) : null; + if (isStrongs && num) { + return [ + { label: 'BibleHub', url: `https://biblehub.com/greek/${num}.htm` }, + { label: 'Blue Letter Bible', url: `https://www.blueletterbible.org/lexicon/g${num}/esv/0-1/` }, + { label: 'StudyLight', url: `https://www.studylight.org/lexicons/eng/greek/${num}.html` }, + ]; + } + const enc = encodeURIComponent(raw); + return [ + { label: 'BibleHub', url: `https://biblehub.com/search.php?q=${enc}` }, + { label: 'Blue Letter Bible', url: `https://www.blueletterbible.org/search/search.cfm?Criteria=${enc}&t=KJV#s=s_lexiconc` }, + ]; + }; + const fetchBollsDefinition = async (query) => { const isGreek = isGreekStrongNumber(query); const isHebrew = isHebrewStrongNumber(query); @@ -1718,6 +1756,33 @@ const App = () => { /> ) : null} + {(word.shortDefinition === 'No definition found.' || word.shortDefinition === 'Lookup failed.') && word.query.trim() ? ( +
+

+ Not found in BDBT — look it up manually: +

+
+ {externalLookupLinks(word.query).map(({ label, url }) => ( + + {label} ↗ + + ))} + +
+
+ ) : null} )) )}