Do not interpolate verses if args are set.

This commit is contained in:
Benjamin A. Shelton 2026-06-29 21:52:30 -06:00
commit 5d05d4011e
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -9,9 +9,13 @@ function scriptureLink(node, args, meta) {
if (value.match(/[Vv][Vv]?(erses?)?\s*/)) { if (value.match(/[Vv][Vv]?(erses?)?\s*/)) {
const book = meta.data.astro.frontmatter.book; const book = meta.data.astro.frontmatter.book;
const chapter = meta.data.astro.frontmatter.chapter; 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. // Stylized hyphen replacement from Logos.
passage = passage.replaceAll(/–/g, '-'); passage = passage.replaceAll(/–/g, '-');
@ -30,7 +34,6 @@ function scriptureLink(node, args, meta) {
if (passage !== '') { if (passage !== '') {
node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`; node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`;
} }
console.log('passage after:', passage);
if (match) { if (match) {
currentBook = match?.[1].trim(); currentBook = match?.[1].trim();