fix: correctly remove yaml and undo accidental class removal

This commit is contained in:
AntoKeinanen 2025-03-27 20:22:01 +02:00
parent 8c5ba9d9e7
commit 18613da93e
No known key found for this signature in database
2 changed files with 28 additions and 4 deletions

View file

@ -150,10 +150,12 @@ export default class AdvancedMerge extends Plugin {
);
}
if (this.settings.removeYamlProperties) {
sectionContents = sectionContents.replace(
/^---\n(\w*:\s.*\n)*---/,
/---\n(\w*:\s.*\n)*---/,
"",
);
}
vault.append(outputFile, sectionContents);
}

View file

@ -161,3 +161,25 @@ export const TRANSLATIONS: Record<string, Translation> = {
"Видаляє властивості YAML із верхньої частини файлу під час об'єднання. УВАГА: Це може випадково видалити не-YAML частини.",
},
};
export class AdvancedMergeTranslation {
private language: string;
/**
* Represents a plugin translation.
* @constructor
*/
constructor() {
this.language = !Object.keys(TRANSLATIONS).contains(navigator.language)
? DEFAULT_LANGUAGE
: navigator.language;
}
/**
* Gets translation object for current language.
* @returns {Translation} Current translation object.
*/
public get(): Translation {
return TRANSLATIONS[this.language];
}
}