Started addressing review comments.
This commit is contained in:
@@ -10,7 +10,7 @@ This plugin takes heavy inspiration from the [Bible Reference](https://github.co
|
|||||||
|
|
||||||
### Getting Started
|
### Getting Started
|
||||||
|
|
||||||
To start with, you will need to format a Bible for your own vault. Some instructions on this can be found [below](#bible-markdown-format) (this plugin uses a different markdown format to *Bible Linker*). I've also already formatted the Public Domain World English Bible so you can [download](https://github.com/camelChief/markdown-webp) that and just get started. Once you've done that, open up the *Local Bible Ref* settings and fill in at least the *Bibles Path* field. Then, to use the plugin, simply open a new note and use the `--` reference prefix to grab a passage of scripture. There are also additional options (similar to terminal command options) you can provide to the reference to indicate which version to use and what markdown format to display the passage in. More information can be found [below](#usage).
|
To start with, you will need to format a Bible for your own vault. Some instructions on this can be found [below](#bible-markdown-format) (this plugin uses a different markdown format to *Bible Linker*). I've also already formatted the Public Domain World English Bible so you can [download](https://github.com/camelChief/markdown-webp) that and just get started. Once you've done that, open up the *Local Bible Ref* settings and fill in at least the *Bibles path* field. Then, to use the plugin, simply open a new note and use the `--` reference prefix to grab a passage of scripture. There are also additional options (similar to terminal command options) you can provide to the reference to indicate which version to use and what markdown format to display the passage in. More information can be found [below](#usage).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,5 @@
|
|||||||
"description": "Quickly and easily reference Bible passages stored locally in your vault.",
|
"description": "Quickly and easily reference Bible passages stored locally in your vault.",
|
||||||
"author": "Caleb Campbell",
|
"author": "Caleb Campbell",
|
||||||
"authorUrl": "https://mastodon.social/@calebcampbell",
|
"authorUrl": "https://mastodon.social/@calebcampbell",
|
||||||
"fundingUrl": "",
|
"isDesktopOnly": false
|
||||||
"isDesktopOnly": true
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -14,7 +14,7 @@
|
|||||||
"@typescript-eslint/parser": "5.29.0",
|
"@typescript-eslint/parser": "5.29.0",
|
||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.17.3",
|
||||||
"obsidian": "latest",
|
"obsidian": "^1.8.7",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.7.4"
|
||||||
}
|
}
|
||||||
@@ -1809,10 +1809,11 @@
|
|||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/obsidian": {
|
"node_modules/obsidian": {
|
||||||
"version": "1.5.7-1",
|
"version": "1.8.7",
|
||||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.5.7-1.tgz",
|
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.8.7.tgz",
|
||||||
"integrity": "sha512-T5ZRuQ1FnfXqEoakTTHVDYvzUEEoT8zSPnQCW31PVgYwG4D4tZCQfKHN2hTz1ifnCe8upvwa6mBTAP2WUA5Vng==",
|
"integrity": "sha512-h4bWwNFAGRXlMlMAzdEiIM2ppTGlrh7uGOJS6w4gClrsjc+ei/3YAtU2VdFUlCiPuTHpY4aBpFJJW75S1Tl/JA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/codemirror": "5.60.8",
|
"@types/codemirror": "5.60.8",
|
||||||
"moment": "2.29.4"
|
"moment": "2.29.4"
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
|||||||
const { containerEl } = this;
|
const { containerEl } = this;
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
||||||
let biblesPathTimeout: NodeJS.Timeout;
|
let biblesPathTimeout: number;
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Bibles Path')
|
.setName('Bibles path')
|
||||||
.setDesc('The path to the folder containing your bibles.')
|
.setDesc('The path to the folder containing your bibles.')
|
||||||
.addText(text => {
|
.addText(text => {
|
||||||
text.setPlaceholder('e.g. Data/Bibles')
|
text.setPlaceholder('e.g. Data/Bibles')
|
||||||
@@ -27,7 +27,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
|||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
|
|
||||||
clearTimeout(biblesPathTimeout);
|
clearTimeout(biblesPathTimeout);
|
||||||
biblesPathTimeout = setTimeout(async () => {
|
biblesPathTimeout = window.setTimeout(async () => {
|
||||||
const exists = await this.app.vault.adapter.exists(value);
|
const exists = await this.app.vault.adapter.exists(value);
|
||||||
if (!exists) new Notice(`Bibles folder doesn't exist at path: ${value}.`);
|
if (!exists) new Notice(`Bibles folder doesn't exist at path: ${value}.`);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -36,9 +36,9 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
|||||||
new PathSuggest(this.app, text.inputEl);
|
new PathSuggest(this.app, text.inputEl);
|
||||||
});
|
});
|
||||||
|
|
||||||
let defaultVersionTimeout: NodeJS.Timeout;
|
let defaultVersionTimeout: number;
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Default Version Shorthand')
|
.setName('Default version shorthand')
|
||||||
.setDesc('The version to use by default - shorthand.')
|
.setDesc('The version to use by default - shorthand.')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setPlaceholder('e.g. NIV')
|
.setPlaceholder('e.g. NIV')
|
||||||
@@ -48,7 +48,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
|||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
|
|
||||||
clearTimeout(defaultVersionTimeout);
|
clearTimeout(defaultVersionTimeout);
|
||||||
defaultVersionTimeout = setTimeout(async () => {
|
defaultVersionTimeout = window.setTimeout(async () => {
|
||||||
const path = `${this.plugin.settings.biblesPath}/${value}`;
|
const path = `${this.plugin.settings.biblesPath}/${value}`;
|
||||||
const exists = await this.app.vault.adapter.exists(path);
|
const exists = await this.app.vault.adapter.exists(path);
|
||||||
if (!exists) new Notice(`Version folder doesn't exist at path: ${path}.`);
|
if (!exists) new Notice(`Version folder doesn't exist at path: ${path}.`);
|
||||||
@@ -56,7 +56,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Default Passage Format')
|
.setName('Default passage format')
|
||||||
.setDesc('The markdown format to use for passages by default.')
|
.setDesc('The markdown format to use for passages by default.')
|
||||||
.addDropdown(dropdown => dropdown
|
.addDropdown(dropdown => dropdown
|
||||||
.addOptions({
|
.addOptions({
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
|||||||
|
|
||||||
// if no settings, alert user
|
// if no settings, alert user
|
||||||
if (!this.settings.biblesPath) {
|
if (!this.settings.biblesPath) {
|
||||||
if (!this.noSettingsNotice?.noticeEl.isShown()) {
|
if (!this.noSettingsNotice?.messageEl.isShown()) {
|
||||||
const noticeText = "Local Bible Ref settings are not " +
|
const noticeText = "Local Bible Ref settings are not " +
|
||||||
"configured. Please set the bibles path before " +
|
"configured. Please set the bibles path before " +
|
||||||
"attempting to reference passages.";
|
"attempting to reference passages.";
|
||||||
@@ -283,9 +283,8 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
|||||||
formatted += "\n\n";
|
formatted += "\n\n";
|
||||||
break;
|
break;
|
||||||
case PassageFormat.Callout: {
|
case PassageFormat.Callout: {
|
||||||
const passageReference = passageRef.stringify();
|
const passageLink = this.generatePassageLink(passageRef, context);
|
||||||
const passageLink = this.generatePassageLink(passageRef, context);
|
formatted = `> [!quote] ${passageLink}\n`;
|
||||||
formatted = `> [!quote] [${passageReference}](${passageLink})\n`;
|
|
||||||
formatted += texts.join("\n\n").trim();
|
formatted += texts.join("\n\n").trim();
|
||||||
formatted = formatted.replace(/\n/gm, "\n> ");
|
formatted = formatted.replace(/\n/gm, "\n> ");
|
||||||
formatted += "\n\n";
|
formatted += "\n\n";
|
||||||
@@ -301,17 +300,17 @@ export class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
|||||||
ref: PassageReference,
|
ref: PassageReference,
|
||||||
context: EditorSuggestContext
|
context: EditorSuggestContext
|
||||||
): string {
|
): string {
|
||||||
let link = "";
|
|
||||||
let folder: TFolder | null = context.file.parent;
|
|
||||||
while (folder?.parent) {
|
|
||||||
link += "../";
|
|
||||||
folder = folder.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { version, book, startChapter } = ref;
|
const { version, book, startChapter } = ref;
|
||||||
link += `${this.settings.biblesPath}/${version}/` +
|
const filePath = `${this.settings.biblesPath}/${version}/${book.name}/${book.name} ${startChapter}.md`;
|
||||||
`${book.name}/${book.name} ${startChapter}.md`;
|
const file = this.app.vault.getFileByPath(filePath);
|
||||||
return link.replace(/ /g, "%20");
|
if (!file) return ref.stringify();
|
||||||
|
|
||||||
|
return this.app.fileManager.generateMarkdownLink(
|
||||||
|
file,
|
||||||
|
context.file.path,
|
||||||
|
undefined,
|
||||||
|
ref.stringify(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user