Compare commits

...

12 Commits

Author SHA1 Message Date
Caleb Campbell
2ba7968d29 Bumped manifest version. 2026-04-03 14:07:13 +11:00
Caleb Campbell
4d7fcaadf2 Merge pull request #23 from camelChief/22-add-czech-language-support
22 - Added Czech language support.
2026-04-03 14:04:50 +11:00
Caleb Campbell
4d2bdbaebb 22 - Finalised Czech language support. 2026-04-03 14:04:04 +11:00
Caleb Campbell
75bd2ec8cf 22 - Added Czech language support. 2026-04-03 13:56:36 +11:00
Caleb Campbell
be3909a224 Merge pull request #21 from camelChief/20-allow-numbers-in-bible-version-code
20 - Modified passage reference regexp to accept digits in the Bible …
2026-04-03 13:14:26 +11:00
Caleb Campbell
9ae66c9627 20 - Modified passage reference regexp to accept digits in the Bible version code option. 2026-04-03 13:13:25 +11:00
Caleb Campbell
c8aa5c707b Bumped manifest version. 2026-02-10 10:39:38 +11:00
Caleb Campbell
c0fb103d45 Merge pull request #19 from camelChief/18-utilise-new-settings-groups
18 - Modified settings to use new SettingGroup API.
2026-02-10 10:34:57 +11:00
Caleb Campbell
95149fb9c3 18 - Modified settings to use new SettingGroup API. 2026-02-10 10:32:39 +11:00
Caleb Campbell
889732b301 Merge pull request #17 from Chray221/link-collapsible-suggestion
feat - callout quote collapsible setting and full suggestion display setting
2026-02-10 09:10:26 +11:00
Caleb Campbell
7f2c2589f3 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. 2026-02-10 09:01:50 +11:00
Christian Jay Tautu-an
30b9a60baf feat - added callout qoute collapsible setting;
Feat - added show full suggestion setting;
2026-01-31 13:34:26 +08:00
18 changed files with 813 additions and 343 deletions

View File

@@ -32,6 +32,7 @@ export default class LocalBibleRefPlugin extends Plugin {
const calloutSettings = { const calloutSettings = {
type: CalloutType.Quote, type: CalloutType.Quote,
linkToPassage: true, linkToPassage: true,
collapsible: true,
}; };
this.settings ??= { this.settings ??= {
@@ -39,6 +40,7 @@ export default class LocalBibleRefPlugin extends Plugin {
defaultVersionShorthand: '', defaultVersionShorthand: '',
defaultPassageFormat: PassageFormat.Callout, defaultPassageFormat: PassageFormat.Callout,
bibleFormat: BibleFormat.LocalBibleRef, bibleFormat: BibleFormat.LocalBibleRef,
fullPreview: false,
quote: quoteSettings, quote: quoteSettings,
callout: calloutSettings, callout: calloutSettings,
}; };

View File

@@ -1,7 +1,7 @@
{ {
"id": "local-bible-ref", "id": "local-bible-ref",
"name": "Local Bible Ref", "name": "Local Bible Ref",
"version": "1.2.2", "version": "1.3.1",
"minAppVersion": "1.9.14", "minAppVersion": "1.9.14",
"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",

400
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "local-bible-ref", "name": "local-bible-ref",
"version": "1.2.2", "version": "1.3.1",
"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": {

90
src/i18n/cs/books.ts Normal file
View File

@@ -0,0 +1,90 @@
import { Book } from '../models';
export const BOOKS: Book[] = [
{ id: 'gen', name: '1. Mojžišova', aliases: ['Genesis', '1mz', '1 mz'] },
{ id: 'exo', name: '2. Mojžišova', aliases: ['Exodus', '2mz', '2 mz'] },
{ id: 'lev', name: '3. Mojžišova', aliases: ['Leviticus', '3mz', '3 mz'] },
{ id: 'num', name: '4. Mojžišova', aliases: ['Numeri', '4mz', '4 mz'] },
{
id: 'deu',
name: '5. Mojžišova',
aliases: ['Deuteronomium', '5mz', '5 mz'],
},
{ id: 'jos', name: 'Józua', aliases: ['Jozue', 'joz'] },
{ id: 'jdg', name: 'Sudcov', aliases: ['Soudců', 'sd'] },
{ id: 'rut', name: 'Rút', aliases: [] },
{ id: '1sa', name: '1. Samuelova', aliases: ['1 Samuel'] },
{ id: '2sa', name: '2. Samuelova', aliases: ['2 Samuel'] },
{ id: '1ki', name: '1. Královská', aliases: ['1 Královská', '1kr', '1 kr'] },
{ id: '2ki', name: '2. Královská', aliases: ['2 Královská', '2kr', '2 kr'] },
{
id: '1ch',
name: '1. Kronická',
aliases: ['1 Letopisů', '1. Paralipomenon', '1pa', '1par', '1 pa', '1 par'],
},
{
id: '2ch',
name: '2. Kronická',
aliases: ['2 Letopisů', '2. Paralipomenon', '2pa', '2par', '2 pa', '2 par'],
},
{ id: 'ezr', name: 'Ezdráš', aliases: ['ezd'] },
{ id: 'neh', name: 'Nehemiáš', aliases: [] },
{ id: 'est', name: 'Ester', aliases: [] },
{ id: 'job', name: 'Jób', aliases: ['Job'] },
{ id: 'psa', name: 'Žalmy', aliases: ['ž', 'žal', 'žalm'] },
{ id: 'pro', name: 'Príslovia', aliases: ['Přísloví', 'př', 'přís'] },
{ id: 'ecc', name: 'Kazatel', aliases: ['kaz'] },
{ id: 'sng', name: 'Pieseò', aliases: ['Píseň', 'pís', 'písn'] },
{ id: 'isa', name: 'Izaiáš', aliases: ['iz'] },
{ id: 'jer', name: 'Jeremiáš', aliases: [] },
{ id: 'lam', name: 'Plaè', aliases: ['Pláč', 'pl'] },
{ id: 'ezk', name: 'Ezechiel', aliases: ['ez'] },
{ id: 'dan', name: 'Daniel', aliases: [] },
{ id: 'hos', name: 'Hozeáš', aliases: ['Ozeáš', 'oz'] },
{ id: 'jol', name: 'Joel', aliases: [] },
{ id: 'amo', name: 'Ámos', aliases: ['Amos'] },
{ id: 'oba', name: 'Obadiáš', aliases: ['Abdiáš', 'abd'] },
{ id: 'jon', name: 'Jonáš', aliases: [] },
{ id: 'mic', name: 'Micheáš', aliases: [] },
{ id: 'nam', name: 'Náhum', aliases: ['Nahum'] },
{ id: 'hab', name: 'Habakuk', aliases: ['Abakuk', 'ab', 'abk'] },
{ id: 'zep', name: 'Sofoniáš', aliases: ['sof'] },
{ id: 'hag', name: 'Haggeus', aliases: ['Ageus', 'ag'] },
{ id: 'zec', name: 'Zachariáš', aliases: ['zach'] },
{ id: 'mal', name: 'Malachiáš', aliases: [] },
{ id: 'mat', name: 'Matouš', aliases: [] },
{ id: 'mrk', name: 'Marek', aliases: [] },
{ id: 'luk', name: 'Lukáš', aliases: [] },
{ id: 'jhn', name: 'Jan', aliases: [] },
{ id: 'act', name: 'Skutky Apoštolů', aliases: ['Skutky', 'sk'] },
{ id: 'rom', name: 'Římanům', aliases: ['řím'] },
{ id: '1co', name: '1 Korintským', aliases: ['1k', '1kor', '1 k', '1 kor'] },
{ id: '2co', name: '2 Korintským', aliases: ['2k', '2kor', '2 k', '2 kor'] },
{ id: 'gal', name: 'Galatským', aliases: [] },
{ id: 'eph', name: 'Efezským', aliases: ['Efeským', 'ef'] },
{ id: 'php', name: 'Filipským', aliases: ['fp'] },
{ id: 'col', name: 'Koloským', aliases: ['ko', 'kol'] },
{
id: '1th',
name: '1 Tesalonickým',
aliases: ['1te', '1tes', '1 te', '1 tes'],
},
{
id: '2th',
name: '2 Tesalonickým',
aliases: ['2te', '2tes', '2 te', '2 tes'],
},
{ id: '1ti', name: '1 Timoteovi', aliases: ['1 Timoteus', '1tm', '1 tm'] },
{ id: '2ti', name: '2 Timoteovi', aliases: ['2 Timoteus', '2tm', '2 tm'] },
{ id: 'tit', name: 'Titovi', aliases: ['Titus'] },
{ id: 'phm', name: 'Filemonovi', aliases: ['Filemon', 'fm', 'flm'] },
{ id: 'heb', name: 'Židům', aliases: ['žd'] },
{ id: 'jas', name: 'Jakubův', aliases: ['Jakub', 'jk'] },
{ id: '1pe', name: '1 Petrův', aliases: ['1 Petr'] },
{ id: '2pe', name: '2 Petrův', aliases: ['2 Petr'] },
{ id: '1jn', name: '1 Janův', aliases: ['1 Jan'] },
{ id: '2jn', name: '2 Janův', aliases: ['2 Jan'] },
{ id: '3jn', name: '3 Janův', aliases: ['3 Jan'] },
{ id: 'jud', name: 'Judův', aliases: ['Juda', 'ju'] },
{ id: 'rev', name: 'Zjevení Janovo', aliases: ['Zjevení', 'zj'] },
];

View File

@@ -0,0 +1,7 @@
import { CommonLabels } from '../models';
export const COMMON_LABELS: CommonLabels = {
folderDoesNotExist: 'Složka v cestě neexistuje:',
settingsNotConfigured:
'Nastavení lokálních biblických odkazů není nakonfigurováno. Před pokusem o odkazování na pasáže prosím nastavte cestu k biblickým textům.',
};

9
src/i18n/cs/index.ts Normal file
View File

@@ -0,0 +1,9 @@
import { BOOKS } from './books';
import { COMMON_LABELS } from './common-labels';
import { SETTINGS_LABELS } from './settings-labels';
export const CS = {
BOOKS,
COMMON: COMMON_LABELS,
SETTINGS: SETTINGS_LABELS,
};

View File

@@ -0,0 +1,97 @@
import { PassageFormat } from 'src/passage-reference';
import { SettingsLabels } from '../models';
import { QuoteReferencePosition } from 'src/settings';
export const SETTINGS_LABELS: SettingsLabels = {
required: {
name: 'Požadovaný',
controls: {
biblesPath: {
name: 'Biblická cesta',
description: 'Cesta ke složce obsahující vaše bible.',
placeholder: 'např. Data/Bible',
},
},
},
optional: {
name: 'Volitelný',
controls: {
defaultVersion: {
name: 'Výchozí verze',
description:
'Verze, která se má používat ve výchozím nastavení zkrácená verze. Měla by odpovídat složce ve výše vybrané složce bible.',
placeholder: 'např. CSP',
},
defaultPassageFormat: {
name: 'Výchozí formát pasáže',
description:
'Formát markdownu, který se má ve výchozím nastavení použít pro pasáže.',
options: {
[PassageFormat.Manuscript]: 'Rukopis',
[PassageFormat.Paragraph]: 'Odstavec',
[PassageFormat.Quote]: 'Citovat',
[PassageFormat.Callout]: 'Popisek',
},
},
bibleFormat: {
name: 'Biblický formát',
description:
'Styl formátování, který používáte pro své bible v úložišti. Local Bible Ref se na něj spoléhá pro správnou analýzu pasáží.',
},
fullPreview: {
name: 'Náhled celé pasáže',
description:
'Zda se v náhledu má zobrazit celá pasáž, a ne jen její úryvek.',
},
},
},
quoteFormat: {
name: 'Formát citace',
controls: {
includeReference: {
name: 'Zahrnout odkaz',
description: 'Zda zahrnout odkaz na danou pasáž.',
},
referencePosition: {
name: 'Referenční pozice',
description: 'Pozice odkazu vzhledem k citovanému textu.',
options: {
[QuoteReferencePosition.Beginning]: 'Začátek',
[QuoteReferencePosition.End]: 'Konec',
},
},
linkToPassage: {
name: 'Odkaz na pasáž',
description: 'Zda odkazovat na pasáž ve vaší Bibli v trezoru.',
},
},
},
calloutFormat: {
name: 'Formát popisku',
controls: {
calloutType: {
name: 'Typ volání',
description: 'Typ popisu, který se má pro daný text použít.',
},
linkToPassage: {
name: 'Odkaz na pasáž',
description: 'Zda odkazovat na pasáž ve vaší Bibli v trezoru.',
},
collapsible: {
name: 'Skládací',
description:
'Zda je popis, který se má pro daný text použít, sbalitelný.',
},
},
},
issues: {
before:
'Pokud narazíte na nějaké problémy s Local Bible Ref nebo máte návrhy na vylepšení, ',
link: 'otevřete prosím problém na GitHubu',
after: '.',
},
};

View File

@@ -4,7 +4,7 @@ import { QuoteReferencePosition } from 'src/settings';
export const SETTINGS_LABELS: SettingsLabels = { export const SETTINGS_LABELS: SettingsLabels = {
required: { required: {
name: 'Erforderliche Einstellungen', name: 'Erforderlich',
controls: { controls: {
biblesPath: { biblesPath: {
name: 'Bibeldateien', name: 'Bibeldateien',
@@ -15,7 +15,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
optional: { optional: {
name: 'Optionale Einstellungen', name: 'Optional',
controls: { controls: {
defaultVersion: { defaultVersion: {
name: 'Standardversion', name: 'Standardversion',
@@ -39,12 +39,16 @@ export const SETTINGS_LABELS: SettingsLabels = {
description: description:
'Der Formatierungsstil, den Sie für Ihre Vault-Bibeln verwenden. Local Bible Ref benötigt diesen, um Textpassagen korrekt zu analysieren.', '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.',
},
}, },
}, },
quoteFormat: { quoteFormat: {
name: 'Einstellungen für das Angebotsformat', name: 'Angebotsformat',
description: 'Einstellungen für das Zitatpassageformat.',
controls: { controls: {
includeReference: { includeReference: {
name: 'Referenz angeben', name: 'Referenz angeben',
@@ -68,8 +72,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
calloutFormat: { calloutFormat: {
name: 'Einstellungen für das Callout-Format', name: 'Callout-Format',
description: 'Einstellungen für das Format des Callout-Passages.',
controls: { controls: {
calloutType: { calloutType: {
name: 'Callout-Typ', name: 'Callout-Typ',
@@ -81,6 +84,11 @@ export const SETTINGS_LABELS: SettingsLabels = {
description: description:
'Ob Sie den Verweis auf die Passage in Ihrer Tresorbibel verlinken möchten.', 'Ob Sie den Verweis auf die Passage in Ihrer Tresorbibel verlinken möchten.',
}, },
collapsible: {
name: 'Zusammenklappbar',
description:
'Ob der für die Passage zu verwendende Hinweis einklappbar ist.',
},
}, },
}, },

View File

@@ -4,7 +4,7 @@ import { QuoteReferencePosition } from 'src/settings';
export const SETTINGS_LABELS: SettingsLabels = { export const SETTINGS_LABELS: SettingsLabels = {
required: { required: {
name: 'Required Settings', name: 'Required',
controls: { controls: {
biblesPath: { biblesPath: {
name: 'Bibles path', name: 'Bibles path',
@@ -15,7 +15,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
optional: { optional: {
name: 'Optional Settings', name: 'Optional',
controls: { controls: {
defaultVersion: { defaultVersion: {
name: 'Default version', name: 'Default version',
@@ -38,12 +38,16 @@ export const SETTINGS_LABELS: SettingsLabels = {
description: description:
'The formatting style you use for your vault bibles. Local Bible Ref relies on this to parse passages correctly.', '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.',
},
}, },
}, },
quoteFormat: { quoteFormat: {
name: 'Quote Format Settings', name: 'Quote format',
description: 'Settings for the quote passage format.',
controls: { controls: {
includeReference: { includeReference: {
name: 'Include reference', name: 'Include reference',
@@ -67,8 +71,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
calloutFormat: { calloutFormat: {
name: 'Callout Format Settings', name: 'Callout format',
description: 'Settings for the callout passage format.',
controls: { controls: {
calloutType: { calloutType: {
name: 'Callout type', name: 'Callout type',
@@ -79,6 +82,11 @@ export const SETTINGS_LABELS: SettingsLabels = {
description: description:
'Whether to link the reference to the passage in your vault Bible.', 'Whether to link the reference to the passage in your vault Bible.',
}, },
collapsible: {
name: 'Collapsible',
description:
'Whether the callout to use for the passage is collapsible.',
},
}, },
}, },

View File

@@ -1,8 +1,10 @@
import { CS } from './cs';
import { DE } from './de'; import { DE } from './de';
import { EN } from './en'; import { EN } from './en';
import { KO } from './ko'; import { KO } from './ko';
export const I18N = { export const I18N = {
CS,
DE, DE,
EN, EN,
KO, KO,

View File

@@ -4,7 +4,7 @@ import { QuoteReferencePosition } from 'src/settings';
export const SETTINGS_LABELS: SettingsLabels = { export const SETTINGS_LABELS: SettingsLabels = {
required: { required: {
name: '필수 설정', name: '필수',
controls: { controls: {
biblesPath: { biblesPath: {
name: '성경의 길', name: '성경의 길',
@@ -15,7 +15,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
optional: { optional: {
name: '선택적 설정', name: '선택 과목',
controls: { controls: {
defaultVersion: { defaultVersion: {
name: '기본 버전', name: '기본 버전',
@@ -38,12 +38,15 @@ export const SETTINGS_LABELS: SettingsLabels = {
description: description:
'보관된 성경에 사용하는 서식 스타일입니다. Local Bible Ref는 이 스타일을 기반으로 구절을 정확하게 분석합니다.', '보관된 성경에 사용하는 서식 스타일입니다. Local Bible Ref는 이 스타일을 기반으로 구절을 정확하게 분석합니다.',
}, },
fullPreview: {
name: '전체 구절 미리보기',
description: '미리보기에서 전체 내용을 표시할지, 아니면 일부만 표시할지 여부.',
},
}, },
}, },
quoteFormat: { quoteFormat: {
name: '견적 형식 설정', name: '견적 형식',
description: '인용구 형식 설정입니다.',
controls: { controls: {
includeReference: { includeReference: {
name: '참조 포함', name: '참조 포함',
@@ -65,8 +68,7 @@ export const SETTINGS_LABELS: SettingsLabels = {
}, },
calloutFormat: { calloutFormat: {
name: '콜아웃 형식 설정', name: '콜아웃 형식',
description: '설명문 형식 설정입니다.',
controls: { controls: {
calloutType: { calloutType: {
name: '콜아웃 유형', name: '콜아웃 유형',
@@ -76,6 +78,11 @@ export const SETTINGS_LABELS: SettingsLabels = {
name: '통로 바로가기', name: '통로 바로가기',
description: '보관된 성경의 해당 구절에 참조를 연결할지 여부.', description: '보관된 성경의 해당 구절에 참조를 연결할지 여부.',
}, },
collapsible: {
name: '접을 수 있는',
description:
'해당 구절에 사용할 콜아웃이 접을 수 있는지 여부.',
},
}, },
}, },

View File

@@ -33,12 +33,12 @@ export interface SettingsLabels {
}; };
}; };
bibleFormat: Control; bibleFormat: Control;
fullPreview: Control;
}; };
}; };
quoteFormat: { quoteFormat: {
name: string; name: string;
description: string;
controls: { controls: {
includeReference: Control; includeReference: Control;
referencePosition: Control & { referencePosition: Control & {
@@ -53,10 +53,10 @@ export interface SettingsLabels {
calloutFormat: { calloutFormat: {
name: string; name: string;
description: string;
controls: { controls: {
calloutType: Control; calloutType: Control;
linkToPassage: Control; linkToPassage: Control;
collapsible: Control;
}; };
}; };

View File

@@ -6,6 +6,7 @@ import {
Notice, Notice,
PluginSettingTab, PluginSettingTab,
Setting, Setting,
SettingGroup,
TextComponent, TextComponent,
} from 'obsidian'; } from 'obsidian';
import { PassageFormat } from './passage-reference'; import { PassageFormat } from './passage-reference';
@@ -16,7 +17,7 @@ import { SettingsLabels } from './i18n/models';
import { I18N } from './i18n'; import { I18N } from './i18n';
export default class LocalBibleRefSettingTab extends PluginSettingTab { export default class LocalBibleRefSettingTab extends PluginSettingTab {
private readonly hiddenClass = 'local-bible-ref-hidden'; private readonly settingClass = 'local-bible-ref-setting';
private plugin: LocalBibleRefPlugin; private plugin: LocalBibleRefPlugin;
private folderDoesNotExistText = ''; private folderDoesNotExistText = '';
@@ -27,6 +28,10 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
this.plugin = plugin; this.plugin = plugin;
switch (getLanguage()) { switch (getLanguage()) {
case 'cs':
this.folderDoesNotExistText = I18N.CS.COMMON.folderDoesNotExist;
this.settingsLabels = I18N.CS.SETTINGS;
break;
case 'de': case 'de':
this.folderDoesNotExistText = I18N.DE.COMMON.folderDoesNotExist; this.folderDoesNotExistText = I18N.DE.COMMON.folderDoesNotExist;
this.settingsLabels = I18N.DE.SETTINGS; this.settingsLabels = I18N.DE.SETTINGS;
@@ -49,210 +54,265 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
this.settingsLabels; this.settingsLabels;
containerEl.empty(); containerEl.empty();
new Setting(containerEl).setName(required.name).setHeading(); // required settings ---
let biblesPathTimeout: number; let biblesPathTimeout: number;
new Setting(containerEl) new SettingGroup(containerEl)
.setName(required.controls.biblesPath.name) .setHeading(required.name)
.setDesc(required.controls.biblesPath.description) .addSetting((setting) =>
.addText((text) => { setting
text .setName(required.controls.biblesPath.name)
.setPlaceholder(required.controls.biblesPath.placeholder) .setDesc(required.controls.biblesPath.description)
.setValue(this.plugin.settings.biblesPath) .setClass(this.settingClass)
.onChange(async (value) => { .addText((text) => {
// toggle visibility of default version setting text
if (value) { .setPlaceholder(required.controls.biblesPath.placeholder)
defaultVersionSetting.settingEl.removeClass(this.hiddenClass); .setValue(this.plugin.settings.biblesPath)
} else { .onChange(async (value) => {
defaultVersionSetting.settingEl.addClass(this.hiddenClass); // toggle editability of default version setting
( if (value) {
defaultVersionSetting.components[0] as TextComponent defaultVersionSetting.setDisabled(false);
).inputEl.value = ''; } else {
this.plugin.settings.defaultVersionShorthand = ''; defaultVersionSetting.setDisabled(true);
} const textComponent = defaultVersionSetting
.components[0] as TextComponent;
textComponent.inputEl.value = '';
this.plugin.settings.defaultVersionShorthand = '';
}
const path = value ? normalizePath(value) : ''; const path = value ? normalizePath(value) : '';
this.plugin.settings.biblesPath = path; this.plugin.settings.biblesPath = path;
await this.plugin.saveSettings(); await this.plugin.saveSettings();
clearTimeout(biblesPathTimeout); clearTimeout(biblesPathTimeout);
biblesPathTimeout = window.setTimeout(async () => { biblesPathTimeout = window.setTimeout(async () => {
if (!path) return; if (!path) return;
const exists = this.app.vault.getFolderByPath(path); const exists = this.app.vault.getFolderByPath(path);
if (!exists) if (!exists)
new Notice(`${this.folderDoesNotExistText} ${path}.`); new Notice(`${this.folderDoesNotExistText} ${path}.`);
}, 1000); }, 1000);
}); });
new PathSuggest(this.app, text.inputEl); new PathSuggest(this.app, text.inputEl);
}); })
);
new Setting(containerEl).setName(optional.name).setHeading();
// optional settings ---
let defaultVersionTimeout: number; let defaultVersionTimeout: number;
const defaultVersionSetting = new Setting(containerEl) let defaultVersionSetting = {} as Setting;
.setName(optional.controls.defaultVersion.name) new SettingGroup(containerEl)
.setDesc(optional.controls.defaultVersion.description) .setHeading(optional.name)
.addText((text) => { .addSetting((setting) => {
text setting
.setPlaceholder(optional.controls.defaultVersion.placeholder) .setName(optional.controls.defaultVersion.name)
.setValue(this.plugin.settings.defaultVersionShorthand) .setDesc(optional.controls.defaultVersion.description)
.onChange(async (value) => { .setClass(this.settingClass)
this.plugin.settings.defaultVersionShorthand = value; .addText((text) => {
await this.plugin.saveSettings(); text
.setPlaceholder(optional.controls.defaultVersion.placeholder)
.setValue(this.plugin.settings.defaultVersionShorthand)
.onChange(async (value) => {
this.plugin.settings.defaultVersionShorthand = value;
await this.plugin.saveSettings();
clearTimeout(defaultVersionTimeout); clearTimeout(defaultVersionTimeout);
defaultVersionTimeout = window.setTimeout(async () => { defaultVersionTimeout = window.setTimeout(async () => {
const path = `${this.plugin.settings.biblesPath}/${value}`; const path = `${this.plugin.settings.biblesPath}/${value}`;
const exists = this.app.vault.getFolderByPath( const exists = this.app.vault.getFolderByPath(
normalizePath(path) normalizePath(path)
); );
if (!exists) if (!exists)
new Notice(`${this.folderDoesNotExistText} ${path}.`); new Notice(`${this.folderDoesNotExistText} ${path}.`);
}, 1000); }, 1000);
});
new VersionSuggest(this.app, text.inputEl, this.plugin.settings);
}); });
new VersionSuggest(this.app, text.inputEl, this.plugin.settings); if (this.plugin.settings.biblesPath) setting.setDisabled(false);
else setting.setDisabled(true);
defaultVersionSetting = setting;
})
.addSetting((setting) =>
setting
.setName(optional.controls.defaultPassageFormat.name)
.setDesc(optional.controls.defaultPassageFormat.description)
.setClass(this.settingClass)
.addDropdown((dropdown) =>
dropdown
.addOptions(optional.controls.defaultPassageFormat.options)
.setValue(this.plugin.settings.defaultPassageFormat)
.onChange(async (value) => {
this.plugin.settings.defaultPassageFormat =
value as PassageFormat;
await this.plugin.saveSettings();
})
)
)
.addSetting((setting) =>
setting
.setName(optional.controls.bibleFormat.name)
.setDesc(optional.controls.bibleFormat.description)
.setClass(this.settingClass)
.addDropdown((dropdown) =>
dropdown
.addOptions({
[BibleFormat.LocalBibleRef]: 'Local Bible Ref',
[BibleFormat.BibleLinker]: 'Bible Linker',
})
.setValue(this.plugin.settings.bibleFormat)
.onChange(async (value) => {
this.plugin.settings.bibleFormat = value as BibleFormat;
await this.plugin.saveSettings();
})
)
)
.addSetting((setting) =>
setting
.setName(optional.controls.fullPreview.name)
.setDesc(optional.controls.fullPreview.description)
.setClass(this.settingClass)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.fullPreview)
.onChange(async (value) => {
this.plugin.settings.fullPreview = value;
await this.plugin.saveSettings();
})
)
);
// quote format settings ---
let quoteRefPositionSetting = {} as Setting;
let quoteRefLinkSetting = {} as Setting;
new SettingGroup(containerEl)
.setHeading(quoteFormat.name)
.addSetting((setting) =>
setting
.setName(quoteFormat.controls.includeReference.name)
.setDesc(quoteFormat.controls.includeReference.description)
.setClass(this.settingClass)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.quote.includeReference)
.onChange(async (value) => {
// toggle editability of other paragraph reference settings
if (value) {
quoteRefPositionSetting.setDisabled(false);
quoteRefLinkSetting.setDisabled(false);
} else {
quoteRefPositionSetting.setDisabled(true);
quoteRefLinkSetting.setDisabled(true);
}
this.plugin.settings.quote.includeReference = value;
await this.plugin.saveSettings();
})
)
)
.addSetting((setting) => {
setting
.setName(quoteFormat.controls.referencePosition.name)
.setDesc(quoteFormat.controls.referencePosition.description)
.setClass(this.settingClass)
.addDropdown((dropdown) =>
dropdown
.addOptions(quoteFormat.controls.referencePosition.options)
.setValue(this.plugin.settings.quote.referencePosition)
.onChange(async (value) => {
this.plugin.settings.quote.referencePosition =
value as QuoteReferencePosition;
await this.plugin.saveSettings();
})
);
const includeRef = this.plugin.settings.quote.includeReference;
if (includeRef) setting.setDisabled(false);
else setting.setDisabled(true);
quoteRefPositionSetting = setting;
})
.addSetting((setting) => {
setting
.setName(quoteFormat.controls.linkToPassage.name)
.setDesc(quoteFormat.controls.linkToPassage.description)
.setClass(this.settingClass)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.quote.linkToPassage)
.onChange(async (value) => {
this.plugin.settings.quote.linkToPassage = value;
await this.plugin.saveSettings();
})
);
const includeRef = this.plugin.settings.quote.includeReference;
if (includeRef) setting.setDisabled(false);
else setting.setDisabled(true);
quoteRefLinkSetting = setting;
}); });
if (this.plugin.settings.biblesPath) { // callout format settings ---
defaultVersionSetting.settingEl.removeClass(this.hiddenClass); new SettingGroup(containerEl)
} else { .setHeading(calloutFormat.name)
defaultVersionSetting.settingEl.addClass(this.hiddenClass); .addSetting((setting) =>
} setting
.setName(calloutFormat.controls.calloutType.name)
new Setting(containerEl) .setDesc(calloutFormat.controls.calloutType.description)
.setName(optional.controls.defaultPassageFormat.name) .setClass(this.settingClass)
.setDesc(optional.controls.defaultPassageFormat.description) .addDropdown((dropdown) =>
.addDropdown((dropdown) => dropdown
dropdown .addOptions({
.addOptions(optional.controls.defaultPassageFormat.options) note: 'Note',
.setValue(this.plugin.settings.defaultPassageFormat) abstract: 'Abstract',
.onChange(async (value) => { info: 'Info',
this.plugin.settings.defaultPassageFormat = value as PassageFormat; todo: 'Todo',
await this.plugin.saveSettings(); tip: 'Tip',
}) success: 'Success',
question: 'Question',
warning: 'Warning',
failure: 'Failure',
danger: 'Danger',
bug: 'Bug',
example: 'Example',
quote: 'Quote',
})
.setValue(this.plugin.settings.callout.type)
.onChange(async (value) => {
this.plugin.settings.callout.type = value as CalloutType;
await this.plugin.saveSettings();
})
)
)
.addSetting((setting) =>
setting
.setName(calloutFormat.controls.linkToPassage.name)
.setDesc(calloutFormat.controls.linkToPassage.description)
.setClass(this.settingClass)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.callout.linkToPassage)
.onChange(async (value) => {
this.plugin.settings.callout.linkToPassage = value;
await this.plugin.saveSettings();
})
)
)
.addSetting((setting) =>
setting
.setName(calloutFormat.controls.collapsible.name)
.setDesc(calloutFormat.controls.collapsible.description)
.setClass(this.settingClass)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.callout.collapsible)
.onChange(async (value) => {
this.plugin.settings.callout.collapsible = value;
await this.plugin.saveSettings();
})
)
); );
new Setting(containerEl) // just acts as a spacer for the issues link
.setName(optional.controls.bibleFormat.name) new Setting(containerEl).setHeading();
.setDesc(optional.controls.bibleFormat.description)
.addDropdown((dropdown) =>
dropdown
.addOptions({
[BibleFormat.LocalBibleRef]: 'Local Bible Ref',
[BibleFormat.BibleLinker]: 'Bible Linker',
})
.setValue(this.plugin.settings.bibleFormat)
.onChange(async (value) => {
this.plugin.settings.bibleFormat = value as BibleFormat;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName(quoteFormat.name)
.setDesc(quoteFormat.description)
.setHeading();
new Setting(containerEl)
.setName(quoteFormat.controls.includeReference.name)
.setDesc(quoteFormat.controls.includeReference.description)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.quote.includeReference)
.onChange(async (value) => {
// toggle visibility of other paragraph reference settings
if (value) {
quoteRefPositionSetting.settingEl.removeClass(this.hiddenClass);
quoteRefLinkSetting.settingEl.removeClass(this.hiddenClass);
} else {
quoteRefPositionSetting.settingEl.addClass(this.hiddenClass);
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
}
this.plugin.settings.quote.includeReference = value;
await this.plugin.saveSettings();
})
);
const quoteRefPositionSetting = new Setting(containerEl)
.setName(quoteFormat.controls.referencePosition.name)
.setDesc(quoteFormat.controls.referencePosition.description)
.addDropdown((dropdown) =>
dropdown
.addOptions(quoteFormat.controls.referencePosition.options)
.setValue(this.plugin.settings.quote.referencePosition)
.onChange(async (value) => {
this.plugin.settings.quote.referencePosition =
value as QuoteReferencePosition;
await this.plugin.saveSettings();
})
);
const quoteRefLinkSetting = new Setting(containerEl)
.setName(quoteFormat.controls.linkToPassage.name)
.setDesc(quoteFormat.controls.linkToPassage.description)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.quote.linkToPassage)
.onChange(async (value) => {
this.plugin.settings.quote.linkToPassage = value;
await this.plugin.saveSettings();
})
);
if (this.plugin.settings.quote.includeReference) {
quoteRefPositionSetting.settingEl.removeClass(this.hiddenClass);
quoteRefLinkSetting.settingEl.removeClass(this.hiddenClass);
} else {
quoteRefPositionSetting.settingEl.addClass(this.hiddenClass);
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
}
new Setting(containerEl)
.setName(calloutFormat.name)
.setDesc(calloutFormat.description)
.setHeading();
new Setting(containerEl)
.setName(calloutFormat.controls.calloutType.name)
.setDesc(calloutFormat.controls.calloutType.description)
.addDropdown((dropdown) =>
dropdown
.addOptions({
note: 'Note',
abstract: 'Abstract',
info: 'Info',
todo: 'Todo',
tip: 'Tip',
success: 'Success',
question: 'Question',
warning: 'Warning',
failure: 'Failure',
danger: 'Danger',
bug: 'Bug',
example: 'Example',
quote: 'Quote',
})
.setValue(this.plugin.settings.callout.type)
.onChange(async (value) => {
this.plugin.settings.callout.type = value as CalloutType;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName(calloutFormat.controls.linkToPassage.name)
.setDesc(calloutFormat.controls.linkToPassage.description)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.callout.linkToPassage)
.onChange(async (value) => {
this.plugin.settings.callout.linkToPassage = value;
await this.plugin.saveSettings();
})
);
const issuesLink = document.createElement('a'); const issuesLink = document.createElement('a');
issuesLink.href = 'https://github.com/camelChief/local-bible-ref/issues'; issuesLink.href = 'https://github.com/camelChief/local-bible-ref/issues';

View File

@@ -61,7 +61,7 @@ export default class PassageReference
.map((b) => `${b.name}|${b.aliases.join('|')}`) .map((b) => `${b.name}|${b.aliases.join('|')}`)
.join('|'); .join('|');
regExpString += regExpString +=
') ?(\\d{1,3}(?::\\d{1,3})?(?: ?\\- ?\\d{1,3}(?::\\d{1,3})?)?)((?: ?\\+[a-z]+(?::[a-z]+)?){0,2})$'; ') ?(\\d{1,3}(?::\\d{1,3})?(?: ?\\- ?\\d{1,3}(?::\\d{1,3})?)?)((?: ?\\+\\w+(?::[a-z]+)?){0,2})$';
return new RegExp(regExpString, 'i'); return new RegExp(regExpString, 'i');
} }
@@ -210,6 +210,8 @@ export default class PassageReference
function getBooksByLanguage(): Book[] { function getBooksByLanguage(): Book[] {
switch (getLanguage()) { switch (getLanguage()) {
case 'cs':
return I18N.CS.BOOKS;
case 'de': case 'de':
return I18N.DE.BOOKS; return I18N.DE.BOOKS;
case 'ko': case 'ko':

View File

@@ -27,6 +27,9 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
this.settings = settings; this.settings = settings;
switch (getLanguage()) { switch (getLanguage()) {
case 'cs':
this.settingsNotConfiguredText = I18N.CS.COMMON.settingsNotConfigured;
break;
case 'de': case 'de':
this.settingsNotConfiguredText = I18N.DE.COMMON.settingsNotConfigured; this.settingsNotConfiguredText = I18N.DE.COMMON.settingsNotConfigured;
break; break;
@@ -117,7 +120,8 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
}); });
// suggest // 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); const text = this.formatTexts(texts, passageRef, context);
return [{ excerpt, text }]; return [{ excerpt, text }];
} }
@@ -295,15 +299,23 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
/** Generates an excerpt for the suggestion. */ /** Generates an excerpt for the suggestion. */
private generateExcerpt(text: string): string { private generateExcerpt(text: string): string {
text = text.split(/<\/sup>/, 2)[1]; const fullPreview = this.settings.fullPreview;
text = text.replace(/<sup>\d+<\/sup>/g, ''); if (fullPreview) {
text = text.replace(/^(?:> |- )/gm, ''); 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( text = text.replace(
/<span(?:\s+\w+=['"][^'"]+['"])*>([^<]+)<\/span>/g, /<span(?:\s+\w+=['"][^'"]+['"])*>([^<]+)<\/span>/g,
'$1' '$1'
); );
text = text.replace(/\n/g, ' '); if (!fullPreview) text = text.replace(/\n/g, ' ');
text = text.replace(/ {2,}/g, ' '); text = text.replace(/ {2,}/g, ' ');
if (fullPreview) return text;
return text.slice(0, 45) + '...'; return text.slice(0, 45) + '...';
} }
@@ -352,14 +364,14 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
break; break;
} }
case PassageFormat.Callout: { case PassageFormat.Callout: {
const { type, linkToPassage } = this.settings.callout; const { type, linkToPassage, collapsible } = this.settings.callout;
let stringRef = ''; let stringRef = '';
if (linkToPassage) if (linkToPassage)
stringRef = this.generatePassageLink(passageRef, context); stringRef = this.generatePassageLink(passageRef, context);
else stringRef = passageRef.stringify(); else stringRef = passageRef.stringify();
formatted = `> [!${type}] ${stringRef}\n`; formatted = `> [!${type}]${collapsible ? '+' : ''} ${stringRef}\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';

View File

@@ -6,6 +6,7 @@ export default interface LocalBibleRefSettings {
defaultVersionShorthand: string; defaultVersionShorthand: string;
defaultPassageFormat: PassageFormat; defaultPassageFormat: PassageFormat;
bibleFormat: BibleFormat; bibleFormat: BibleFormat;
fullPreview: boolean;
quote: { quote: {
includeReference: boolean; includeReference: boolean;
referencePosition: QuoteReferencePosition; referencePosition: QuoteReferencePosition;
@@ -14,6 +15,7 @@ export default interface LocalBibleRefSettings {
callout: { callout: {
type: CalloutType; type: CalloutType;
linkToPassage: boolean; linkToPassage: boolean;
collapsible: boolean;
}; };
} }

View File

@@ -1,3 +1,3 @@
div.setting-item.local-bible-ref-hidden { div.setting-item.local-bible-ref-setting.is-disabled {
display: none; opacity: 0.5;
} }