3 - Finalised adding support for German.

This commit is contained in:
Caleb Campbell
2025-12-27 13:38:14 +11:00
parent 2bcf3cb980
commit 59d66a247e
4 changed files with 33 additions and 22 deletions

View File

@@ -17,8 +17,9 @@ import LocalBibleRefSettings, { QuoteReferencePosition } from './settings';
import { I18N } from './i18n';
export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
private settings: LocalBibleRefSettings;
private settingsNotConfiguredText = '';
private readonly settings: LocalBibleRefSettings;
private readonly settingsNotConfiguredText: string;
private noSettingsNotice: Notice;
constructor(app: App, settings: LocalBibleRefSettings) {
@@ -55,8 +56,8 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
return null;
}
// min ref length is 6 ('--gen1')
if (cursor.ch < 6) return null;
// min ref length is 5 ('--ex1')
if (cursor.ch < 5) return null;
// must be a passage ref
const isPassage = PassageReference.regExp.test(line);
@@ -292,10 +293,11 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
/** Generates an excerpt for the suggestion. */
private generateExcerpt(text: string): string {
text = text.split(/<\/sup>/, 2)[1];
text = text.replace(/(?:<sup>\d+<\/sup>|> |- )/g, '');
text = text.replace(/<sup>\d+<\/sup>/g, '');
text = text.replace(/^(?:> |- )/gm, '');
text = text.replace(
/<span style='font-variant: small-caps;'>Lord<\/span>/g,
'Lord'
/<span(?:\s+\w+=['"][^'"]+['"])*>([^<]+)<\/span>/g,
'$1'
);
text = text.replace(/\n/g, ' ');
text = text.replace(/ {2,}/g, ' ');