@learnosity/lib-qti-converter 0.14.0 → 0.15.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/docs/EXAMPLES.md +13 -11
- package/docs/GETTING_STARTED.md +11 -0
- package/docs/QTI_METADATA_TO_TAGS.md +47 -4
- package/docs/TAGS_TO_QTI_METADATA.md +8 -7
- package/package.json +1 -1
- package/packages/cli/dist/{batchProcessors-DWG8qk7G.js → batchProcessors-B6Xmhfaz.js} +6 -2
- package/packages/cli/dist/{batchProcessors-DWG8qk7G.js.map → batchProcessors-B6Xmhfaz.js.map} +1 -1
- package/packages/cli/dist/batchWorker.js +1 -1
- package/packages/cli/dist/{learnosityToQti-C7cTRTU2.js → learnosityToQti-hFKA3KnZ.js} +4 -4
- package/packages/cli/dist/{learnosityToQti-C7cTRTU2.js.map → learnosityToQti-hFKA3KnZ.js.map} +1 -1
- package/packages/cli/dist/{learnosityToQtiPackage-C84dQKKi.js → learnosityToQtiPackage-DI7bYisT.js} +4 -4
- package/packages/cli/dist/{learnosityToQtiPackage-C84dQKKi.js.map → learnosityToQtiPackage-DI7bYisT.js.map} +1 -1
- package/packages/cli/dist/main.js +4 -4
- package/packages/cli/dist/{pathUtils-Cr9IcK0n.js → pathUtils-DkptaCiz.js} +13 -3
- package/packages/cli/dist/{pathUtils-Cr9IcK0n.js.map → pathUtils-DkptaCiz.js.map} +1 -1
- package/packages/cli/dist/{qtiPackageToLearnosity-BBfZgWBh.js → qtiPackageToLearnosity-JDifZn8o.js} +12 -6
- package/packages/cli/dist/qtiPackageToLearnosity-JDifZn8o.js.map +1 -0
- package/packages/cli/dist/{qtiToLearnosity-C9OW_n7Z.js → qtiToLearnosity-Be0s-5Dr.js} +6 -5
- package/packages/cli/dist/qtiToLearnosity-Be0s-5Dr.js.map +1 -0
- package/packages/cli/dist/{resolveOptions-D_UECo_9.js → resolveOptions-BotCofhl.js} +13 -4
- package/packages/cli/dist/resolveOptions-BotCofhl.js.map +1 -0
- package/packages/cli/dist/{table-D1ydwhbX.js → table-DlY4LGmL.js} +91 -40
- package/packages/cli/dist/table-DlY4LGmL.js.map +1 -0
- package/packages/core/dist/index.d.ts +3 -0
- package/packages/core/dist/index.js +94 -39
- package/packages/core/dist/node.d.ts +5 -0
- package/packages/core/dist/node.js +95 -39
- package/packages/cli/dist/qtiPackageToLearnosity-BBfZgWBh.js.map +0 -1
- package/packages/cli/dist/qtiToLearnosity-C9OW_n7Z.js.map +0 -1
- package/packages/cli/dist/resolveOptions-D_UECo_9.js.map +0 -1
- package/packages/cli/dist/table-D1ydwhbX.js.map +0 -1
|
@@ -22899,6 +22899,34 @@ function md5hex(input) {
|
|
|
22899
22899
|
return hex;
|
|
22900
22900
|
}
|
|
22901
22901
|
//#endregion
|
|
22902
|
+
//#region ../core/src/qti-to-learnosity/utils/generateQuestionReference.ts
|
|
22903
|
+
/**
|
|
22904
|
+
* Shared utility for generating Learnosity question references.
|
|
22905
|
+
*/
|
|
22906
|
+
/**
|
|
22907
|
+
* Generate a Learnosity question reference from the resolved item reference and
|
|
22908
|
+
* the question's position within that item.
|
|
22909
|
+
*
|
|
22910
|
+
* The reference is `md5hex(`${itemRef}_${index}`)`, which guarantees it is both
|
|
22911
|
+
* unique (scoped to the item plus the per-item ordinal) and repeatable.
|
|
22912
|
+
*
|
|
22913
|
+
* - `itemRef` is the ALREADY-RESOLVED Learnosity item reference. Because it is
|
|
22914
|
+
* resolved upstream, the question reference automatically inherits the user's
|
|
22915
|
+
* `--item-reference-source` choice (item `identifier`, a `uuid`, or the source
|
|
22916
|
+
* filename) without this helper needing to re-read that option.
|
|
22917
|
+
* - `index` is the question's 1-BASED ordinal WITHIN the item. It is reset per
|
|
22918
|
+
* item, not a global counter: the first question in an item is `1`, the second
|
|
22919
|
+
* `2`, and so on. Single-question items always use `1` (a lone question is
|
|
22920
|
+
* `_1`), so there is no bare, unsuffixed variant.
|
|
22921
|
+
*
|
|
22922
|
+
* @param itemRef Resolved Learnosity item reference.
|
|
22923
|
+
* @param index 1-based ordinal of the question within the item.
|
|
22924
|
+
* @returns A 32-character lowercase hex MD5 question reference.
|
|
22925
|
+
*/
|
|
22926
|
+
function generateQuestionReference(itemRef, index) {
|
|
22927
|
+
return md5hex(`${itemRef}_${index}`);
|
|
22928
|
+
}
|
|
22929
|
+
//#endregion
|
|
22902
22930
|
//#region ../core/src/qti-to-learnosity/utils/mediaFeature.ts
|
|
22903
22931
|
/**
|
|
22904
22932
|
* Build a stable UUID-shaped identifier for a media feature.
|
|
@@ -23422,7 +23450,7 @@ function convertMatchToLearnosity(inputXml, diagnostics, lomTags, organisationId
|
|
|
23422
23450
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
23423
23451
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
23424
23452
|
};
|
|
23425
|
-
const questionRef =
|
|
23453
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
23426
23454
|
const stems = parsed.stems.map((stem) => transformAssetUrls(stem.text, {
|
|
23427
23455
|
organisationId,
|
|
23428
23456
|
mediaVault,
|
|
@@ -23844,7 +23872,7 @@ function convertGapMatchToLearnosity(inputXml, diagnostics, lomTags, organisatio
|
|
|
23844
23872
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
23845
23873
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
23846
23874
|
};
|
|
23847
|
-
const questionRef =
|
|
23875
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
23848
23876
|
const possibleResponses = parsed.gapTexts.map((gt) => transformAssetUrls(gt.text, {
|
|
23849
23877
|
organisationId,
|
|
23850
23878
|
mediaVault,
|
|
@@ -24312,7 +24340,7 @@ function convertInlineChoiceToLearnosity(inputXml, diagnostics, lomTags, organis
|
|
|
24312
24340
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
24313
24341
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
24314
24342
|
};
|
|
24315
|
-
const questionRef =
|
|
24343
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
24316
24344
|
const possibleResponses = parsed.interactions.map((interaction) => interaction.choices.map((choice) => transformAssetUrls(choice.text, transformOpts)));
|
|
24317
24345
|
const validationValue = buildValidationValues(parsed.interactions, parsed.responseDeclarations, diagnostics, transformOpts, sourceFile);
|
|
24318
24346
|
if (!validationValue) return { diagnostics };
|
|
@@ -24591,7 +24619,7 @@ function convertOrderToLearnosity(inputXml, diagnostics, lomTags, organisationId
|
|
|
24591
24619
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
24592
24620
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
24593
24621
|
};
|
|
24594
|
-
const questionRef =
|
|
24622
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
24595
24623
|
const stimulus = transformAssetUrls(parsed.stimulusText ?? "", {
|
|
24596
24624
|
organisationId,
|
|
24597
24625
|
mediaVault,
|
|
@@ -25042,7 +25070,7 @@ function convertHotspotToLearnosity(inputXml, diagnostics, lomTags, organisation
|
|
|
25042
25070
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
25043
25071
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
25044
25072
|
};
|
|
25045
|
-
const questionRef =
|
|
25073
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
25046
25074
|
const stimulus = buildHotspotStimulus(parsed, organisationId, mediaVault, customAssetUrl, transformContext);
|
|
25047
25075
|
const imageSource = organisationId ? transformUrl(parsed.imageSource, organisationId, mediaVault, customAssetUrl, transformContext) : parsed.imageSource;
|
|
25048
25076
|
const areas = [];
|
|
@@ -25340,7 +25368,7 @@ function convertHottextToLearnosity(inputXml, diagnostics, lomTags, organisation
|
|
|
25340
25368
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
25341
25369
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
25342
25370
|
};
|
|
25343
|
-
const questionRef =
|
|
25371
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
25344
25372
|
if (parsed.shuffle) diagnostics.push({
|
|
25345
25373
|
code: DiagnosticCode.QTI_SHUFFLE_NOT_SUPPORTED,
|
|
25346
25374
|
level: "warning",
|
|
@@ -25852,8 +25880,9 @@ function convertMcqToLearnosity(inputXml, diagnostics, lomTags, sourceFile, orga
|
|
|
25852
25880
|
const questions = [];
|
|
25853
25881
|
const widgets = [];
|
|
25854
25882
|
const questionSpans = [];
|
|
25855
|
-
for (
|
|
25856
|
-
const
|
|
25883
|
+
for (let i = 0; i < parsed.interactions.length; i++) {
|
|
25884
|
+
const interaction = parsed.interactions[i];
|
|
25885
|
+
const questionRef = generateQuestionReference(itemRef, i + 1);
|
|
25857
25886
|
const stimulus = interaction.stimulusText ? transformAssetUrls(interaction.stimulusText, {
|
|
25858
25887
|
organisationId,
|
|
25859
25888
|
mediaVault,
|
|
@@ -26297,7 +26326,7 @@ function convertShorttextToLearnosity(parsed, diagnostics, lomTags, organisation
|
|
|
26297
26326
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
26298
26327
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
26299
26328
|
};
|
|
26300
|
-
const questionRef =
|
|
26329
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
26301
26330
|
const stimulus = normalizeFinalText(transformAssetUrls((parsed.templateText || "").replace(/{{response}}(?:\s*<\/[^>]+>)*\s*$/, "").trim(), {
|
|
26302
26331
|
organisationId,
|
|
26303
26332
|
mediaVault,
|
|
@@ -26391,7 +26420,7 @@ function convertClozetextToLearnosity(parsed, diagnostics, lomTags, organisation
|
|
|
26391
26420
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
26392
26421
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
26393
26422
|
};
|
|
26394
|
-
const questionRef =
|
|
26423
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
26395
26424
|
const stimulus = parsed.stimulusText ? normalizeFinalText(transformAssetUrls(parsed.stimulusText, {
|
|
26396
26425
|
organisationId,
|
|
26397
26426
|
mediaVault,
|
|
@@ -26641,7 +26670,7 @@ function readAssessmentItemExtendedText(inputXml) {
|
|
|
26641
26670
|
/**
|
|
26642
26671
|
* Build multi-interaction extended text item (multiple longtextV2 questions)
|
|
26643
26672
|
*/
|
|
26644
|
-
function buildMultiExtendedTextItem(parsed,
|
|
26673
|
+
function buildMultiExtendedTextItem(parsed, _inputXml, stimulusOverride, diagnostics, lomTags, organisationId, mediaVault, customAssetUrl, itemReferenceSource, sourceFile, assetTransformContext) {
|
|
26645
26674
|
const itemRef = assetTransformContext?.finalItemReference ?? generateItemReference(parsed.identifier ?? "unknown", itemReferenceSource, sourceFile);
|
|
26646
26675
|
const transformContext = {
|
|
26647
26676
|
finalItemReference: itemRef,
|
|
@@ -26651,9 +26680,8 @@ function buildMultiExtendedTextItem(parsed, inputXml, stimulusOverride, diagnost
|
|
|
26651
26680
|
const questions = [];
|
|
26652
26681
|
const widgets = [];
|
|
26653
26682
|
const questionSpans = [];
|
|
26654
|
-
const responseIdentifiers = extractResponseIdentifiers(inputXml, "extendedTextInteraction");
|
|
26655
26683
|
for (let i = 0; i < stimulusOverride.length; i++) {
|
|
26656
|
-
const questionRef =
|
|
26684
|
+
const questionRef = generateQuestionReference(itemRef, i + 1);
|
|
26657
26685
|
const stimulus = transformAssetUrls(stimulusOverride[i], {
|
|
26658
26686
|
organisationId,
|
|
26659
26687
|
mediaVault,
|
|
@@ -26695,16 +26723,6 @@ function buildMultiExtendedTextItem(parsed, inputXml, stimulusOverride, diagnost
|
|
|
26695
26723
|
};
|
|
26696
26724
|
}
|
|
26697
26725
|
/**
|
|
26698
|
-
* Extract responseIdentifier values from interactions in XML
|
|
26699
|
-
*/
|
|
26700
|
-
function extractResponseIdentifiers(inputXml, interactionTag) {
|
|
26701
|
-
const responseIdentifiers = [];
|
|
26702
|
-
const interactionPattern = new RegExp(`<${assertXmlTagName(interactionTag)}[^>]+responseIdentifier=["']([^"']+)["']`, "g");
|
|
26703
|
-
let match;
|
|
26704
|
-
while ((match = interactionPattern.exec(inputXml)) !== null) responseIdentifiers.push(match[1]);
|
|
26705
|
-
return responseIdentifiers;
|
|
26706
|
-
}
|
|
26707
|
-
/**
|
|
26708
26726
|
* Convert extended text (extendedTextInteraction) to Learnosity longtextV2
|
|
26709
26727
|
* TASK 036: Added stimulusOverride parameter for composite items
|
|
26710
26728
|
*/
|
|
@@ -26720,7 +26738,7 @@ function convertExtendedTextToLearnosity(inputXml, diagnostics, lomTags, sourceF
|
|
|
26720
26738
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
26721
26739
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
26722
26740
|
};
|
|
26723
|
-
const questionRef =
|
|
26741
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
26724
26742
|
const stimulusRaw = stimulusOverride && stimulusOverride.length === 1 ? stimulusOverride[0] : parsed.stimulusText;
|
|
26725
26743
|
const stimulus = stimulusRaw ? transformAssetUrls(stimulusRaw, {
|
|
26726
26744
|
organisationId,
|
|
@@ -27096,7 +27114,7 @@ function convertGraphicGapMatchToLearnosity(inputXml, diagnostics, _lomTags, org
|
|
|
27096
27114
|
};
|
|
27097
27115
|
});
|
|
27098
27116
|
const validationValue = buildValidationValue$1(parsed.hotspots, parsed.correctPairs, gapImgIdToResponse);
|
|
27099
|
-
const questionRef =
|
|
27117
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
27100
27118
|
const question = {
|
|
27101
27119
|
type: "imageclozeassociationV2",
|
|
27102
27120
|
image: {
|
|
@@ -27470,7 +27488,7 @@ function convertDrawingToLearnosity(inputXml, diagnostics, lomTags, organisation
|
|
|
27470
27488
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
27471
27489
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
27472
27490
|
};
|
|
27473
|
-
const questionRef =
|
|
27491
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
27474
27492
|
const questionData = { type: "drawing" };
|
|
27475
27493
|
const stimulus = buildDrawingStimulus(parsed, organisationId, mediaVault, customAssetUrl, transformContext);
|
|
27476
27494
|
if (stimulus !== void 0) questionData.stimulus = stimulus;
|
|
@@ -27783,7 +27801,7 @@ function convertAssociationToLearnosity(inputXml, diagnostics, lomTags, organisa
|
|
|
27783
27801
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
27784
27802
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
27785
27803
|
};
|
|
27786
|
-
const questionRef =
|
|
27804
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
27787
27805
|
const stimulus = transformAssetUrls(parsed.stimulusText ? `<p>${parsed.stimulusText}</p>` : "", {
|
|
27788
27806
|
organisationId,
|
|
27789
27807
|
mediaVault,
|
|
@@ -28250,6 +28268,7 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
|
|
|
28250
28268
|
}
|
|
28251
28269
|
const allQuestions = [];
|
|
28252
28270
|
const allWidgets = [];
|
|
28271
|
+
let placeholderRefCounter = 0;
|
|
28253
28272
|
const processResult = (result, subDiagnostics) => {
|
|
28254
28273
|
if (result.item) {
|
|
28255
28274
|
allQuestions.push(...result.item.questions);
|
|
@@ -28306,7 +28325,7 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
|
|
|
28306
28325
|
if (groupEntries.length > 0) {
|
|
28307
28326
|
const correctResponses = [];
|
|
28308
28327
|
for (const entry of groupEntries) if (entry.correctResponse) correctResponses.push(entry.correctResponse);
|
|
28309
|
-
const questionRef =
|
|
28328
|
+
const questionRef = `__mixed_placeholder_${placeholderRefCounter++}`;
|
|
28310
28329
|
const templateParts = [];
|
|
28311
28330
|
const groupWrapperOpen = group.wrapperOpens[0];
|
|
28312
28331
|
if (groupWrapperOpen) templateParts.push(groupWrapperOpen);
|
|
@@ -28470,6 +28489,17 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
|
|
|
28470
28489
|
});
|
|
28471
28490
|
return { diagnostics };
|
|
28472
28491
|
}
|
|
28492
|
+
const reassignedWidgets = /* @__PURE__ */ new Set();
|
|
28493
|
+
allQuestions.forEach((question, idx) => {
|
|
28494
|
+
const oldRef = question.reference;
|
|
28495
|
+
const newRef = generateQuestionReference(itemRef, idx + 1);
|
|
28496
|
+
const widget = allWidgets.find((w) => w.widget_type === "response" && w.reference === oldRef && !reassignedWidgets.has(w));
|
|
28497
|
+
if (widget) {
|
|
28498
|
+
widget.reference = newRef;
|
|
28499
|
+
reassignedWidgets.add(widget);
|
|
28500
|
+
}
|
|
28501
|
+
question.reference = newRef;
|
|
28502
|
+
});
|
|
28473
28503
|
const allFeatures = [];
|
|
28474
28504
|
if (hasPassageContent(inputXml)) {
|
|
28475
28505
|
if (extractPassageFromItemBody(inputXml)) {
|
|
@@ -28744,6 +28774,18 @@ function readAssessmentItemPassage(inputXml) {
|
|
|
28744
28774
|
*/
|
|
28745
28775
|
const MAX_TAG_LENGTH = 255;
|
|
28746
28776
|
/**
|
|
28777
|
+
* Split a tag value on commas into separate trimmed values.
|
|
28778
|
+
*
|
|
28779
|
+
* When `splitCsvTags` is false the value is returned unchanged as a single
|
|
28780
|
+
* element. When true, the value is split on literal commas, each part is
|
|
28781
|
+
* trimmed, and empty parts (from leading/trailing/double commas) are dropped.
|
|
28782
|
+
* A value without a comma yields a single trimmed element.
|
|
28783
|
+
*/
|
|
28784
|
+
function splitTagValue(value, splitCsvTags) {
|
|
28785
|
+
if (!splitCsvTags) return [value];
|
|
28786
|
+
return value.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
|
|
28787
|
+
}
|
|
28788
|
+
/**
|
|
28747
28789
|
* Validate and optionally truncate tag types and tag names
|
|
28748
28790
|
*
|
|
28749
28791
|
* @param tags - Tags to validate
|
|
@@ -28805,9 +28847,10 @@ function validateAndProcessTags(tags, options = {}) {
|
|
|
28805
28847
|
* Extracts csm:labelledGUID entries as Learnosity tags
|
|
28806
28848
|
*
|
|
28807
28849
|
* @param metadataXml - XML containing Common Cartridge metadata
|
|
28850
|
+
* @param splitCsvTags - Split comma-separated GUID values into separate elements (default: true)
|
|
28808
28851
|
* @returns Tags object with type->name[] mapping
|
|
28809
28852
|
*/
|
|
28810
|
-
function parseCommonCartridgeTags(metadataXml) {
|
|
28853
|
+
function parseCommonCartridgeTags(metadataXml, splitCsvTags = true) {
|
|
28811
28854
|
const tags = {};
|
|
28812
28855
|
const stack = [];
|
|
28813
28856
|
let inLabel = false;
|
|
@@ -28836,7 +28879,7 @@ function parseCommonCartridgeTags(metadataXml) {
|
|
|
28836
28879
|
inLabel = false;
|
|
28837
28880
|
} else if (localName === "GUID" && inGuid) {
|
|
28838
28881
|
const guidValue = textBuf.join("").trim();
|
|
28839
|
-
if (currentLabel && guidValue) addTagValue(tags, currentLabel, guidValue);
|
|
28882
|
+
if (currentLabel && guidValue) addTagValue(tags, currentLabel, guidValue, splitCsvTags);
|
|
28840
28883
|
inGuid = false;
|
|
28841
28884
|
} else if (localName === "labelledGUID") currentLabel = "";
|
|
28842
28885
|
stack.pop();
|
|
@@ -28848,17 +28891,23 @@ function parseCommonCartridgeTags(metadataXml) {
|
|
|
28848
28891
|
return tags;
|
|
28849
28892
|
}
|
|
28850
28893
|
/**
|
|
28851
|
-
* Add a tag value to the tags object
|
|
28894
|
+
* Add a tag value to the tags object, splitting comma-separated values when
|
|
28895
|
+
* enabled and deduplicating in insertion order.
|
|
28896
|
+
*
|
|
28897
|
+
* @param splitCsvTags - Split a comma-separated value into separate elements (default: true)
|
|
28852
28898
|
*/
|
|
28853
|
-
function addTagValue(tags, source, value) {
|
|
28854
|
-
tags[source] = tags[source] ?? [];
|
|
28855
|
-
if (!
|
|
28899
|
+
function addTagValue(tags, source, value, splitCsvTags = true) {
|
|
28900
|
+
const existing = tags[source] = tags[source] ?? [];
|
|
28901
|
+
for (const part of splitTagValue(value, splitCsvTags)) if (!existing.includes(part)) existing.push(part);
|
|
28856
28902
|
}
|
|
28857
28903
|
/**
|
|
28858
28904
|
* Parse LOM XML and extract tags for Learnosity
|
|
28859
28905
|
* Extracts classification/taxonPath entries grouped by source langstring
|
|
28906
|
+
*
|
|
28907
|
+
* @param lomXml - XML containing LOM metadata
|
|
28908
|
+
* @param splitCsvTags - Split comma-separated taxon entry values into separate elements (default: true)
|
|
28860
28909
|
*/
|
|
28861
|
-
function parseLomXml(lomXml) {
|
|
28910
|
+
function parseLomXml(lomXml, splitCsvTags = true) {
|
|
28862
28911
|
const tags = {};
|
|
28863
28912
|
const stack = [];
|
|
28864
28913
|
let inTaxonPathSource = false;
|
|
@@ -28890,7 +28939,7 @@ function parseLomXml(lomXml) {
|
|
|
28890
28939
|
inTaxonPathSource = false;
|
|
28891
28940
|
} else if (inTaxonEntry) {
|
|
28892
28941
|
const value = textBuf.join("").trim();
|
|
28893
|
-
if (value && currentSource) addTagValue(tags, currentSource, value);
|
|
28942
|
+
if (value && currentSource) addTagValue(tags, currentSource, value, splitCsvTags);
|
|
28894
28943
|
inTaxonEntry = false;
|
|
28895
28944
|
}
|
|
28896
28945
|
}
|
|
@@ -28915,8 +28964,9 @@ function parseLomXml(lomXml) {
|
|
|
28915
28964
|
* @returns Merged tags object and diagnostics
|
|
28916
28965
|
*/
|
|
28917
28966
|
function parseMetadataTags(metadataXml, options = {}) {
|
|
28918
|
-
const
|
|
28919
|
-
const
|
|
28967
|
+
const splitCsvTags = options.splitCsvTags ?? true;
|
|
28968
|
+
const lomTags = parseLomXml(metadataXml, splitCsvTags);
|
|
28969
|
+
const ccTags = parseCommonCartridgeTags(metadataXml, splitCsvTags);
|
|
28920
28970
|
const mergedTags = { ...lomTags };
|
|
28921
28971
|
for (const [tagType, tagValues] of Object.entries(ccTags)) {
|
|
28922
28972
|
const values = tagValues;
|
|
@@ -28989,7 +29039,7 @@ function convertUploadToLearnosity(inputXml, diagnostics, lomTags, organisationI
|
|
|
28989
29039
|
preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
|
|
28990
29040
|
sourceHrefBase: assetTransformContext?.sourceHrefBase
|
|
28991
29041
|
};
|
|
28992
|
-
const questionRef =
|
|
29042
|
+
const questionRef = generateQuestionReference(itemRef, 1);
|
|
28993
29043
|
const questionData = { type: "fileupload" };
|
|
28994
29044
|
if (parsed.stimulus) try {
|
|
28995
29045
|
questionData.stimulus = transformAssetUrls(parsed.stimulus, {
|
|
@@ -29308,6 +29358,7 @@ function convertQtiAssessmentItemToLearnosity(inputXml, opts = {}) {
|
|
|
29308
29358
|
if (lomXml) try {
|
|
29309
29359
|
const tagResult = parseMetadataTags(lomXml, {
|
|
29310
29360
|
truncateTags: opts.truncateTags,
|
|
29361
|
+
splitCsvTags: opts.splitCsvTags,
|
|
29311
29362
|
filePath: opts.inputPath
|
|
29312
29363
|
});
|
|
29313
29364
|
lomTags = tagResult.tags;
|
|
@@ -31681,4 +31732,4 @@ function formatDiagnosticsSummaryTable(diagnostics) {
|
|
|
31681
31732
|
//#endregion
|
|
31682
31733
|
export { mapLearnosityToAst as C, DiagnosticCode as D, parseLearnosityItem as E, downgradeAssessmentTestToQti21 as S, sanitizeHtmlContent as T, md5hex as _, require_cli_table3 as a, serializeAssessmentItem as b, transformForwardAssetUrlsInXml as c, getAllPassageDataPaths as d, generateItemReference as f, serializeQtiAssetIdentity as g, selectQtiAssetFilename as h, chalk as i, convertQtiAssessmentItemToLearnosity as l, isSupportedQtiAssetPath as m, formatDiagnosticsSummaryTable as n, require_string_width as o, canonicalizeQtiAssetHref as p, formatDiagnosticsTable as r, writeDiagnostics as s, countErrors as t, parseMetadataTags as u, getAttr$3 as v, normalizeXhtmlVoidElements as w, escapeXml as x, require_saxes as y };
|
|
31683
31734
|
|
|
31684
|
-
//# sourceMappingURL=table-
|
|
31735
|
+
//# sourceMappingURL=table-DlY4LGmL.js.map
|