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) => {
|
visit(tree, 'element', (node) => {
|
||||||
let passage = '';
|
let passage = '';
|
||||||
let isQuote = false;
|
let isQuote = false;
|
||||||
|
let isCite = false;
|
||||||
const url = node.properties.href;
|
const url = node.properties.href;
|
||||||
if (node.tagName !== 'a') {
|
if (node.tagName !== 'a') {
|
||||||
return;
|
return;
|
||||||
|
|
@ -19,6 +20,8 @@ export const ScriptureLinks = () => {
|
||||||
for (const arg of args) {
|
for (const arg of args) {
|
||||||
if (arg === 'quote') {
|
if (arg === 'quote') {
|
||||||
isQuote = true;
|
isQuote = true;
|
||||||
|
} else if (arg === 'cite') {
|
||||||
|
isCite = true;
|
||||||
} else {
|
} else {
|
||||||
passage = arg;
|
passage = arg;
|
||||||
}
|
}
|
||||||
|
|
@ -37,11 +40,21 @@ export const ScriptureLinks = () => {
|
||||||
|
|
||||||
passage = passage.replace(/ /, '+');
|
passage = passage.replace(/ /, '+');
|
||||||
passage = passage.replace(/\:/, '%3A');
|
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';
|
node.properties.class = 'scripture';
|
||||||
if (isQuote) {
|
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) {
|
if (match) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue