Added utility class for citations.
This commit is contained in:
parent
c0c8b001aa
commit
dbe8c1e3fa
1 changed files with 15 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ export const ScriptureLinks = () => {
|
|||
visit(tree, 'element', (node) => {
|
||||
let passage = '';
|
||||
let isQuote = false;
|
||||
let isCite = false;
|
||||
const url = node.properties.href;
|
||||
if (node.tagName !== 'a') {
|
||||
return;
|
||||
|
|
@ -19,6 +20,8 @@ export const ScriptureLinks = () => {
|
|||
for (const arg of args) {
|
||||
if (arg === 'quote') {
|
||||
isQuote = true;
|
||||
} else if (arg === 'cite') {
|
||||
isCite = true;
|
||||
} else {
|
||||
passage = arg;
|
||||
}
|
||||
|
|
@ -37,11 +40,21 @@ export const ScriptureLinks = () => {
|
|||
|
||||
passage = passage.replace(/ /, '+');
|
||||
passage = passage.replace(/\:/, '%3A');
|
||||
node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`;
|
||||
|
||||
if (passage !== '') {
|
||||
node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`;
|
||||
}
|
||||
|
||||
node.properties.class = 'scripture';
|
||||
if (isQuote) {
|
||||
node.properties.class = 'scripture quote';
|
||||
node.properties.class += ' quote';
|
||||
}
|
||||
if (isCite) {
|
||||
if (passage === '') {
|
||||
node.properties.href = null;
|
||||
node.properties.title = 'Scriptural citation or fragmentary citation';
|
||||
}
|
||||
node.properties.class += ' cite';
|
||||
}
|
||||
|
||||
if (match) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue