More cleaning up.

This commit is contained in:
Caleb Campbell
2025-07-11 15:30:32 +10:00
parent eb6869738c
commit 0f1a971ed7
5 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
{ {
"id": "local-bible-ref", "id": "local-bible-ref",
"name": "Local Bible Ref", "name": "Local Bible Ref",
"version": "1.0.1", "version": "1.0.2",
"minAppVersion": "0.15.0", "minAppVersion": "0.15.0",
"description": "Quickly and easily reference Bible passages stored locally in your Obsidian vault.", "description": "Quickly and easily reference Bible passages stored locally in your Obsidian vault.",
"author": "Caleb Campbell", "author": "Caleb Campbell",

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "local-bible-ref", "name": "local-bible-ref",
"version": "1.0.1", "version": "1.0.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "local-bible-ref", "name": "local-bible-ref",
"version": "1.0.1", "version": "1.0.2",
"description": "Quickly and easily reference Bible passages stored locally in your Obsidian vault.", "description": "Quickly and easily reference Bible passages stored locally in your Obsidian vault.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@@ -175,7 +175,7 @@ export class PassageReference implements ChapterReference, PassageOptions {
// there are special keywords for formatting (m or manuscript, for // there are special keywords for formatting (m or manuscript, for
// example) - anything else is treated as a Bible version code // example) - anything else is treated as a Bible version code
for (let option of optionArgs) { for (const option of optionArgs) {
switch (option) { switch (option) {
case "m": case "m":
case "manuscript": case "manuscript":

View File

@@ -110,7 +110,7 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
ref: PassageReference ref: PassageReference
): Promise<string[] | null> { ): Promise<string[] | null> {
let basePath = ""; let basePath = "";
for (let alias of [ref.book.name, ...ref.book.aliases]) { for (const alias of [ref.book.name, ...ref.book.aliases]) {
basePath = [this.settings.biblesPath, ref.version, alias].join("/"); basePath = [this.settings.biblesPath, ref.version, alias].join("/");
// if the book exists at this alias, use the alias instead // if the book exists at this alias, use the alias instead
@@ -210,14 +210,14 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
private removeBOF(text: string): string { private removeBOF(text: string): string {
if (!text.startsWith("---")) return text; if (!text.startsWith("---")) return text;
// split at YAML front matter // split at YAML front matter
let split = text.split(/^\-\-\-$/m); const split = text.split(/^---$/m);
return split[2].trim(); return split[2].trim();
} }
/** Removes the end-of-file content from the given text. */ /** Removes the end-of-file content from the given text. */
private removeEOF(text: string): string { private removeEOF(text: string): string {
// split at chapter divider // split at chapter divider
let split = text.split(/^\-\-\-$/m); let split = text.split(/^---$/m);
// split at footnotes // split at footnotes
split = split[0].split(/^\[\^\d+\]:/m, 1); split = split[0].split(/^\[\^\d+\]:/m, 1);
return split[0].trim(); return split[0].trim();
@@ -262,7 +262,7 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
formatted = formatted.replace(/\n/gm, "\n> "); formatted = formatted.replace(/\n/gm, "\n> ");
formatted += "\n\n"; formatted += "\n\n";
break; break;
case PassageFormat.Callout: case PassageFormat.Callout: {
const passageReference = passageRef.stringify(); const passageReference = passageRef.stringify();
const passageLink = this.generatePassageLink(passageRef, context); const passageLink = this.generatePassageLink(passageRef, context);
formatted = `> [!quote] [${passageReference}](${passageLink})\n`; formatted = `> [!quote] [${passageReference}](${passageLink})\n`;
@@ -271,6 +271,7 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
formatted += "\n\n"; formatted += "\n\n";
break; break;
} }
}
return formatted; return formatted;
} }