@pie-qti/qti-common 0.1.27 → 0.1.28
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/dist/accessibility/apip.js +2 -22
- package/dist/accessibility/apip.js.map +1 -1
- package/dist/accessibility/catalog-info.d.ts +17 -0
- package/dist/accessibility/catalog-info.js +60 -0
- package/dist/accessibility/catalog-info.js.map +1 -0
- package/dist/accessibility/catalog.d.ts +2 -0
- package/dist/accessibility/catalog.js +27 -0
- package/dist/accessibility/catalog.js.map +1 -1
- package/dist/accessibility/index.d.ts +2 -1
- package/dist/accessibility/index.js +2 -1
- package/dist/accessibility/index.js.map +1 -1
- package/dist/element-mapper/index.d.ts +1 -0
- package/dist/element-mapper/index.js +1 -0
- package/dist/element-mapper/index.js.map +1 -1
- package/dist/element-mapper/qti2-to-qti3.d.ts +36 -0
- package/dist/element-mapper/qti2-to-qti3.js +228 -0
- package/dist/element-mapper/qti2-to-qti3.js.map +1 -0
- package/dist/element-mapper/qti3-element-mappings.d.ts +99 -20
- package/dist/element-mapper/qti3-element-mappings.js +67 -14
- package/dist/element-mapper/qti3-element-mappings.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 2.x → QTI 3.0 rename
|
|
3
|
+
*
|
|
4
|
+
* QTI 3.0 is QTI 2.2's information model under new names: `qti-` prefixed kebab-case elements,
|
|
5
|
+
* kebab-case attributes, the `imsqtiasi_v3p0` namespace. `convertQti2ToQti3` applies that rename
|
|
6
|
+
* to a QTI 2.x item, test or stimulus document, plus the three structural changes 3.0 makes to
|
|
7
|
+
* what the generators emit:
|
|
8
|
+
*
|
|
9
|
+
* - `rubricBlock` content goes inside `qti-content-body`, after any `qti-stylesheet`, and the
|
|
10
|
+
* now-required `use` defaults to `scoring` for a scorer view, else `instructions`.
|
|
11
|
+
* - Response-processing template URIs take their 3.0 form; the item player and other 3.0
|
|
12
|
+
* processors resolve them by file name.
|
|
13
|
+
* - `xsi:schemaLocation` names the 3.0 ASI schema for the QTI namespace.
|
|
14
|
+
*
|
|
15
|
+
* The document is rewritten as a token stream, so markup, entities and whitespace outside tag
|
|
16
|
+
* names and attribute names are kept byte for byte. HTML elements keep their names, as QTI 3
|
|
17
|
+
* does. Foreign subtrees — MathML, SVG, any prefixed element and any element declaring another
|
|
18
|
+
* default namespace — pass through untouched: Content MathML's `and`, `max` or `sum` would
|
|
19
|
+
* otherwise collide with QTI expressions.
|
|
20
|
+
*
|
|
21
|
+
* Elements 3.0 has no counterpart for (`infoControl`) and APIP are not converted; the input is
|
|
22
|
+
* expected to carry neither, and they come out unchanged.
|
|
23
|
+
*/
|
|
24
|
+
import { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';
|
|
25
|
+
import { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
|
|
26
|
+
export const QTI3_NAMESPACE = 'http://www.imsglobal.org/xsd/imsqtiasi_v3p0';
|
|
27
|
+
export const QTI3_ASI_SCHEMA_LOCATION = 'https://purl.imsglobal.org/spec/qti/v3p0/schema/xsd/imsqti_asiv3p0_v1p0.xsd';
|
|
28
|
+
export const QTI3_RPTEMPLATE_BASE = 'https://purl.imsglobal.org/spec/qti/v3p0/rptemplates/';
|
|
29
|
+
const QTI2_NAMESPACES = new Set([
|
|
30
|
+
'http://www.imsglobal.org/xsd/imsqti_v2p0',
|
|
31
|
+
'http://www.imsglobal.org/xsd/imsqti_v2p1',
|
|
32
|
+
'http://www.imsglobal.org/xsd/imsqti_v2p2',
|
|
33
|
+
]);
|
|
34
|
+
/** A QTI 2.x response-processing template URI; the file name is group 1. */
|
|
35
|
+
const QTI2_RPTEMPLATE = /^https?:\/\/www\.imsglobal\.org\/question\/qti_v2p[012]\/rptemplates\/([A-Za-z_]+?)(?:\.xml)?$/;
|
|
36
|
+
/** The HTML elements the QTI 3.0 ASI schema declares; they keep their names. */
|
|
37
|
+
export const QTI3_HTML_ELEMENTS = new Set(('a abbr acronym address article aside audio b bdi bdo big blockquote br caption cite code col ' +
|
|
38
|
+
'colgroup dd details dfn div dl dt em figcaption figure footer h1 h2 h3 h4 h5 h6 header hr i img ' +
|
|
39
|
+
'kbd label li nav object ol p param picture pre q rb rp rt rtc ruby samp section small source span ' +
|
|
40
|
+
'strong sub summary sup table tbody td template tfoot th thead tr track tt ul var video').split(' '));
|
|
41
|
+
/** Unprefixed roots of a foreign vocabulary. */
|
|
42
|
+
const FOREIGN_ROOTS = new Set(['math', 'svg']);
|
|
43
|
+
const elementMapper = new Qti3ElementNameMapper();
|
|
44
|
+
const QTI3_ATTRIBUTE_BY_QTI2 = new Map();
|
|
45
|
+
for (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {
|
|
46
|
+
if (QTI3_ATTRIBUTE_BY_QTI2.has(camel)) {
|
|
47
|
+
throw new Error(`QTI 2 attribute "${camel}" has two QTI 3 names`);
|
|
48
|
+
}
|
|
49
|
+
QTI3_ATTRIBUTE_BY_QTI2.set(camel, kebab);
|
|
50
|
+
}
|
|
51
|
+
const START_TAG = /<([A-Za-z_][\w.:-]*)((?:\s+[^\s=>/]+\s*=\s*(?:"[^"]*"|'[^']*'))*)(\s*)(\/?)>/y;
|
|
52
|
+
const END_TAG = /<\/([A-Za-z_][\w.:-]*)\s*>/y;
|
|
53
|
+
const ATTRIBUTE = /(\s+)([^\s=>/]+)(\s*=\s*)(?:"([^"]*)"|'([^']*)')/g;
|
|
54
|
+
/** The QTI 3.0 name of a QTI 2.x element; HTML and unknown names are kept. */
|
|
55
|
+
export function qti3ElementName(qti2Name) {
|
|
56
|
+
if (QTI3_HTML_ELEMENTS.has(qti2Name))
|
|
57
|
+
return qti2Name;
|
|
58
|
+
const native = elementMapper.toNative(qti2Name.toLowerCase());
|
|
59
|
+
return native.startsWith('qti-') ? native : qti2Name;
|
|
60
|
+
}
|
|
61
|
+
/** The QTI 3.0 name of a QTI 2.x attribute: kebab-case for a QTI camelCase name, else unchanged. */
|
|
62
|
+
export function qti3AttributeName(qti2Name) {
|
|
63
|
+
if (!/[A-Z]/.test(qti2Name) || qti2Name.includes(':') || qti2Name.startsWith('data-'))
|
|
64
|
+
return qti2Name;
|
|
65
|
+
return QTI3_ATTRIBUTE_BY_QTI2.get(qti2Name) ?? qti2Name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
66
|
+
}
|
|
67
|
+
/** A QTI 2.x response-processing template URI in its QTI 3.0 form; other URIs are kept. */
|
|
68
|
+
export function qti3TemplateUri(uri) {
|
|
69
|
+
const match = QTI2_RPTEMPLATE.exec(uri.trim());
|
|
70
|
+
return match ? `${QTI3_RPTEMPLATE_BASE}${match[1]}.xml` : uri;
|
|
71
|
+
}
|
|
72
|
+
/** Convert a QTI 2.x item, test or stimulus document to QTI 3.0. */
|
|
73
|
+
export function convertQti2ToQti3(xml) {
|
|
74
|
+
const out = [];
|
|
75
|
+
const stack = [];
|
|
76
|
+
let foreignDepth = 0;
|
|
77
|
+
let index = 0;
|
|
78
|
+
let rootSeen = false;
|
|
79
|
+
const rubric = () => stack[stack.length - 1]?.rubric;
|
|
80
|
+
/** Open the rubric's content body before content that is not a leading stylesheet. */
|
|
81
|
+
const openContentBody = () => {
|
|
82
|
+
const open = rubric();
|
|
83
|
+
if (open && !open.opened) {
|
|
84
|
+
out.push('<qti-content-body>');
|
|
85
|
+
open.opened = true;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
while (index < xml.length) {
|
|
89
|
+
const lt = xml.indexOf('<', index);
|
|
90
|
+
if (lt === -1) {
|
|
91
|
+
out.push(xml.slice(index));
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (lt > index) {
|
|
95
|
+
const text = xml.slice(index, lt);
|
|
96
|
+
if (foreignDepth === 0 && text.trim())
|
|
97
|
+
openContentBody();
|
|
98
|
+
out.push(text);
|
|
99
|
+
}
|
|
100
|
+
const special = specialToken(xml, lt);
|
|
101
|
+
if (special !== undefined) {
|
|
102
|
+
if (foreignDepth === 0 && !xml.startsWith('<?', lt) && !xml.startsWith('<!--', lt))
|
|
103
|
+
openContentBody();
|
|
104
|
+
out.push(xml.slice(lt, special));
|
|
105
|
+
index = special;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
END_TAG.lastIndex = lt;
|
|
109
|
+
const end = END_TAG.exec(xml);
|
|
110
|
+
if (end) {
|
|
111
|
+
index = END_TAG.lastIndex;
|
|
112
|
+
if (foreignDepth > 0) {
|
|
113
|
+
foreignDepth -= 1;
|
|
114
|
+
out.push(end[0]);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const open = stack.pop();
|
|
118
|
+
if (!open)
|
|
119
|
+
throw new Error(`Unexpected </${end[1]}> at offset ${lt}`);
|
|
120
|
+
if (open.rubric)
|
|
121
|
+
out.push(open.rubric.opened ? '</qti-content-body>' : '<qti-content-body/>');
|
|
122
|
+
out.push(`</${open.name}>`);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
START_TAG.lastIndex = lt;
|
|
126
|
+
const start = START_TAG.exec(xml);
|
|
127
|
+
if (!start)
|
|
128
|
+
throw new Error(`Malformed markup at offset ${lt}`);
|
|
129
|
+
index = START_TAG.lastIndex;
|
|
130
|
+
const [tag, name, attrs, space, selfClosing] = start;
|
|
131
|
+
if (foreignDepth > 0) {
|
|
132
|
+
if (!selfClosing)
|
|
133
|
+
foreignDepth += 1;
|
|
134
|
+
out.push(tag);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (isForeign(name, attrs)) {
|
|
138
|
+
openContentBody();
|
|
139
|
+
rootSeen = true;
|
|
140
|
+
if (!selfClosing)
|
|
141
|
+
foreignDepth = 1;
|
|
142
|
+
out.push(tag);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const qti3Name = qti3ElementName(name);
|
|
146
|
+
if (qti3Name !== 'qti-stylesheet')
|
|
147
|
+
openContentBody();
|
|
148
|
+
const element = { name: qti3Name };
|
|
149
|
+
let converted = convertAttributes(attrs, !rootSeen);
|
|
150
|
+
rootSeen = true;
|
|
151
|
+
if (qti3Name === 'qti-rubric-block') {
|
|
152
|
+
converted = withRubricUse(converted);
|
|
153
|
+
element.rubric = { opened: false };
|
|
154
|
+
}
|
|
155
|
+
if (selfClosing) {
|
|
156
|
+
out.push(element.rubric
|
|
157
|
+
? `<${qti3Name}${converted}><qti-content-body/></${qti3Name}>`
|
|
158
|
+
: `<${qti3Name}${converted}${space}/>`);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
out.push(`<${qti3Name}${converted}${space}>`);
|
|
162
|
+
stack.push(element);
|
|
163
|
+
}
|
|
164
|
+
if (stack.length > 0 || foreignDepth > 0) {
|
|
165
|
+
throw new Error(`Unclosed <${stack[stack.length - 1]?.name ?? 'element'}>`);
|
|
166
|
+
}
|
|
167
|
+
return out.join('');
|
|
168
|
+
}
|
|
169
|
+
/** The end offset of a comment, CDATA section, processing instruction or doctype at `at`. */
|
|
170
|
+
function specialToken(xml, at) {
|
|
171
|
+
const close = (marker, open) => {
|
|
172
|
+
const found = xml.indexOf(marker, at + open.length);
|
|
173
|
+
if (found === -1)
|
|
174
|
+
throw new Error(`Unterminated ${open} at offset ${at}`);
|
|
175
|
+
return found + marker.length;
|
|
176
|
+
};
|
|
177
|
+
if (xml.startsWith('<!--', at))
|
|
178
|
+
return close('-->', '<!--');
|
|
179
|
+
if (xml.startsWith('<![CDATA[', at))
|
|
180
|
+
return close(']]>', '<![CDATA[');
|
|
181
|
+
if (xml.startsWith('<?', at))
|
|
182
|
+
return close('?>', '<?');
|
|
183
|
+
if (xml.startsWith('<!', at))
|
|
184
|
+
return close('>', '<!');
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
function isForeign(name, attrs) {
|
|
188
|
+
if (name.includes(':') || FOREIGN_ROOTS.has(name))
|
|
189
|
+
return true;
|
|
190
|
+
for (const match of attrs.matchAll(ATTRIBUTE)) {
|
|
191
|
+
if (match[2] === 'xmlns' && !QTI2_NAMESPACES.has((match[4] ?? match[5] ?? '').trim()))
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
function convertAttributes(attrs, isRoot) {
|
|
197
|
+
return attrs.replace(ATTRIBUTE, (_match, lead, name, eq, dq, sq) => {
|
|
198
|
+
const quote = dq === undefined ? "'" : '"';
|
|
199
|
+
let value = dq ?? sq ?? '';
|
|
200
|
+
if (name === 'xmlns' && QTI2_NAMESPACES.has(value.trim()))
|
|
201
|
+
value = QTI3_NAMESPACE;
|
|
202
|
+
else if (name === 'template')
|
|
203
|
+
value = qti3TemplateUri(value);
|
|
204
|
+
else if (isRoot && name === 'xsi:schemaLocation')
|
|
205
|
+
value = qti3SchemaLocation(value);
|
|
206
|
+
return `${lead}${qti3AttributeName(name)}${eq}${quote}${value}${quote}`;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/** `xsi:schemaLocation` with the QTI 2.x namespace pair replaced by the 3.0 ASI schema. */
|
|
210
|
+
function qti3SchemaLocation(value) {
|
|
211
|
+
const parts = value.trim().split(/\s+/);
|
|
212
|
+
const pairs = [];
|
|
213
|
+
for (let i = 0; i + 1 < parts.length; i += 2) {
|
|
214
|
+
const [namespace, location] = [parts[i], parts[i + 1]];
|
|
215
|
+
pairs.push(QTI2_NAMESPACES.has(namespace) ? `${QTI3_NAMESPACE} ${QTI3_ASI_SCHEMA_LOCATION}` : `${namespace} ${location}`);
|
|
216
|
+
}
|
|
217
|
+
return pairs.join(' ');
|
|
218
|
+
}
|
|
219
|
+
/** A rubric block's attributes with `use`, which QTI 3.0 requires, defaulted from `view`. */
|
|
220
|
+
function withRubricUse(attrs) {
|
|
221
|
+
const names = [...attrs.matchAll(ATTRIBUTE)].map((match) => match[2]);
|
|
222
|
+
if (names.includes('use'))
|
|
223
|
+
return attrs;
|
|
224
|
+
const view = [...attrs.matchAll(ATTRIBUTE)].find((match) => match[2] === 'view');
|
|
225
|
+
const views = (view?.[4] ?? view?.[5] ?? '').split(/\s+/);
|
|
226
|
+
return `${attrs} use="${views.includes('scorer') ? 'scoring' : 'instructions'}"`;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=qti2-to-qti3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti2-to-qti3.js","sourceRoot":"","sources":["../../src/element-mapper/qti2-to-qti3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,6CAA6C,CAAC;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GACpC,6EAA6E,CAAC;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,uDAAuD,CAAC;AAE5F,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC/B,0CAA0C;IAC1C,0CAA0C;IAC1C,0CAA0C;CAC1C,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,eAAe,GAAG,gGAAgG,CAAC;AAEzH,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAC7D,CACC,+FAA+F;IAC/F,kGAAkG;IAClG,oGAAoG;IACpG,wFAAwF,CACxF,CAAC,KAAK,CAAC,GAAG,CAAC,CACZ,CAAC;AAEF,gDAAgD;AAChD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAE/C,MAAM,aAAa,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAElD,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;AACzD,KAAK,MAAM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,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IACjF,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,GAAG,KAAK,SAAS,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC;AAClF,CAAC","sourcesContent":["/**\n * QTI 2.x → QTI 3.0 rename\n *\n * QTI 3.0 is QTI 2.2's information model under new names: `qti-` prefixed kebab-case elements,\n * kebab-case attributes, the `imsqtiasi_v3p0` namespace. `convertQti2ToQti3` applies that rename\n * to a QTI 2.x item, test or stimulus document, plus the three structural changes 3.0 makes to\n * what the generators emit:\n *\n * - `rubricBlock` content goes inside `qti-content-body`, after any `qti-stylesheet`, and the\n * now-required `use` defaults to `scoring` for a scorer view, else `instructions`.\n * - Response-processing template URIs take their 3.0 form; the item player and other 3.0\n * processors resolve them by file name.\n * - `xsi:schemaLocation` names the 3.0 ASI schema for the QTI namespace.\n *\n * The document is rewritten as a token stream, so markup, entities and whitespace outside tag\n * names and attribute names are kept byte for byte. HTML elements keep their names, as QTI 3\n * does. Foreign subtrees — MathML, SVG, any prefixed element and any element declaring another\n * default namespace — pass through untouched: Content MathML's `and`, `max` or `sum` would\n * otherwise collide with QTI expressions.\n *\n * Elements 3.0 has no counterpart for (`infoControl`) and APIP are not converted; the input is\n * expected to carry neither, and they come out unchanged.\n */\n\nimport { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';\nimport { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';\n\nexport const QTI3_NAMESPACE = 'http://www.imsglobal.org/xsd/imsqtiasi_v3p0';\nexport const QTI3_ASI_SCHEMA_LOCATION =\n\t'https://purl.imsglobal.org/spec/qti/v3p0/schema/xsd/imsqti_asiv3p0_v1p0.xsd';\nexport const QTI3_RPTEMPLATE_BASE = 'https://purl.imsglobal.org/spec/qti/v3p0/rptemplates/';\n\nconst QTI2_NAMESPACES = new Set([\n\t'http://www.imsglobal.org/xsd/imsqti_v2p0',\n\t'http://www.imsglobal.org/xsd/imsqti_v2p1',\n\t'http://www.imsglobal.org/xsd/imsqti_v2p2',\n]);\n\n/** A QTI 2.x response-processing template URI; the file name is group 1. */\nconst QTI2_RPTEMPLATE = /^https?:\\/\\/www\\.imsglobal\\.org\\/question\\/qti_v2p[012]\\/rptemplates\\/([A-Za-z_]+?)(?:\\.xml)?$/;\n\n/** The HTML elements the QTI 3.0 ASI schema declares; they keep their names. */\nexport const QTI3_HTML_ELEMENTS: ReadonlySet<string> = new Set(\n\t(\n\t\t'a abbr acronym address article aside audio b bdi bdo big blockquote br caption cite code col ' +\n\t\t'colgroup dd details dfn div dl dt em figcaption figure footer h1 h2 h3 h4 h5 h6 header hr i img ' +\n\t\t'kbd label li nav object ol p param picture pre q rb rp rt rtc ruby samp section small source span ' +\n\t\t'strong sub summary sup table tbody td template tfoot th thead tr track tt ul var video'\n\t).split(' '),\n);\n\n/** Unprefixed roots of a foreign vocabulary. */\nconst FOREIGN_ROOTS = new Set(['math', 'svg']);\n\nconst elementMapper = new Qti3ElementNameMapper();\n\nconst QTI3_ATTRIBUTE_BY_QTI2 = new Map<string, string>();\nfor (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {\n\tif (QTI3_ATTRIBUTE_BY_QTI2.has(camel)) {\n\t\tthrow new Error(`QTI 2 attribute \"${camel}\" has two QTI 3 names`);\n\t}\n\tQTI3_ATTRIBUTE_BY_QTI2.set(camel, kebab);\n}\n\nconst START_TAG = /<([A-Za-z_][\\w.:-]*)((?:\\s+[^\\s=>/]+\\s*=\\s*(?:\"[^\"]*\"|'[^']*'))*)(\\s*)(\\/?)>/y;\nconst END_TAG = /<\\/([A-Za-z_][\\w.:-]*)\\s*>/y;\nconst ATTRIBUTE = /(\\s+)([^\\s=>/]+)(\\s*=\\s*)(?:\"([^\"]*)\"|'([^']*)')/g;\n\ninterface OpenElement {\n\t/** The name as written in the output. */\n\tname: string;\n\t/** A `qti-rubric-block` whose `qti-content-body` is open, or still to open. */\n\trubric?: { opened: boolean };\n}\n\n/** The QTI 3.0 name of a QTI 2.x element; HTML and unknown names are kept. */\nexport function qti3ElementName(qti2Name: string): string {\n\tif (QTI3_HTML_ELEMENTS.has(qti2Name)) return qti2Name;\n\tconst native = elementMapper.toNative(qti2Name.toLowerCase());\n\treturn native.startsWith('qti-') ? native : qti2Name;\n}\n\n/** The QTI 3.0 name of a QTI 2.x attribute: kebab-case for a QTI camelCase name, else unchanged. */\nexport function qti3AttributeName(qti2Name: string): string {\n\tif (!/[A-Z]/.test(qti2Name) || qti2Name.includes(':') || qti2Name.startsWith('data-')) return qti2Name;\n\treturn QTI3_ATTRIBUTE_BY_QTI2.get(qti2Name) ?? qti2Name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);\n}\n\n/** A QTI 2.x response-processing template URI in its QTI 3.0 form; other URIs are kept. */\nexport function qti3TemplateUri(uri: string): string {\n\tconst match = QTI2_RPTEMPLATE.exec(uri.trim());\n\treturn match ? `${QTI3_RPTEMPLATE_BASE}${match[1]}.xml` : uri;\n}\n\n/** Convert a QTI 2.x item, test or stimulus document to QTI 3.0. */\nexport function convertQti2ToQti3(xml: string): string {\n\tconst out: string[] = [];\n\tconst stack: OpenElement[] = [];\n\tlet foreignDepth = 0;\n\tlet index = 0;\n\tlet rootSeen = false;\n\n\tconst rubric = (): OpenElement['rubric'] => stack[stack.length - 1]?.rubric;\n\t/** Open the rubric's content body before content that is not a leading stylesheet. */\n\tconst openContentBody = (): void => {\n\t\tconst open = rubric();\n\t\tif (open && !open.opened) {\n\t\t\tout.push('<qti-content-body>');\n\t\t\topen.opened = true;\n\t\t}\n\t};\n\n\twhile (index < xml.length) {\n\t\tconst lt = xml.indexOf('<', index);\n\t\tif (lt === -1) {\n\t\t\tout.push(xml.slice(index));\n\t\t\tbreak;\n\t\t}\n\t\tif (lt > index) {\n\t\t\tconst text = xml.slice(index, lt);\n\t\t\tif (foreignDepth === 0 && text.trim()) openContentBody();\n\t\t\tout.push(text);\n\t\t}\n\n\t\tconst special = specialToken(xml, lt);\n\t\tif (special !== undefined) {\n\t\t\tif (foreignDepth === 0 && !xml.startsWith('<?', lt) && !xml.startsWith('<!--', lt)) openContentBody();\n\t\t\tout.push(xml.slice(lt, special));\n\t\t\tindex = special;\n\t\t\tcontinue;\n\t\t}\n\n\t\tEND_TAG.lastIndex = lt;\n\t\tconst end = END_TAG.exec(xml);\n\t\tif (end) {\n\t\t\tindex = END_TAG.lastIndex;\n\t\t\tif (foreignDepth > 0) {\n\t\t\t\tforeignDepth -= 1;\n\t\t\t\tout.push(end[0]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst open = stack.pop();\n\t\t\tif (!open) throw new Error(`Unexpected </${end[1]}> at offset ${lt}`);\n\t\t\tif (open.rubric) out.push(open.rubric.opened ? '</qti-content-body>' : '<qti-content-body/>');\n\t\t\tout.push(`</${open.name}>`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tSTART_TAG.lastIndex = lt;\n\t\tconst start = START_TAG.exec(xml);\n\t\tif (!start) throw new Error(`Malformed markup at offset ${lt}`);\n\t\tindex = START_TAG.lastIndex;\n\t\tconst [tag, name, attrs, space, selfClosing] = start as unknown as [string, string, string, string, string];\n\n\t\tif (foreignDepth > 0) {\n\t\t\tif (!selfClosing) foreignDepth += 1;\n\t\t\tout.push(tag);\n\t\t\tcontinue;\n\t\t}\n\t\tif (isForeign(name, attrs)) {\n\t\t\topenContentBody();\n\t\t\trootSeen = true;\n\t\t\tif (!selfClosing) foreignDepth = 1;\n\t\t\tout.push(tag);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst qti3Name = qti3ElementName(name);\n\t\tif (qti3Name !== 'qti-stylesheet') openContentBody();\n\t\tconst element: OpenElement = { name: qti3Name };\n\t\tlet converted = convertAttributes(attrs, !rootSeen);\n\t\trootSeen = true;\n\t\tif (qti3Name === 'qti-rubric-block') {\n\t\t\tconverted = withRubricUse(converted);\n\t\t\telement.rubric = { opened: false };\n\t\t}\n\t\tif (selfClosing) {\n\t\t\tout.push(\n\t\t\t\telement.rubric\n\t\t\t\t\t? `<${qti3Name}${converted}><qti-content-body/></${qti3Name}>`\n\t\t\t\t\t: `<${qti3Name}${converted}${space}/>`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tout.push(`<${qti3Name}${converted}${space}>`);\n\t\tstack.push(element);\n\t}\n\n\tif (stack.length > 0 || foreignDepth > 0) {\n\t\tthrow new Error(`Unclosed <${stack[stack.length - 1]?.name ?? 'element'}>`);\n\t}\n\treturn out.join('');\n}\n\n/** The end offset of a comment, CDATA section, processing instruction or doctype at `at`. */\nfunction specialToken(xml: string, at: number): number | undefined {\n\tconst close = (marker: string, open: string): number => {\n\t\tconst found = xml.indexOf(marker, at + open.length);\n\t\tif (found === -1) throw new Error(`Unterminated ${open} at offset ${at}`);\n\t\treturn found + marker.length;\n\t};\n\tif (xml.startsWith('<!--', at)) return close('-->', '<!--');\n\tif (xml.startsWith('<![CDATA[', at)) return close(']]>', '<![CDATA[');\n\tif (xml.startsWith('<?', at)) return close('?>', '<?');\n\tif (xml.startsWith('<!', at)) return close('>', '<!');\n\treturn undefined;\n}\n\nfunction isForeign(name: string, attrs: string): boolean {\n\tif (name.includes(':') || FOREIGN_ROOTS.has(name)) return true;\n\tfor (const match of attrs.matchAll(ATTRIBUTE)) {\n\t\tif (match[2] === 'xmlns' && !QTI2_NAMESPACES.has((match[4] ?? match[5] ?? '').trim())) return true;\n\t}\n\treturn false;\n}\n\nfunction convertAttributes(attrs: string, isRoot: boolean): string {\n\treturn attrs.replace(ATTRIBUTE, (_match, lead: string, name: string, eq: string, dq?: string, sq?: string) => {\n\t\tconst quote = dq === undefined ? \"'\" : '\"';\n\t\tlet value = dq ?? sq ?? '';\n\t\tif (name === 'xmlns' && QTI2_NAMESPACES.has(value.trim())) value = QTI3_NAMESPACE;\n\t\telse if (name === 'template') value = qti3TemplateUri(value);\n\t\telse if (isRoot && name === 'xsi:schemaLocation') value = qti3SchemaLocation(value);\n\t\treturn `${lead}${qti3AttributeName(name)}${eq}${quote}${value}${quote}`;\n\t});\n}\n\n/** `xsi:schemaLocation` with the QTI 2.x namespace pair replaced by the 3.0 ASI schema. */\nfunction qti3SchemaLocation(value: string): string {\n\tconst parts = value.trim().split(/\\s+/);\n\tconst pairs: string[] = [];\n\tfor (let i = 0; i + 1 < parts.length; i += 2) {\n\t\tconst [namespace, location] = [parts[i] as string, parts[i + 1] as string];\n\t\tpairs.push(\n\t\t\tQTI2_NAMESPACES.has(namespace) ? `${QTI3_NAMESPACE} ${QTI3_ASI_SCHEMA_LOCATION}` : `${namespace} ${location}`,\n\t\t);\n\t}\n\treturn pairs.join(' ');\n}\n\n/** A rubric block's attributes with `use`, which QTI 3.0 requires, defaulted from `view`. */\nfunction withRubricUse(attrs: string): string {\n\tconst names = [...attrs.matchAll(ATTRIBUTE)].map((match) => match[2]);\n\tif (names.includes('use')) return attrs;\n\tconst view = [...attrs.matchAll(ATTRIBUTE)].find((match) => match[2] === 'view');\n\tconst views = (view?.[4] ?? view?.[5] ?? '').split(/\\s+/);\n\treturn `${attrs} use=\"${views.includes('scorer') ? 'scoring' : 'instructions'}\"`;\n}\n"]}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* QTI 3.0 element name mappings: every `qti-*` element of the 1EdTech QTI 3.0 ASI schema,
|
|
3
|
+
* mapped to its lowercase canonical name. `qti3-xsd-conformance.test.ts` checks the map
|
|
4
|
+
* against the schema vendored in `schemas/qti3/`, in both directions.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
* All QTI 3.0 elements use kebab-case with 'qti-' prefix.
|
|
6
|
-
*
|
|
7
|
-
* This file documents 172 QTI 3.0 elements providing 100% coverage of the official
|
|
8
|
-
* specification including all interactions, processing rules, expressions, and
|
|
9
|
-
* accessibility features.
|
|
6
|
+
* XHTML and HTML5 content elements keep their unprefixed names in QTI 3 and are not listed.
|
|
10
7
|
*/
|
|
11
8
|
/**
|
|
12
9
|
* Core assessment structure elements
|
|
@@ -21,6 +18,30 @@ export declare const CORE_ELEMENTS: {
|
|
|
21
18
|
readonly 'qti-assessment-item-ref': "assessmentitemref";
|
|
22
19
|
readonly 'qti-assessment-stimulus-ref': "assessmentstimulusref";
|
|
23
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Test structure elements
|
|
23
|
+
*/
|
|
24
|
+
export declare const TEST_STRUCTURE_ELEMENTS: {
|
|
25
|
+
readonly 'qti-assessment-section-ref': "assessmentsectionref";
|
|
26
|
+
readonly 'qti-item-session-control': "itemsessioncontrol";
|
|
27
|
+
readonly 'qti-time-limits': "timelimits";
|
|
28
|
+
readonly 'qti-selection': "selection";
|
|
29
|
+
readonly 'qti-ordering': "ordering";
|
|
30
|
+
readonly 'qti-branch-rule': "branchrule";
|
|
31
|
+
readonly 'qti-pre-condition': "precondition";
|
|
32
|
+
readonly 'qti-test-feedback': "testfeedback";
|
|
33
|
+
readonly 'qti-template-default': "templatedefault";
|
|
34
|
+
readonly 'qti-variable-mapping': "variablemapping";
|
|
35
|
+
readonly 'qti-weight': "weight";
|
|
36
|
+
readonly 'qti-outcome-processing-fragment': "outcomeprocessingfragment";
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Shared stimulus elements
|
|
40
|
+
*/
|
|
41
|
+
export declare const STIMULUS_ELEMENTS: {
|
|
42
|
+
readonly 'qti-assessment-stimulus': "assessmentstimulus";
|
|
43
|
+
readonly 'qti-stimulus-body': "stimulusbody";
|
|
44
|
+
};
|
|
24
45
|
/**
|
|
25
46
|
* Variable declaration elements
|
|
26
47
|
*/
|
|
@@ -79,7 +100,6 @@ export declare const INTERACTION_CHILD_ELEMENTS: {
|
|
|
79
100
|
readonly 'qti-gap': "gap";
|
|
80
101
|
readonly 'qti-gap-text': "gaptext";
|
|
81
102
|
readonly 'qti-gap-img': "gapimg";
|
|
82
|
-
readonly 'qti-gap-choice': "gapchoice";
|
|
83
103
|
readonly 'qti-hotspot-choice': "hotspotchoice";
|
|
84
104
|
readonly 'qti-associable-hotspot': "associablehotspot";
|
|
85
105
|
readonly 'qti-hottext': "hottext";
|
|
@@ -193,10 +213,9 @@ export declare const EXPRESSION_ELEMENTS: {
|
|
|
193
213
|
readonly 'qti-number-presented': "numberpresented";
|
|
194
214
|
readonly 'qti-number-responded': "numberresponded";
|
|
195
215
|
readonly 'qti-number-selected': "numberselected";
|
|
196
|
-
readonly 'qti-
|
|
216
|
+
readonly 'qti-integer-to-float': "integertofloat";
|
|
197
217
|
readonly 'qti-duration-gte': "durationgte";
|
|
198
218
|
readonly 'qti-duration-lt': "durationlt";
|
|
199
|
-
readonly 'qti-duration-lte': "durationlte";
|
|
200
219
|
};
|
|
201
220
|
/**
|
|
202
221
|
* Feedback elements
|
|
@@ -206,7 +225,6 @@ export declare const FEEDBACK_ELEMENTS: {
|
|
|
206
225
|
readonly 'qti-feedback-block': "feedbackblock";
|
|
207
226
|
readonly 'qti-feedback-inline': "feedbackinline";
|
|
208
227
|
readonly 'qti-rubric-block': "rubricblock";
|
|
209
|
-
readonly 'qti-modal-feedback-ok': "modalfeedbackok";
|
|
210
228
|
};
|
|
211
229
|
/**
|
|
212
230
|
* PCI (Portable Custom Interaction) elements
|
|
@@ -215,8 +233,6 @@ export declare const PCI_ELEMENTS: {
|
|
|
215
233
|
readonly 'qti-interaction-modules': "interactionmodules";
|
|
216
234
|
readonly 'qti-interaction-module': "interactionmodule";
|
|
217
235
|
readonly 'qti-interaction-markup': "interactionmarkup";
|
|
218
|
-
readonly 'qti-interaction-hook': "interactionhook";
|
|
219
|
-
readonly 'qti-interaction-config': "interactionconfig";
|
|
220
236
|
};
|
|
221
237
|
/**
|
|
222
238
|
* Catalog elements (accessibility support)
|
|
@@ -237,17 +253,71 @@ export declare const CONTENT_ELEMENTS: {
|
|
|
237
253
|
readonly 'qti-context-variable': "contextvariable";
|
|
238
254
|
readonly 'qti-template-variable': "templatevariable";
|
|
239
255
|
readonly 'qti-stylesheet': "stylesheet";
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Companion materials (calculators, rulers, protractors, reference material)
|
|
259
|
+
*/
|
|
260
|
+
export declare const COMPANION_MATERIAL_ELEMENTS: {
|
|
240
261
|
readonly 'qti-companion-materials-info': "companionmaterialsinfo";
|
|
262
|
+
readonly 'qti-calculator': "calculator";
|
|
263
|
+
readonly 'qti-calculator-info': "calculatorinfo";
|
|
264
|
+
readonly 'qti-calculator-type': "calculatortype";
|
|
265
|
+
readonly 'qti-description': "description";
|
|
266
|
+
readonly 'qti-digital-material': "digitalmaterial";
|
|
267
|
+
readonly 'qti-physical-material': "physicalmaterial";
|
|
268
|
+
readonly 'qti-label': "label";
|
|
269
|
+
readonly 'qti-protractor': "protractor";
|
|
270
|
+
readonly 'qti-rule': "rule";
|
|
271
|
+
readonly 'qti-rule-system-si': "rulesystemsi";
|
|
272
|
+
readonly 'qti-rule-system-us': "rulesystemus";
|
|
273
|
+
readonly 'qti-increment-si': "incrementsi";
|
|
274
|
+
readonly 'qti-increment-us': "incrementus";
|
|
275
|
+
readonly 'qti-major-increment': "majorincrement";
|
|
276
|
+
readonly 'qti-minor-increment': "minorincrement";
|
|
277
|
+
readonly 'qti-minimum-length': "minimumlength";
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Adaptive delivery and metadata references
|
|
281
|
+
*/
|
|
282
|
+
export declare const REFERENCE_ELEMENTS: {
|
|
283
|
+
readonly 'qti-adaptive-selection': "adaptiveselection";
|
|
284
|
+
readonly 'qti-adaptive-engine-ref': "adaptiveengineref";
|
|
285
|
+
readonly 'qti-adaptive-settings-ref': "adaptivesettingsref";
|
|
286
|
+
readonly 'qti-metadata-ref': "metadataref";
|
|
287
|
+
readonly 'qti-usagedata-ref': "usagedataref";
|
|
288
|
+
readonly 'qti-resource-icon': "resourceicon";
|
|
241
289
|
};
|
|
242
290
|
/**
|
|
243
291
|
* Complete mapping of all QTI 3.0 elements to canonical form
|
|
244
292
|
*/
|
|
245
293
|
export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
294
|
+
readonly 'qti-adaptive-selection': "adaptiveselection";
|
|
295
|
+
readonly 'qti-adaptive-engine-ref': "adaptiveengineref";
|
|
296
|
+
readonly 'qti-adaptive-settings-ref': "adaptivesettingsref";
|
|
297
|
+
readonly 'qti-metadata-ref': "metadataref";
|
|
298
|
+
readonly 'qti-usagedata-ref': "usagedataref";
|
|
299
|
+
readonly 'qti-resource-icon': "resourceicon";
|
|
300
|
+
readonly 'qti-companion-materials-info': "companionmaterialsinfo";
|
|
301
|
+
readonly 'qti-calculator': "calculator";
|
|
302
|
+
readonly 'qti-calculator-info': "calculatorinfo";
|
|
303
|
+
readonly 'qti-calculator-type': "calculatortype";
|
|
304
|
+
readonly 'qti-description': "description";
|
|
305
|
+
readonly 'qti-digital-material': "digitalmaterial";
|
|
306
|
+
readonly 'qti-physical-material': "physicalmaterial";
|
|
307
|
+
readonly 'qti-label': "label";
|
|
308
|
+
readonly 'qti-protractor': "protractor";
|
|
309
|
+
readonly 'qti-rule': "rule";
|
|
310
|
+
readonly 'qti-rule-system-si': "rulesystemsi";
|
|
311
|
+
readonly 'qti-rule-system-us': "rulesystemus";
|
|
312
|
+
readonly 'qti-increment-si': "incrementsi";
|
|
313
|
+
readonly 'qti-increment-us': "incrementus";
|
|
314
|
+
readonly 'qti-major-increment': "majorincrement";
|
|
315
|
+
readonly 'qti-minor-increment': "minorincrement";
|
|
316
|
+
readonly 'qti-minimum-length': "minimumlength";
|
|
246
317
|
readonly 'qti-printed-variable': "printedvariable";
|
|
247
318
|
readonly 'qti-context-variable': "contextvariable";
|
|
248
319
|
readonly 'qti-template-variable': "templatevariable";
|
|
249
320
|
readonly 'qti-stylesheet': "stylesheet";
|
|
250
|
-
readonly 'qti-companion-materials-info': "companionmaterialsinfo";
|
|
251
321
|
readonly 'qti-catalog': "catalog";
|
|
252
322
|
readonly 'qti-catalog-info': "cataloginfo";
|
|
253
323
|
readonly 'qti-card': "card";
|
|
@@ -257,13 +327,10 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
257
327
|
readonly 'qti-interaction-modules': "interactionmodules";
|
|
258
328
|
readonly 'qti-interaction-module': "interactionmodule";
|
|
259
329
|
readonly 'qti-interaction-markup': "interactionmarkup";
|
|
260
|
-
readonly 'qti-interaction-hook': "interactionhook";
|
|
261
|
-
readonly 'qti-interaction-config': "interactionconfig";
|
|
262
330
|
readonly 'qti-modal-feedback': "modalfeedback";
|
|
263
331
|
readonly 'qti-feedback-block': "feedbackblock";
|
|
264
332
|
readonly 'qti-feedback-inline': "feedbackinline";
|
|
265
333
|
readonly 'qti-rubric-block': "rubricblock";
|
|
266
|
-
readonly 'qti-modal-feedback-ok': "modalfeedbackok";
|
|
267
334
|
readonly 'qti-variable': "variable";
|
|
268
335
|
readonly 'qti-correct': "correct";
|
|
269
336
|
readonly 'qti-default': "default";
|
|
@@ -325,10 +392,9 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
325
392
|
readonly 'qti-number-presented': "numberpresented";
|
|
326
393
|
readonly 'qti-number-responded': "numberresponded";
|
|
327
394
|
readonly 'qti-number-selected': "numberselected";
|
|
328
|
-
readonly 'qti-
|
|
395
|
+
readonly 'qti-integer-to-float': "integertofloat";
|
|
329
396
|
readonly 'qti-duration-gte': "durationgte";
|
|
330
397
|
readonly 'qti-duration-lt': "durationlt";
|
|
331
|
-
readonly 'qti-duration-lte': "durationlte";
|
|
332
398
|
readonly 'qti-outcome-processing': "outcomeprocessing";
|
|
333
399
|
readonly 'qti-outcome-condition': "outcomecondition";
|
|
334
400
|
readonly 'qti-outcome-if': "outcomeif";
|
|
@@ -363,7 +429,6 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
363
429
|
readonly 'qti-gap': "gap";
|
|
364
430
|
readonly 'qti-gap-text': "gaptext";
|
|
365
431
|
readonly 'qti-gap-img': "gapimg";
|
|
366
|
-
readonly 'qti-gap-choice': "gapchoice";
|
|
367
432
|
readonly 'qti-hotspot-choice': "hotspotchoice";
|
|
368
433
|
readonly 'qti-associable-hotspot': "associablehotspot";
|
|
369
434
|
readonly 'qti-hottext': "hottext";
|
|
@@ -406,6 +471,20 @@ export declare const QTI3_ELEMENT_MAPPINGS: {
|
|
|
406
471
|
readonly 'qti-match-table-entry': "matchtableentry";
|
|
407
472
|
readonly 'qti-interpolation-table': "interpolationtable";
|
|
408
473
|
readonly 'qti-interpolation-table-entry': "interpolationtableentry";
|
|
474
|
+
readonly 'qti-assessment-stimulus': "assessmentstimulus";
|
|
475
|
+
readonly 'qti-stimulus-body': "stimulusbody";
|
|
476
|
+
readonly 'qti-assessment-section-ref': "assessmentsectionref";
|
|
477
|
+
readonly 'qti-item-session-control': "itemsessioncontrol";
|
|
478
|
+
readonly 'qti-time-limits': "timelimits";
|
|
479
|
+
readonly 'qti-selection': "selection";
|
|
480
|
+
readonly 'qti-ordering': "ordering";
|
|
481
|
+
readonly 'qti-branch-rule': "branchrule";
|
|
482
|
+
readonly 'qti-pre-condition': "precondition";
|
|
483
|
+
readonly 'qti-test-feedback': "testfeedback";
|
|
484
|
+
readonly 'qti-template-default': "templatedefault";
|
|
485
|
+
readonly 'qti-variable-mapping': "variablemapping";
|
|
486
|
+
readonly 'qti-weight': "weight";
|
|
487
|
+
readonly 'qti-outcome-processing-fragment': "outcomeprocessingfragment";
|
|
409
488
|
readonly 'qti-assessment-item': "assessmentitem";
|
|
410
489
|
readonly 'qti-assessment-test': "assessmenttest";
|
|
411
490
|
readonly 'qti-item-body': "itembody";
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* QTI 3.0 element name mappings: every `qti-*` element of the 1EdTech QTI 3.0 ASI schema,
|
|
3
|
+
* mapped to its lowercase canonical name. `qti3-xsd-conformance.test.ts` checks the map
|
|
4
|
+
* against the schema vendored in `schemas/qti3/`, in both directions.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
* All QTI 3.0 elements use kebab-case with 'qti-' prefix.
|
|
6
|
-
*
|
|
7
|
-
* This file documents 172 QTI 3.0 elements providing 100% coverage of the official
|
|
8
|
-
* specification including all interactions, processing rules, expressions, and
|
|
9
|
-
* accessibility features.
|
|
6
|
+
* XHTML and HTML5 content elements keep their unprefixed names in QTI 3 and are not listed.
|
|
10
7
|
*/
|
|
11
8
|
/**
|
|
12
9
|
* Core assessment structure elements
|
|
@@ -21,6 +18,30 @@ export const CORE_ELEMENTS = {
|
|
|
21
18
|
'qti-assessment-item-ref': 'assessmentitemref',
|
|
22
19
|
'qti-assessment-stimulus-ref': 'assessmentstimulusref',
|
|
23
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Test structure elements
|
|
23
|
+
*/
|
|
24
|
+
export const TEST_STRUCTURE_ELEMENTS = {
|
|
25
|
+
'qti-assessment-section-ref': 'assessmentsectionref',
|
|
26
|
+
'qti-item-session-control': 'itemsessioncontrol',
|
|
27
|
+
'qti-time-limits': 'timelimits',
|
|
28
|
+
'qti-selection': 'selection',
|
|
29
|
+
'qti-ordering': 'ordering',
|
|
30
|
+
'qti-branch-rule': 'branchrule',
|
|
31
|
+
'qti-pre-condition': 'precondition',
|
|
32
|
+
'qti-test-feedback': 'testfeedback',
|
|
33
|
+
'qti-template-default': 'templatedefault',
|
|
34
|
+
'qti-variable-mapping': 'variablemapping',
|
|
35
|
+
'qti-weight': 'weight',
|
|
36
|
+
'qti-outcome-processing-fragment': 'outcomeprocessingfragment',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Shared stimulus elements
|
|
40
|
+
*/
|
|
41
|
+
export const STIMULUS_ELEMENTS = {
|
|
42
|
+
'qti-assessment-stimulus': 'assessmentstimulus',
|
|
43
|
+
'qti-stimulus-body': 'stimulusbody',
|
|
44
|
+
};
|
|
24
45
|
/**
|
|
25
46
|
* Variable declaration elements
|
|
26
47
|
*/
|
|
@@ -81,7 +102,6 @@ export const INTERACTION_CHILD_ELEMENTS = {
|
|
|
81
102
|
'qti-gap': 'gap',
|
|
82
103
|
'qti-gap-text': 'gaptext',
|
|
83
104
|
'qti-gap-img': 'gapimg',
|
|
84
|
-
'qti-gap-choice': 'gapchoice',
|
|
85
105
|
'qti-hotspot-choice': 'hotspotchoice',
|
|
86
106
|
'qti-associable-hotspot': 'associablehotspot',
|
|
87
107
|
'qti-hottext': 'hottext',
|
|
@@ -204,11 +224,11 @@ export const EXPRESSION_ELEMENTS = {
|
|
|
204
224
|
'qti-number-presented': 'numberpresented',
|
|
205
225
|
'qti-number-responded': 'numberresponded',
|
|
206
226
|
'qti-number-selected': 'numberselected',
|
|
207
|
-
//
|
|
208
|
-
'qti-
|
|
227
|
+
// Type conversion
|
|
228
|
+
'qti-integer-to-float': 'integertofloat',
|
|
229
|
+
// Duration operators (QTI 2 durationGTE and durationLT)
|
|
209
230
|
'qti-duration-gte': 'durationgte',
|
|
210
231
|
'qti-duration-lt': 'durationlt',
|
|
211
|
-
'qti-duration-lte': 'durationlte',
|
|
212
232
|
};
|
|
213
233
|
/**
|
|
214
234
|
* Feedback elements
|
|
@@ -218,7 +238,6 @@ export const FEEDBACK_ELEMENTS = {
|
|
|
218
238
|
'qti-feedback-block': 'feedbackblock',
|
|
219
239
|
'qti-feedback-inline': 'feedbackinline',
|
|
220
240
|
'qti-rubric-block': 'rubricblock',
|
|
221
|
-
'qti-modal-feedback-ok': 'modalfeedbackok',
|
|
222
241
|
};
|
|
223
242
|
/**
|
|
224
243
|
* PCI (Portable Custom Interaction) elements
|
|
@@ -227,8 +246,6 @@ export const PCI_ELEMENTS = {
|
|
|
227
246
|
'qti-interaction-modules': 'interactionmodules',
|
|
228
247
|
'qti-interaction-module': 'interactionmodule',
|
|
229
248
|
'qti-interaction-markup': 'interactionmarkup',
|
|
230
|
-
'qti-interaction-hook': 'interactionhook',
|
|
231
|
-
'qti-interaction-config': 'interactionconfig',
|
|
232
249
|
};
|
|
233
250
|
/**
|
|
234
251
|
* Catalog elements (accessibility support)
|
|
@@ -249,13 +266,47 @@ export const CONTENT_ELEMENTS = {
|
|
|
249
266
|
'qti-context-variable': 'contextvariable',
|
|
250
267
|
'qti-template-variable': 'templatevariable',
|
|
251
268
|
'qti-stylesheet': 'stylesheet',
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Companion materials (calculators, rulers, protractors, reference material)
|
|
272
|
+
*/
|
|
273
|
+
export const COMPANION_MATERIAL_ELEMENTS = {
|
|
252
274
|
'qti-companion-materials-info': 'companionmaterialsinfo',
|
|
275
|
+
'qti-calculator': 'calculator',
|
|
276
|
+
'qti-calculator-info': 'calculatorinfo',
|
|
277
|
+
'qti-calculator-type': 'calculatortype',
|
|
278
|
+
'qti-description': 'description',
|
|
279
|
+
'qti-digital-material': 'digitalmaterial',
|
|
280
|
+
'qti-physical-material': 'physicalmaterial',
|
|
281
|
+
'qti-label': 'label',
|
|
282
|
+
'qti-protractor': 'protractor',
|
|
283
|
+
'qti-rule': 'rule',
|
|
284
|
+
'qti-rule-system-si': 'rulesystemsi',
|
|
285
|
+
'qti-rule-system-us': 'rulesystemus',
|
|
286
|
+
'qti-increment-si': 'incrementsi',
|
|
287
|
+
'qti-increment-us': 'incrementus',
|
|
288
|
+
'qti-major-increment': 'majorincrement',
|
|
289
|
+
'qti-minor-increment': 'minorincrement',
|
|
290
|
+
'qti-minimum-length': 'minimumlength',
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Adaptive delivery and metadata references
|
|
294
|
+
*/
|
|
295
|
+
export const REFERENCE_ELEMENTS = {
|
|
296
|
+
'qti-adaptive-selection': 'adaptiveselection',
|
|
297
|
+
'qti-adaptive-engine-ref': 'adaptiveengineref',
|
|
298
|
+
'qti-adaptive-settings-ref': 'adaptivesettingsref',
|
|
299
|
+
'qti-metadata-ref': 'metadataref',
|
|
300
|
+
'qti-usagedata-ref': 'usagedataref',
|
|
301
|
+
'qti-resource-icon': 'resourceicon',
|
|
253
302
|
};
|
|
254
303
|
/**
|
|
255
304
|
* Complete mapping of all QTI 3.0 elements to canonical form
|
|
256
305
|
*/
|
|
257
306
|
export const QTI3_ELEMENT_MAPPINGS = {
|
|
258
307
|
...CORE_ELEMENTS,
|
|
308
|
+
...TEST_STRUCTURE_ELEMENTS,
|
|
309
|
+
...STIMULUS_ELEMENTS,
|
|
259
310
|
...DECLARATION_ELEMENTS,
|
|
260
311
|
...INTERACTION_ELEMENTS,
|
|
261
312
|
...INTERACTION_CHILD_ELEMENTS,
|
|
@@ -267,6 +318,8 @@ export const QTI3_ELEMENT_MAPPINGS = {
|
|
|
267
318
|
...PCI_ELEMENTS,
|
|
268
319
|
...CATALOG_ELEMENTS,
|
|
269
320
|
...CONTENT_ELEMENTS,
|
|
321
|
+
...COMPANION_MATERIAL_ELEMENTS,
|
|
322
|
+
...REFERENCE_ELEMENTS,
|
|
270
323
|
};
|
|
271
324
|
/**
|
|
272
325
|
* Get canonical name for a QTI 3.0 element
|