Match only verse identifies at start of string.
This commit is contained in:
parent
6b1c2c1514
commit
a83f1cabe6
1 changed files with 2 additions and 2 deletions
|
|
@ -6,11 +6,11 @@ function scriptureLink(node, args, meta) {
|
||||||
const value = node.children?.[0]?.value?.trim() || '';
|
const value = node.children?.[0]?.value?.trim() || '';
|
||||||
let passage = (args && args.length > 0 && args[0] != '') ? args[0] : value;
|
let passage = (args && args.length > 0 && args[0] != '') ? args[0] : value;
|
||||||
|
|
||||||
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;
|
||||||
if ((args.length == 0 || args[0] == '') && (book && chapter)) {
|
if ((args.length == 0 || args[0] == '') && (book && chapter)) {
|
||||||
passage = `${book} ${chapter}:${value.replace(/[Vv][Vv]?(erses?)?\s*/, '')}`;
|
passage = `${book} ${chapter}:${value.replace(/^[Vv][Vv]?(erses?)?\s*/, '')}`;
|
||||||
} else if (args.length == 0 || args[0] == '') {
|
} else if (args.length == 0 || args[0] == '') {
|
||||||
node.properties.href = null;
|
node.properties.href = null;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue