diff --git a/src/utils/rehype.js b/src/utils/rehype.js index 0026f96..ecd341a 100644 --- a/src/utils/rehype.js +++ b/src/utils/rehype.js @@ -9,9 +9,13 @@ function scriptureLink(node, args, meta) { if (value.match(/[Vv][Vv]?(erses?)?\s*/)) { const book = meta.data.astro.frontmatter.book; const chapter = meta.data.astro.frontmatter.chapter; - passage = `${book} ${chapter}:${value.replace(/[Vv][Vv]?(erses?)?\s*/, '')}`; + if ((args.length == 0 || args[0] == '') && (book && chapter)) { + passage = `${book} ${chapter}:${value.replace(/[Vv][Vv]?(erses?)?\s*/, '')}`; + } else if (args.length == 0 || args[0] == '') { + node.properties.href = null; + return; + } } - console.log("passage with meta:", passage); // Stylized hyphen replacement from Logos. passage = passage.replaceAll(/–/g, '-'); @@ -30,7 +34,6 @@ function scriptureLink(node, args, meta) { if (passage !== '') { node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`; } - console.log('passage after:', passage); if (match) { currentBook = match?.[1].trim();