@liascript/exporter 2.1.1--0.10.0 → 2.2.0--0.10.0
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/README.md +20 -0
- package/dist/index.js +26 -11
- package/package.json +1 -1
- package/src/export/helper.ts +10 -3
- package/src/export/ims.ts +1 -1
- package/src/export/scorm12.ts +1 -1
- package/src/export/scorm2004.ts +1 -1
- package/src/export/web.ts +37 -6
- package/src/index.ts +8 -0
- package/.vscode/settings.json +0 -5
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -89,6 +89,8 @@ IMS settings:
|
|
|
89
89
|
|
|
90
90
|
WEB settings:
|
|
91
91
|
|
|
92
|
+
--web-iframe Use an iframed version to hide the course URL.
|
|
93
|
+
--web-indexeddb This will allow to store data within the browser using indexeddb, you can optionally pass a unique key (by default one is generated randomly).
|
|
92
94
|
--web-zip By default the result is not zipped, you can change this with this parameter.
|
|
93
95
|
|
|
94
96
|
PDF settings:
|
|
@@ -312,6 +314,24 @@ responsivevoice-key via `--key`.
|
|
|
312
314
|
__`--web-zip`:__ Use this parameter to directly bundle all input into a zip
|
|
313
315
|
file instead of a folder.
|
|
314
316
|
|
|
317
|
+
__`--web-iframe`:__ This will put the course into an secondary iframe, which will
|
|
318
|
+
hide the course-URL (the Markdown-file). Unfortunately, it will not be possible
|
|
319
|
+
anymore to link from outside to a specific slide.
|
|
320
|
+
|
|
321
|
+
__`web-indexeddb`:__ Generate a LiaScript package that will store states persistently.
|
|
322
|
+
By default, the database is generated uniquely for the packed course. That means,
|
|
323
|
+
every update will use a new database, which makes sense, if and only if, typos get
|
|
324
|
+
corrected or content is added to the end of the document. Mixing content and moving
|
|
325
|
+
quizzes and surveys to different slides might cause some problems in restoring the
|
|
326
|
+
state. But you can use this parameter with a key:
|
|
327
|
+
|
|
328
|
+
```shell
|
|
329
|
+
liaex --format web -i project/README.md -o outputFolder --web-indexeddb someKeyToUse
|
|
330
|
+
updating title ...
|
|
331
|
+
updating description ...
|
|
332
|
+
updating logo ...
|
|
333
|
+
```
|
|
334
|
+
|
|
315
335
|
### PDF
|
|
316
336
|
|
|
317
337
|
For printing out courses to PDF this package uses
|
package/dist/index.js
CHANGED
|
@@ -12245,8 +12245,8 @@ function $320134ce32dd9048$export$a976684a0efeb93f(element, into) {
|
|
|
12245
12245
|
function $320134ce32dd9048$export$bab98af026af71ac(uri) {
|
|
12246
12246
|
return uri.startsWith('http://') || uri.startsWith('https://') || uri.startsWith('file://');
|
|
12247
12247
|
}
|
|
12248
|
-
async function $320134ce32dd9048$export$8cde213409fd6377(tmpPath, readme) {
|
|
12249
|
-
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath,
|
|
12248
|
+
async function $320134ce32dd9048$export$8cde213409fd6377(tmpPath, filename, readme, index) {
|
|
12249
|
+
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, filename), `<!DOCTYPE html>
|
|
12250
12250
|
<html style="height:100%; overflow: hidden">
|
|
12251
12251
|
<head>
|
|
12252
12252
|
|
|
@@ -12260,7 +12260,7 @@ async function $320134ce32dd9048$export$8cde213409fd6377(tmpPath, readme) {
|
|
|
12260
12260
|
let iframe = document.getElementById("lia-container")
|
|
12261
12261
|
|
|
12262
12262
|
if (iframe) {
|
|
12263
|
-
const src = path + "index.html?" + path + "${readme.replace('./', '')}"
|
|
12263
|
+
const src = path + "${index || 'index.html'}?" + path + "${readme.replace('./', '')}"
|
|
12264
12264
|
iframe.src = src
|
|
12265
12265
|
}
|
|
12266
12266
|
</script>
|
|
@@ -12320,7 +12320,17 @@ async function $1e521125b288b3fc$export$372e2d09604f52f0(argument, json) {
|
|
|
12320
12320
|
let tmp = await $320134ce32dd9048$export$6b76988456c0292f();
|
|
12321
12321
|
let tmpPath = $9Afec$path.join(tmp, 'pro');
|
|
12322
12322
|
// copy assets to temp
|
|
12323
|
-
await $9Afec$fsextra.copy($9Afec$path.join(__dirname, './assets/web'), tmpPath);
|
|
12323
|
+
await $9Afec$fsextra.copy($9Afec$path.join(__dirname, argument['web-indexeddb'] ? './assets/indexeddb' : './assets/web'), tmpPath);
|
|
12324
|
+
// copy base path or readme-directory into temp
|
|
12325
|
+
await $9Afec$fsextra.copy(argument.path, tmpPath);
|
|
12326
|
+
// rename the readme if necessary
|
|
12327
|
+
if (argument['web-indexeddb'] !== undefined) {
|
|
12328
|
+
let newReadme = (typeof argument['web-indexeddb'] === 'string' ? argument['web-indexeddb'] : $320134ce32dd9048$export$4385e60b38654f68(20)) + '.md';
|
|
12329
|
+
let old_ = $9Afec$path.join(tmpPath, argument.readme);
|
|
12330
|
+
let new_ = $9Afec$path.join($9Afec$path.dirname(old_), newReadme);
|
|
12331
|
+
argument.readme = argument.readme.replace($9Afec$path.basename(argument.readme), newReadme);
|
|
12332
|
+
await $9Afec$fsextra.move(old_, new_);
|
|
12333
|
+
}
|
|
12324
12334
|
let index = $9Afec$fsextra.readFileSync($9Afec$path.join(tmpPath, 'index.html'), 'utf8');
|
|
12325
12335
|
// change responsive key
|
|
12326
12336
|
if (argument.key) index = $320134ce32dd9048$export$31a09876afc8115c(argument.key, index);
|
|
@@ -12329,7 +12339,7 @@ async function $1e521125b288b3fc$export$372e2d09604f52f0(argument, json) {
|
|
|
12329
12339
|
if (!window.LIA) {
|
|
12330
12340
|
window.LIA = {}
|
|
12331
12341
|
}
|
|
12332
|
-
|
|
12342
|
+
window.LIA.defaultCourseURL = "${$9Afec$path.basename(argument.readme)}"
|
|
12333
12343
|
</script>`, index);
|
|
12334
12344
|
try {
|
|
12335
12345
|
index = index.replace('<title>Lia</title>', `<title>${json.lia.str_title}</title><meta property="og:title" content="${json.lia.str_title}"> <meta name="twitter:title" content="${json.lia.str_title}">`);
|
|
@@ -12353,13 +12363,14 @@ async function $1e521125b288b3fc$export$372e2d09604f52f0(argument, json) {
|
|
|
12353
12363
|
console.warn('could not add image');
|
|
12354
12364
|
}
|
|
12355
12365
|
try {
|
|
12356
|
-
|
|
12366
|
+
if (argument['web-iframe']) {
|
|
12367
|
+
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'start.html'), index);
|
|
12368
|
+
await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, 'index.html', argument.readme, 'start.html');
|
|
12369
|
+
} else await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'index.html'), index);
|
|
12357
12370
|
} catch (e3) {
|
|
12358
12371
|
console.warn(e3);
|
|
12359
12372
|
return;
|
|
12360
12373
|
}
|
|
12361
|
-
// copy base path or readme-directory into temp
|
|
12362
|
-
await $9Afec$fsextra.copy(argument.path, tmpPath);
|
|
12363
12374
|
if (argument['web-zip']) $320134ce32dd9048$export$8901015135f2fb22(tmpPath, argument.output);
|
|
12364
12375
|
else await $9Afec$fsextra.move(tmpPath, argument.output, {
|
|
12365
12376
|
filter: $320134ce32dd9048$export$3032dc2899b8ea9b
|
|
@@ -12386,7 +12397,7 @@ async function $699da5868da0be18$export$372e2d09604f52f0(argument, json) {
|
|
|
12386
12397
|
quiz: json.quiz,
|
|
12387
12398
|
survey: json.survey
|
|
12388
12399
|
}) + ';');
|
|
12389
|
-
if (argument['scorm-iframe']) await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, argument.readme);
|
|
12400
|
+
if (argument['scorm-iframe']) await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, 'start.html', argument.readme);
|
|
12390
12401
|
try {
|
|
12391
12402
|
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'index.html'), index);
|
|
12392
12403
|
} catch (e) {
|
|
@@ -12453,7 +12464,7 @@ async function $c4fe6e5c8950c8b3$export$372e2d09604f52f0(argument, json) {
|
|
|
12453
12464
|
quiz: json.quiz,
|
|
12454
12465
|
survey: json.survey
|
|
12455
12466
|
}) + ';');
|
|
12456
|
-
if (argument['scorm-iframe']) await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, argument.readme);
|
|
12467
|
+
if (argument['scorm-iframe']) await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, 'start.html', argument.readme);
|
|
12457
12468
|
try {
|
|
12458
12469
|
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'index.html'), index);
|
|
12459
12470
|
} catch (e) {
|
|
@@ -12638,7 +12649,7 @@ async function $e5a6b0d412255288$export$372e2d09604f52f0(argument, json) {
|
|
|
12638
12649
|
argument.readme = argument.readme.replace($9Afec$path.basename(argument.readme), newReadme);
|
|
12639
12650
|
await $9Afec$fsextra.move(old_, new_);
|
|
12640
12651
|
}
|
|
12641
|
-
await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, argument.readme);
|
|
12652
|
+
await $320134ce32dd9048$export$8cde213409fd6377(tmpPath, 'start.html', argument.readme);
|
|
12642
12653
|
$320134ce32dd9048$export$8901015135f2fb22(tmpPath, argument.output);
|
|
12643
12654
|
}
|
|
12644
12655
|
async function $e5a6b0d412255288$var$manifest(tmpPath, meta) {
|
|
@@ -12785,6 +12796,8 @@ function $ccdb061a5468de1f$var$help() {
|
|
|
12785
12796
|
console.log('--ims-indexeddb', ' Use IndexedDB to store data persistently');
|
|
12786
12797
|
console.log('\nWEB settings:');
|
|
12787
12798
|
console.log('');
|
|
12799
|
+
console.log('--web-iframe Use an iframed version to hide the course URL.');
|
|
12800
|
+
console.log('--web-indexeddb This will allow to store data within the browser using indexeddb, you can optionally pass a unique key (by default one is generated randomly).');
|
|
12788
12801
|
console.log('--web-zip By default the result is not zipped, you can change this with this parameter.');
|
|
12789
12802
|
console.log('\nPDF settings:\n');
|
|
12790
12803
|
console.log('--pdf-stylesheet Inject an local CSS for changing the appearance.');
|
|
@@ -12826,6 +12839,8 @@ function $ccdb061a5468de1f$var$parseArguments() {
|
|
|
12826
12839
|
'ims-indexeddb': $ccdb061a5468de1f$var$argv['ims-indexeddb'],
|
|
12827
12840
|
// web-cases
|
|
12828
12841
|
'web-zip': $ccdb061a5468de1f$var$argv['web-zip'],
|
|
12842
|
+
'web-indexeddb': $ccdb061a5468de1f$var$argv['web-indexeddb'],
|
|
12843
|
+
'web-iframe': $ccdb061a5468de1f$var$argv['web-iframe'],
|
|
12829
12844
|
// pdf cases
|
|
12830
12845
|
'pdf-preview': $ccdb061a5468de1f$var$argv['pdf-preview'],
|
|
12831
12846
|
'pdf-scale': $ccdb061a5468de1f$var$argv['pdf-scale'],
|
package/package.json
CHANGED
package/src/export/helper.ts
CHANGED
|
@@ -54,9 +54,14 @@ export function isURL(uri: string) {
|
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export async function iframe(
|
|
57
|
+
export async function iframe(
|
|
58
|
+
tmpPath,
|
|
59
|
+
filename: string,
|
|
60
|
+
readme: string,
|
|
61
|
+
index?: string
|
|
62
|
+
) {
|
|
58
63
|
await writeFile(
|
|
59
|
-
path.join(tmpPath,
|
|
64
|
+
path.join(tmpPath, filename),
|
|
60
65
|
`<!DOCTYPE html>
|
|
61
66
|
<html style="height:100%; overflow: hidden">
|
|
62
67
|
<head>
|
|
@@ -71,7 +76,9 @@ export async function iframe(tmpPath, readme: string) {
|
|
|
71
76
|
let iframe = document.getElementById("lia-container")
|
|
72
77
|
|
|
73
78
|
if (iframe) {
|
|
74
|
-
const src = path + "
|
|
79
|
+
const src = path + "${
|
|
80
|
+
index || 'index.html'
|
|
81
|
+
}?" + path + "${readme.replace('./', '')}"
|
|
75
82
|
iframe.src = src
|
|
76
83
|
}
|
|
77
84
|
</script>
|
package/src/export/ims.ts
CHANGED
package/src/export/scorm12.ts
CHANGED
package/src/export/scorm2004.ts
CHANGED
package/src/export/web.ts
CHANGED
|
@@ -12,6 +12,8 @@ export async function exporter(
|
|
|
12
12
|
path: string
|
|
13
13
|
key?: string
|
|
14
14
|
|
|
15
|
+
'web-iframe'?: boolean
|
|
16
|
+
'web-indexeddb'?: boolean
|
|
15
17
|
'web-zip'?: boolean
|
|
16
18
|
},
|
|
17
19
|
json: any
|
|
@@ -22,7 +24,34 @@ export async function exporter(
|
|
|
22
24
|
let tmpPath = path.join(tmp, 'pro')
|
|
23
25
|
|
|
24
26
|
// copy assets to temp
|
|
25
|
-
await fs.copy(
|
|
27
|
+
await fs.copy(
|
|
28
|
+
path.join(
|
|
29
|
+
__dirname,
|
|
30
|
+
argument['web-indexeddb'] ? './assets/indexeddb' : './assets/web'
|
|
31
|
+
),
|
|
32
|
+
tmpPath
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// copy base path or readme-directory into temp
|
|
36
|
+
await fs.copy(argument.path, tmpPath)
|
|
37
|
+
|
|
38
|
+
// rename the readme if necessary
|
|
39
|
+
if (argument['web-indexeddb'] !== undefined) {
|
|
40
|
+
let newReadme =
|
|
41
|
+
(typeof argument['web-indexeddb'] === 'string'
|
|
42
|
+
? argument['web-indexeddb']
|
|
43
|
+
: helper.random(20)) + '.md'
|
|
44
|
+
|
|
45
|
+
let old_ = path.join(tmpPath, argument.readme)
|
|
46
|
+
let new_ = path.join(path.dirname(old_), newReadme)
|
|
47
|
+
|
|
48
|
+
argument.readme = argument.readme.replace(
|
|
49
|
+
path.basename(argument.readme),
|
|
50
|
+
newReadme
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
await fs.move(old_, new_)
|
|
54
|
+
}
|
|
26
55
|
|
|
27
56
|
let index = fs.readFileSync(path.join(tmpPath, 'index.html'), 'utf8')
|
|
28
57
|
|
|
@@ -37,7 +66,7 @@ export async function exporter(
|
|
|
37
66
|
if (!window.LIA) {
|
|
38
67
|
window.LIA = {}
|
|
39
68
|
}
|
|
40
|
-
|
|
69
|
+
window.LIA.defaultCourseURL = "${path.basename(argument.readme)}"
|
|
41
70
|
</script>`,
|
|
42
71
|
index
|
|
43
72
|
)
|
|
@@ -79,15 +108,17 @@ export async function exporter(
|
|
|
79
108
|
}
|
|
80
109
|
|
|
81
110
|
try {
|
|
82
|
-
|
|
111
|
+
if (argument['web-iframe']) {
|
|
112
|
+
await helper.writeFile(path.join(tmpPath, 'start.html'), index)
|
|
113
|
+
await helper.iframe(tmpPath, 'index.html', argument.readme, 'start.html')
|
|
114
|
+
} else {
|
|
115
|
+
await helper.writeFile(path.join(tmpPath, 'index.html'), index)
|
|
116
|
+
}
|
|
83
117
|
} catch (e) {
|
|
84
118
|
console.warn(e)
|
|
85
119
|
return
|
|
86
120
|
}
|
|
87
121
|
|
|
88
|
-
// copy base path or readme-directory into temp
|
|
89
|
-
await fs.copy(argument.path, tmpPath)
|
|
90
|
-
|
|
91
122
|
if (argument['web-zip']) {
|
|
92
123
|
helper.zip(tmpPath, argument.output)
|
|
93
124
|
} else {
|
package/src/index.ts
CHANGED
|
@@ -147,6 +147,12 @@ function help() {
|
|
|
147
147
|
|
|
148
148
|
console.log('\nWEB settings:')
|
|
149
149
|
console.log('')
|
|
150
|
+
console.log(
|
|
151
|
+
'--web-iframe Use an iframed version to hide the course URL.'
|
|
152
|
+
)
|
|
153
|
+
console.log(
|
|
154
|
+
'--web-indexeddb This will allow to store data within the browser using indexeddb, you can optionally pass a unique key (by default one is generated randomly).'
|
|
155
|
+
)
|
|
150
156
|
console.log(
|
|
151
157
|
'--web-zip By default the result is not zipped, you can change this with this parameter.'
|
|
152
158
|
)
|
|
@@ -238,6 +244,8 @@ function parseArguments() {
|
|
|
238
244
|
|
|
239
245
|
// web-cases
|
|
240
246
|
'web-zip': argv['web-zip'],
|
|
247
|
+
'web-indexeddb': argv['web-indexeddb'],
|
|
248
|
+
'web-iframe': argv['web-iframe'],
|
|
241
249
|
|
|
242
250
|
// pdf cases
|
|
243
251
|
'pdf-preview': argv['pdf-preview'],
|