Do not interpolate verses if args are set.
This commit is contained in:
parent
0f87e8a08d
commit
5d05d4011e
1 changed files with 6 additions and 3 deletions
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue