moving name out of file, will mirror file system name

This commit is contained in:
2024-12-17 14:09:41 -07:00
parent 068c2b6983
commit c557bbcc28
17 changed files with 127 additions and 96 deletions

View File

@@ -34,8 +34,9 @@ const getAssignment = async (
assignmentName + ".md"
);
const rawFile = (await fs.readFile(filePath, "utf-8")).replace(/\r\n/g, "\n");
return localAssignmentMarkdown.parseMarkdown(rawFile);
return localAssignmentMarkdown.parseMarkdown(rawFile, assignmentName);
};
export const assignmentsFileStorageService = {
getAssignmentNames,
getAssignment,
@@ -72,7 +73,6 @@ export const assignmentsFileStorageService = {
assignmentMarkdownSerializer.toMarkdown(assignment);
console.log(`Saving assignment ${filePath}`);
await fs.writeFile(filePath, assignmentMarkdown);
},
async delete({

View File

@@ -56,11 +56,12 @@ const getItem = async <T extends CourseItemType>(
const rawFile = (await fs.readFile(filePath, "utf-8")).replace(/\r\n/g, "\n");
if (type === "Assignment") {
return localAssignmentMarkdown.parseMarkdown(
rawFile
rawFile,
name
) as CourseItemReturnType<T>;
} else if (type === "Quiz") {
return localQuizMarkdownUtils.parseMarkdown(
rawFile
rawFile, name
) as CourseItemReturnType<T>;
} else if (type === "Page") {
return localPageMarkdownUtils.parseMarkdown(