@learnpack/learnpack 5.0.283 → 5.0.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/serve.js +70 -1
- package/lib/creatorDist/assets/{index-BfLyIQVh.js → index-7zTdUX04.js} +22 -22
- package/lib/creatorDist/index.html +1 -1
- package/lib/managers/session.js +2 -2
- package/lib/utils/export/epub.js +22 -5
- package/package.json +1 -1
- package/src/commands/serve.ts +87 -4
- package/src/creator/src/App.tsx +25 -26
- package/src/creatorDist/assets/{index-BfLyIQVh.js → index-7zTdUX04.js} +22 -22
- package/src/creatorDist/index.html +1 -1
- package/src/managers/session.ts +184 -182
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +404 -404
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/export/epub.ts +29 -5
package/src/ui/app.tar.gz
CHANGED
Binary file
|
package/src/utils/export/epub.ts
CHANGED
@@ -7,15 +7,37 @@ import { spawn } from "child_process";
|
|
7
7
|
import { ExportOptions, CourseMetadata, EpubMetadata } from "./types";
|
8
8
|
import { downloadS3Folder, getCourseMetadata } from "./shared";
|
9
9
|
|
10
|
-
const
|
10
|
+
const getLocalizedText = (language: string) => {
|
11
|
+
const translations = {
|
12
|
+
en: "Write your answer here",
|
13
|
+
es: "Escribe tu respuesta aquí",
|
14
|
+
fr: "Écrivez votre réponse ici",
|
15
|
+
de: "Schreiben Sie Ihre Antwort hier",
|
16
|
+
it: "Scrivi la tua risposta qui",
|
17
|
+
pt: "Escreva sua resposta aqui",
|
18
|
+
ja: "ここに答えを書いてください",
|
19
|
+
ko: "여기에 답을 작성하세요",
|
20
|
+
zh: "在这里写下你的答案",
|
21
|
+
ar: "اكتب إجابتك هنا",
|
22
|
+
ru: "Напишите свой ответ здесь",
|
23
|
+
};
|
24
|
+
|
25
|
+
return translations[language as keyof typeof translations] || translations.en;
|
26
|
+
};
|
27
|
+
|
28
|
+
const replaceQuestionsFromMarkdown = (
|
29
|
+
markdown: string,
|
30
|
+
language: string = "en"
|
31
|
+
) => {
|
11
32
|
// Search for all code blocks like this (No breaking lines sensitive)
|
12
33
|
// ```question some parameters
|
13
34
|
// some text
|
14
35
|
// ```
|
15
36
|
const questionRegex = /```question([\s\S]*?)```/g;
|
37
|
+
const localizedText = getLocalizedText(language);
|
16
38
|
return markdown.replace(
|
17
39
|
questionRegex,
|
18
|
-
|
40
|
+
`<div type="text" class="open-question">${localizedText}</div>`
|
19
41
|
);
|
20
42
|
};
|
21
43
|
|
@@ -234,7 +256,8 @@ async function processExercises(
|
|
234
256
|
console.log("Processing markdown file:", relativeFilePath);
|
235
257
|
const processedContent = processMarkdownContent(
|
236
258
|
fullPath,
|
237
|
-
learnAssetsDir
|
259
|
+
learnAssetsDir,
|
260
|
+
language
|
238
261
|
);
|
239
262
|
|
240
263
|
const processedMarkdownPath = path.join(
|
@@ -288,7 +311,8 @@ async function processExercises(
|
|
288
311
|
// Process markdown content for EPUB conversion
|
289
312
|
function processMarkdownContent(
|
290
313
|
markdownPath: string,
|
291
|
-
learnAssetsDir?: string
|
314
|
+
learnAssetsDir?: string,
|
315
|
+
language: string = "en"
|
292
316
|
): string {
|
293
317
|
let markdownContent = fs.readFileSync(markdownPath, "utf-8");
|
294
318
|
|
@@ -335,7 +359,7 @@ function processMarkdownContent(
|
|
335
359
|
}
|
336
360
|
}
|
337
361
|
|
338
|
-
markdownContent = replaceQuestionsFromMarkdown(markdownContent);
|
362
|
+
markdownContent = replaceQuestionsFromMarkdown(markdownContent, language);
|
339
363
|
markdownContent = replaceMermaidFromMarkdown(markdownContent);
|
340
364
|
markdownContent = cleanQuizOptions(markdownContent);
|
341
365
|
|