Adding Astrojs sources.
This commit is contained in:
parent
2664e6d8fc
commit
e20f4f45de
169 changed files with 11389 additions and 0 deletions
8
src/utils/date.js
Normal file
8
src/utils/date.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export const dateFormat = (d) => {
|
||||
const formatter = new Intl.DateTimeFormat('en-US', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
});
|
||||
return formatter.format(d);
|
||||
};
|
||||
5
src/utils/path.js
Normal file
5
src/utils/path.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import path from 'node:path';
|
||||
|
||||
export const urlfrag = (base, pth) => {
|
||||
return path.join(base, pth);
|
||||
};
|
||||
23
src/utils/remark.js
Normal file
23
src/utils/remark.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { visit } from 'unist-util-visit';
|
||||
|
||||
export const ScriptureLinks = () => {
|
||||
return async tree => {
|
||||
visit(tree, node => {
|
||||
if (node.type === 'link') {
|
||||
if (node.url.startsWith(':scripture')) {
|
||||
let passage;
|
||||
if (node.url.indexOf('=') != -1) {
|
||||
passage = node.url.substring(node.url.indexOf('=')+1).replace(/\+/, " ");
|
||||
} else {
|
||||
if (node.children.length != 0) {
|
||||
passage = node.children[0].value;
|
||||
}
|
||||
}
|
||||
const script = encodeURIComponent(passage.toLowerCase());
|
||||
const url = `https://www.biblegateway.com/passage/?search=${script}&version=ESV`;
|
||||
node.url = url;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
8
src/utils/strings.js
Normal file
8
src/utils/strings.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export const titleCase = (s) => {
|
||||
if (!s) return "";
|
||||
return s
|
||||
.toLowerCase()
|
||||
.split(' ')
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ');
|
||||
};
|
||||
Loading…
Reference in a new issue