PR-17 - Fixed a minor bug where the full text for multi-chapter references wasn't being displayed in the passage preview and updated a few just stylistic things.
This commit is contained in:
2
main.ts
2
main.ts
@@ -40,9 +40,9 @@ export default class LocalBibleRefPlugin extends Plugin {
|
||||
defaultVersionShorthand: '',
|
||||
defaultPassageFormat: PassageFormat.Callout,
|
||||
bibleFormat: BibleFormat.LocalBibleRef,
|
||||
fullPreview: false,
|
||||
quote: quoteSettings,
|
||||
callout: calloutSettings,
|
||||
fullSuggestion: true
|
||||
};
|
||||
|
||||
if (!this.settings.quote) this.settings.quote = quoteSettings;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "local-bible-ref",
|
||||
"version": "1.3.2",
|
||||
"version": "1.2.2",
|
||||
"description": "Quickly and easily reference Bible passages stored locally in your Obsidian vault.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -39,6 +39,11 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
description:
|
||||
'Der Formatierungsstil, den Sie für Ihre Vault-Bibeln verwenden. Local Bible Ref benötigt diesen, um Textpassagen korrekt zu analysieren.',
|
||||
},
|
||||
fullPreview: {
|
||||
name: 'Vollständige Passage-Vorschau',
|
||||
description:
|
||||
'Ob in der Vorschau der vollständige Text oder nur ein Ausschnitt angezeigt werden soll.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -89,18 +94,6 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: 'Einstellungen für das Vorschlagsformat',
|
||||
description: 'Einstellungen für das Format des Hinweistextes.',
|
||||
controls: {
|
||||
full: {
|
||||
name: 'Vollständiger Vorschlag',
|
||||
description:
|
||||
'Ob der für die Passage vorgeschlagene Hinweis vollständig ist.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
issues: {
|
||||
before:
|
||||
'Falls Sie Probleme mit Local Bible Ref feststellen oder Verbesserungsvorschläge haben, ',
|
||||
|
||||
@@ -38,6 +38,11 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
description:
|
||||
'The formatting style you use for your vault bibles. Local Bible Ref relies on this to parse passages correctly.',
|
||||
},
|
||||
fullPreview: {
|
||||
name: 'Full Passage Preview',
|
||||
description:
|
||||
'Whether to display the full passage in the preview rather than just a snippet.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -87,19 +92,6 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: 'Suggestion Format Settings',
|
||||
description: 'Settings for the callout suggestion passage format.',
|
||||
controls: {
|
||||
full: {
|
||||
name: 'Full Suggestion',
|
||||
description:
|
||||
'Whether the callout suggestion to use for the passage is full.',
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
issues: {
|
||||
before:
|
||||
'If you find any issues with Local Bible Ref or have suggestions for improvements, please ',
|
||||
|
||||
@@ -38,6 +38,10 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
description:
|
||||
'보관된 성경에 사용하는 서식 스타일입니다. Local Bible Ref는 이 스타일을 기반으로 구절을 정확하게 분석합니다.',
|
||||
},
|
||||
fullPreview: {
|
||||
name: '전체 구절 미리보기',
|
||||
description: '미리보기에서 전체 내용을 표시할지, 아니면 일부만 표시할지 여부.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -84,18 +88,6 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: '제안 형식 설정',
|
||||
description: '콜아웃 제안 문구 형식에 대한 설정입니다.',
|
||||
controls: {
|
||||
full: {
|
||||
name: '전체 제안',
|
||||
description:
|
||||
'본문에 사용할 콜아웃 제안이 완전한지 여부.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
issues: {
|
||||
before:
|
||||
'Local Bible Ref에 문제가 있거나 개선 사항에 대한 제안이 있는 경우, ',
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface SettingsLabels {
|
||||
};
|
||||
};
|
||||
bibleFormat: Control;
|
||||
fullPreview: Control;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -61,14 +62,6 @@ export interface SettingsLabels {
|
||||
};
|
||||
};
|
||||
|
||||
suggestionFormat: {
|
||||
name: string;
|
||||
description: string;
|
||||
controls: {
|
||||
full: Control;
|
||||
};
|
||||
};
|
||||
|
||||
issues: {
|
||||
before: string;
|
||||
link: string;
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
|
||||
display(): void {
|
||||
const { containerEl } = this;
|
||||
const { required, optional, quoteFormat, calloutFormat, suggestionFormat, issues } =
|
||||
const { required, optional, quoteFormat, calloutFormat, issues } =
|
||||
this.settingsLabels;
|
||||
containerEl.empty();
|
||||
|
||||
@@ -87,6 +87,8 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
new PathSuggest(this.app, text.inputEl);
|
||||
});
|
||||
|
||||
|
||||
// optional settings ---
|
||||
new Setting(containerEl).setName(optional.name).setHeading();
|
||||
|
||||
let defaultVersionTimeout: number;
|
||||
@@ -150,6 +152,20 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(optional.controls.fullPreview.name)
|
||||
.setDesc(optional.controls.fullPreview.description)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.fullPreview)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.fullPreview = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
// quote format settings ---
|
||||
new Setting(containerEl)
|
||||
.setName(quoteFormat.name)
|
||||
.setDesc(quoteFormat.description)
|
||||
@@ -210,7 +226,8 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
|
||||
}
|
||||
|
||||
// callout format
|
||||
|
||||
// callout format settings ---
|
||||
new Setting(containerEl)
|
||||
.setName(calloutFormat.name)
|
||||
.setDesc(calloutFormat.description)
|
||||
@@ -267,24 +284,6 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
})
|
||||
);
|
||||
|
||||
//suggestion format
|
||||
new Setting(containerEl)
|
||||
.setName(suggestionFormat.name)
|
||||
.setDesc(suggestionFormat.description)
|
||||
.setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(suggestionFormat.controls.full.name)
|
||||
.setDesc(suggestionFormat.controls.full.description)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.fullSuggestion)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.fullSuggestion = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
const issuesLink = document.createElement('a');
|
||||
issuesLink.href = 'https://github.com/camelChief/local-bible-ref/issues';
|
||||
issuesLink.textContent = issues.link;
|
||||
|
||||
@@ -117,7 +117,8 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
});
|
||||
|
||||
// suggest
|
||||
const excerpt = this.generateExcerpt(texts[0]);
|
||||
const fullText = texts.join('\n\n');
|
||||
const excerpt = this.generateExcerpt(fullText);
|
||||
const text = this.formatTexts(texts, passageRef, context);
|
||||
return [{ excerpt, text }];
|
||||
}
|
||||
@@ -295,26 +296,24 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
|
||||
/** Generates an excerpt for the suggestion. */
|
||||
private generateExcerpt(text: string): string {
|
||||
if(this.settings.fullSuggestion){
|
||||
text = text.replace(/(?:<sup>)/g, "");
|
||||
text = text.replace(/(?:<\/sup>)/g, "");
|
||||
}
|
||||
else{
|
||||
const fullPreview = this.settings.fullPreview;
|
||||
if (fullPreview) {
|
||||
text = text.replace(/<sup>/g, '');
|
||||
text = text.replace(/<\/sup>/g, '');
|
||||
} else {
|
||||
text = text.split(/<\/sup>/, 2)[1];
|
||||
text = text.replace(/<sup>\d+<\/sup>/g, "");
|
||||
text = text.replace(/^(?:> |- )/gm, "");
|
||||
text = text.replace(/<sup>\d+<\/sup>/g, '');
|
||||
text = text.replace(/^(?:> |- )/gm, '');
|
||||
}
|
||||
|
||||
text = text.replace(
|
||||
/<span(?:\s+\w+=['"][^'"]+['"])*>([^<]+)<\/span>/g,
|
||||
"$1"
|
||||
'$1'
|
||||
);
|
||||
if(!this.settings.fullSuggestion)
|
||||
text = text.replace(/\n/g, ' ');
|
||||
text = text.replace(/ {2,}/g, " ");
|
||||
if (this.settings.fullSuggestion)
|
||||
return text;
|
||||
return text.slice(0, 45) + "...";
|
||||
if (!fullPreview) text = text.replace(/\n/g, ' ');
|
||||
text = text.replace(/ {2,}/g, ' ');
|
||||
if (fullPreview) return text;
|
||||
return text.slice(0, 45) + '...';
|
||||
}
|
||||
|
||||
/** Formats the final text for suggestion. */
|
||||
@@ -362,15 +361,14 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
break;
|
||||
}
|
||||
case PassageFormat.Callout: {
|
||||
const { type, linkToPassage } = this.settings.callout;
|
||||
const { type, linkToPassage, collapsible } = this.settings.callout;
|
||||
|
||||
let stringRef = '';
|
||||
if (linkToPassage)
|
||||
stringRef = this.generatePassageLink(passageRef, context);
|
||||
else stringRef = passageRef.stringify();
|
||||
formatted = `> [!quote]${this.settings.callout.collapsible? '+' : ''} ${stringRef}\n`;
|
||||
|
||||
formatted = `> [!${type}]${this.settings.callout.collapsible? '+' : ''} ${stringRef}\n`;
|
||||
formatted = `> [!${type}]${collapsible ? '+' : ''} ${stringRef}\n`;
|
||||
formatted += texts.join('\n\n').trim();
|
||||
formatted = formatted.replace(/\n/gm, '\n> ');
|
||||
formatted += '\n\n';
|
||||
|
||||
@@ -6,6 +6,7 @@ export default interface LocalBibleRefSettings {
|
||||
defaultVersionShorthand: string;
|
||||
defaultPassageFormat: PassageFormat;
|
||||
bibleFormat: BibleFormat;
|
||||
fullPreview: boolean;
|
||||
quote: {
|
||||
includeReference: boolean;
|
||||
referencePosition: QuoteReferencePosition;
|
||||
@@ -16,7 +17,6 @@ export default interface LocalBibleRefSettings {
|
||||
linkToPassage: boolean;
|
||||
collapsible: boolean;
|
||||
};
|
||||
fullSuggestion: boolean;
|
||||
}
|
||||
|
||||
export enum QuoteReferencePosition {
|
||||
|
||||
Reference in New Issue
Block a user