@liascript/exporter 2.0.0--preview2 → 2.0.0--preview3
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 +8 -0
- package/dist/index.js +33 -5
- package/package.json +1 -1
- package/src/export/scorm12.ts +35 -2
- package/src/export/scorm2004.ts +8 -2
- package/src/index.ts +2 -1
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ SCORM 1.2 settings:
|
|
|
81
81
|
--scorm-organization set the organization title
|
|
82
82
|
--scorm-masteryScore set the scorm masteryScore (a value between 0 -- 100), default is 0
|
|
83
83
|
--scorm-typicalDuration set the scorm duration, default is PT0H5M0S
|
|
84
|
+
--scorm-iframe use an iframe, when a SCORM starting parameter is not working
|
|
84
85
|
|
|
85
86
|
PDF settings:
|
|
86
87
|
|
|
@@ -187,6 +188,13 @@ This parameter simply sets the organization parameter in your SCORM
|
|
|
187
188
|
`imsmanifest` file. All other parameters are taken from the course
|
|
188
189
|
|
|
189
190
|
|
|
191
|
+
__`--scorm-iframe`__
|
|
192
|
+
|
|
193
|
+
Some LMS like ILIAS or OpenOlat seem to have problems with the required
|
|
194
|
+
`startingParameter` and will not load SCORM1.2 courses properly. To fix this,
|
|
195
|
+
this parameter can be used. It tries to run the course within an additional
|
|
196
|
+
`<iframe>`.
|
|
197
|
+
|
|
190
198
|
### SCORM2004
|
|
191
199
|
|
|
192
200
|
This output format provides the same settings as `scorm1.2`, but it allows to
|
package/dist/index.js
CHANGED
|
@@ -12166,6 +12166,30 @@ async function $1e521125b288b3fc$export$372e2d09604f52f0(argument, json) {
|
|
|
12166
12166
|
|
|
12167
12167
|
|
|
12168
12168
|
|
|
12169
|
+
async function $699da5868da0be18$export$8cde213409fd6377(tmpPath, readme) {
|
|
12170
|
+
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'start.html'), `<!DOCTYPE html>
|
|
12171
|
+
<html style="height:100%; overflow: hidden">
|
|
12172
|
+
<head>
|
|
12173
|
+
|
|
12174
|
+
</head>
|
|
12175
|
+
<body style="height:100%">
|
|
12176
|
+
|
|
12177
|
+
<iframe id="lia-container" src="" style="border: 0px; width: 100%; height: 100%"></iframe>
|
|
12178
|
+
|
|
12179
|
+
<script>
|
|
12180
|
+
let path = window.location.pathname.replace("start.html", "")
|
|
12181
|
+
let iframe = document.getElementById("lia-container")
|
|
12182
|
+
|
|
12183
|
+
if (iframe) {
|
|
12184
|
+
const src = path + "index.html?" + path + "${readme.replace('./', '')}"
|
|
12185
|
+
iframe.src = src
|
|
12186
|
+
}
|
|
12187
|
+
</script>
|
|
12188
|
+
|
|
12189
|
+
</body>
|
|
12190
|
+
</html>
|
|
12191
|
+
`);
|
|
12192
|
+
}
|
|
12169
12193
|
async function $699da5868da0be18$export$372e2d09604f52f0(argument, json) {
|
|
12170
12194
|
// make temp folder
|
|
12171
12195
|
let tmp = await $320134ce32dd9048$export$6b76988456c0292f();
|
|
@@ -12181,6 +12205,7 @@ async function $699da5868da0be18$export$372e2d09604f52f0(argument, json) {
|
|
|
12181
12205
|
quiz: json.quiz,
|
|
12182
12206
|
survey: json.survey
|
|
12183
12207
|
}) + ';');
|
|
12208
|
+
if (argument['scorm-iframe']) await $699da5868da0be18$export$8cde213409fd6377(tmpPath, argument.readme);
|
|
12184
12209
|
try {
|
|
12185
12210
|
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'index.html'), index);
|
|
12186
12211
|
} catch (e) {
|
|
@@ -12197,8 +12222,8 @@ async function $699da5868da0be18$export$372e2d09604f52f0(argument, json) {
|
|
|
12197
12222
|
title: json.lia.str_title,
|
|
12198
12223
|
language: json.lia.definition.language,
|
|
12199
12224
|
masteryScore: argument['scorm-masteryScore'] || 0,
|
|
12200
|
-
startingPage: 'index.html',
|
|
12201
|
-
startingParameters: '
|
|
12225
|
+
startingPage: argument['scorm-iframe'] ? 'start.html' : 'index.html',
|
|
12226
|
+
startingParameters: argument['scorm-iframe'] ? undefined : argument.readme,
|
|
12202
12227
|
source: $9Afec$path.join(tmp, 'pro'),
|
|
12203
12228
|
package: {
|
|
12204
12229
|
version: json.lia.definition.version,
|
|
@@ -12232,6 +12257,7 @@ async function $699da5868da0be18$export$372e2d09604f52f0(argument, json) {
|
|
|
12232
12257
|
|
|
12233
12258
|
|
|
12234
12259
|
|
|
12260
|
+
|
|
12235
12261
|
async function $c4fe6e5c8950c8b3$export$372e2d09604f52f0(argument, json) {
|
|
12236
12262
|
// make temp folder
|
|
12237
12263
|
let tmp = await $320134ce32dd9048$export$6b76988456c0292f();
|
|
@@ -12247,6 +12273,7 @@ async function $c4fe6e5c8950c8b3$export$372e2d09604f52f0(argument, json) {
|
|
|
12247
12273
|
quiz: json.quiz,
|
|
12248
12274
|
survey: json.survey
|
|
12249
12275
|
}) + ';');
|
|
12276
|
+
if (argument['scorm-iframe']) await $699da5868da0be18$export$8cde213409fd6377(tmpPath, argument.readme);
|
|
12250
12277
|
try {
|
|
12251
12278
|
await $320134ce32dd9048$export$552bfb764b5cd2b4($9Afec$path.join(tmpPath, 'index.html'), index);
|
|
12252
12279
|
} catch (e) {
|
|
@@ -12263,8 +12290,8 @@ async function $c4fe6e5c8950c8b3$export$372e2d09604f52f0(argument, json) {
|
|
|
12263
12290
|
title: json.lia.str_title,
|
|
12264
12291
|
language: json.lia.definition.language,
|
|
12265
12292
|
masteryScore: argument['scorm-masteryScore'] || 0,
|
|
12266
|
-
startingPage: 'index.html',
|
|
12267
|
-
startingParameters: '
|
|
12293
|
+
startingPage: argument['scorm-iframe'] ? 'start.html' : 'index.html',
|
|
12294
|
+
startingParameters: argument['scorm-iframe'] ? undefined : argument.readme,
|
|
12268
12295
|
source: $9Afec$path.join(tmp, 'pro'),
|
|
12269
12296
|
package: {
|
|
12270
12297
|
version: json.lia.definition.version,
|
|
@@ -12484,7 +12511,7 @@ function $ccdb061a5468de1f$var$help() {
|
|
|
12484
12511
|
console.log('--scorm-organization', ' set the organization title');
|
|
12485
12512
|
console.log('--scorm-masteryScore', ' set the scorm masteryScore (a value between 0 -- 100), default is 0');
|
|
12486
12513
|
console.log('--scorm-typicalDuration', ' set the scorm duration, default is PT0H5M0S');
|
|
12487
|
-
console.log('--scorm-iframe', '
|
|
12514
|
+
console.log('--scorm-iframe', ' use an iframe, when a SCORM starting parameter is not working');
|
|
12488
12515
|
console.log('\nPDF settings:\n');
|
|
12489
12516
|
console.log('--pdf-stylesheet Inject an local CSS for changing the appearance.');
|
|
12490
12517
|
console.log('--pdf-theme LiaScript themes: default, turquoise, blue, red, yellow');
|
|
@@ -12520,6 +12547,7 @@ function $ccdb061a5468de1f$var$parseArguments() {
|
|
|
12520
12547
|
'scorm-organization': $ccdb061a5468de1f$var$argv['scorm-organization'],
|
|
12521
12548
|
'scorm-masteryScore': $ccdb061a5468de1f$var$argv['scorm-masteryScore'],
|
|
12522
12549
|
'scorm-typicalDuration': $ccdb061a5468de1f$var$argv['scorm-typicalDuration'],
|
|
12550
|
+
'scorm-iframe': $ccdb061a5468de1f$var$argv['scorm-iframe'],
|
|
12523
12551
|
// pdf cases
|
|
12524
12552
|
'pdf-preview': $ccdb061a5468de1f$var$argv['pdf-preview'],
|
|
12525
12553
|
'pdf-scale': $ccdb061a5468de1f$var$argv['pdf-scale'],
|
package/package.json
CHANGED
package/src/export/scorm12.ts
CHANGED
|
@@ -4,6 +4,34 @@ const scormPackager = require('@liascript/simple-scorm-packager')
|
|
|
4
4
|
const path = require('path')
|
|
5
5
|
const fs = require('fs-extra')
|
|
6
6
|
|
|
7
|
+
export async function iframe(tmpPath, readme: string) {
|
|
8
|
+
await helper.writeFile(
|
|
9
|
+
path.join(tmpPath, 'start.html'),
|
|
10
|
+
`<!DOCTYPE html>
|
|
11
|
+
<html style="height:100%; overflow: hidden">
|
|
12
|
+
<head>
|
|
13
|
+
|
|
14
|
+
</head>
|
|
15
|
+
<body style="height:100%">
|
|
16
|
+
|
|
17
|
+
<iframe id="lia-container" src="" style="border: 0px; width: 100%; height: 100%"></iframe>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
let path = window.location.pathname.replace("start.html", "")
|
|
21
|
+
let iframe = document.getElementById("lia-container")
|
|
22
|
+
|
|
23
|
+
if (iframe) {
|
|
24
|
+
const src = path + "index.html?" + path + "${readme.replace('./', '')}"
|
|
25
|
+
iframe.src = src
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
31
|
+
`
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
7
35
|
export async function exporter(
|
|
8
36
|
argument: {
|
|
9
37
|
input: string
|
|
@@ -17,6 +45,7 @@ export async function exporter(
|
|
|
17
45
|
'scorm-organization'?: string
|
|
18
46
|
'scorm-masteryScore'?: string
|
|
19
47
|
'scorm-typicalDuration'?: string
|
|
48
|
+
'scorm-iframe'?: boolean
|
|
20
49
|
},
|
|
21
50
|
json
|
|
22
51
|
) {
|
|
@@ -47,6 +76,10 @@ export async function exporter(
|
|
|
47
76
|
';'
|
|
48
77
|
)
|
|
49
78
|
|
|
79
|
+
if (argument['scorm-iframe']) {
|
|
80
|
+
await iframe(tmpPath, argument.readme)
|
|
81
|
+
}
|
|
82
|
+
|
|
50
83
|
try {
|
|
51
84
|
await helper.writeFile(path.join(tmpPath, 'index.html'), index)
|
|
52
85
|
} catch (e) {
|
|
@@ -63,8 +96,8 @@ export async function exporter(
|
|
|
63
96
|
title: json.lia.str_title,
|
|
64
97
|
language: json.lia.definition.language,
|
|
65
98
|
masteryScore: argument['scorm-masteryScore'] || 0,
|
|
66
|
-
startingPage: 'index.html',
|
|
67
|
-
startingParameters: '
|
|
99
|
+
startingPage: argument['scorm-iframe'] ? 'start.html' : 'index.html',
|
|
100
|
+
startingParameters: argument['scorm-iframe'] ? undefined : argument.readme,
|
|
68
101
|
source: path.join(tmp, 'pro'),
|
|
69
102
|
package: {
|
|
70
103
|
version: json.lia.definition.version,
|
package/src/export/scorm2004.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as helper from './helper'
|
|
2
|
+
import * as SCORM from './scorm12'
|
|
2
3
|
|
|
3
4
|
const scormPackager = require('@liascript/simple-scorm-packager')
|
|
4
5
|
const path = require('path')
|
|
@@ -17,6 +18,7 @@ export async function exporter(
|
|
|
17
18
|
'scorm-organization'?: string
|
|
18
19
|
'scorm-masteryScore'?: string
|
|
19
20
|
'scorm-typicalDuration'?: string
|
|
21
|
+
'scorm-iframe'?: boolean
|
|
20
22
|
},
|
|
21
23
|
json
|
|
22
24
|
) {
|
|
@@ -47,6 +49,10 @@ export async function exporter(
|
|
|
47
49
|
';'
|
|
48
50
|
)
|
|
49
51
|
|
|
52
|
+
if (argument['scorm-iframe']) {
|
|
53
|
+
await SCORM.iframe(tmpPath, argument.readme)
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
try {
|
|
51
57
|
await helper.writeFile(path.join(tmpPath, 'index.html'), index)
|
|
52
58
|
} catch (e) {
|
|
@@ -63,8 +69,8 @@ export async function exporter(
|
|
|
63
69
|
title: json.lia.str_title,
|
|
64
70
|
language: json.lia.definition.language,
|
|
65
71
|
masteryScore: argument['scorm-masteryScore'] || 0,
|
|
66
|
-
startingPage: 'index.html',
|
|
67
|
-
startingParameters: '
|
|
72
|
+
startingPage: argument['scorm-iframe'] ? 'start.html' : 'index.html',
|
|
73
|
+
startingParameters: argument['scorm-iframe'] ? undefined : argument.readme,
|
|
68
74
|
source: path.join(tmp, 'pro'),
|
|
69
75
|
package: {
|
|
70
76
|
version: json.lia.definition.version,
|
package/src/index.ts
CHANGED
|
@@ -129,7 +129,7 @@ function help() {
|
|
|
129
129
|
|
|
130
130
|
console.log(
|
|
131
131
|
'--scorm-iframe',
|
|
132
|
-
'
|
|
132
|
+
' use an iframe, when a SCORM starting parameter is not working'
|
|
133
133
|
)
|
|
134
134
|
|
|
135
135
|
console.log('\nPDF settings:\n')
|
|
@@ -212,6 +212,7 @@ function parseArguments() {
|
|
|
212
212
|
'scorm-organization': argv['scorm-organization'],
|
|
213
213
|
'scorm-masteryScore': argv['scorm-masteryScore'],
|
|
214
214
|
'scorm-typicalDuration': argv['scorm-typicalDuration'],
|
|
215
|
+
'scorm-iframe': argv['scorm-iframe'],
|
|
215
216
|
|
|
216
217
|
// pdf cases
|
|
217
218
|
'pdf-preview': argv['pdf-preview'],
|