forked from st3v3nmw/obsidian-spaced-repetition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoteFileLoader.ts
34 lines (28 loc) · 1.02 KB
/
NoteFileLoader.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { ISRFile } from "./SRFile";
import { Note } from "./Note";
import { Question } from "./Question";
import { TopicPath } from "./TopicPath";
import { NoteQuestionParser } from "./NoteQuestionParser";
import { SRSettings } from "./settings";
export class NoteFileLoader {
fileText: string;
fixesMade: boolean;
noteTopicPath: TopicPath;
noteFile: ISRFile;
settings: SRSettings;
constructor(settings: SRSettings) {
this.settings = settings;
}
async load(noteFile: ISRFile, folderTopicPath: TopicPath): Promise<Note | null> {
this.noteFile = noteFile;
const questionParser: NoteQuestionParser = new NoteQuestionParser(this.settings);
const onlyKeepQuestionsWithTopicPath: boolean = true;
const questionList: Question[] = await questionParser.createQuestionList(
noteFile,
folderTopicPath,
onlyKeepQuestionsWithTopicPath,
);
const result: Note = new Note(noteFile, questionList);
return result;
}
}