Skip to content

Commit

Permalink
Merge pull request #12666 from keymanapp/fix/developer/package-compil…
Browse files Browse the repository at this point in the history
…er-box-info-fields

fix(developer): box package compiler info fields
  • Loading branch information
mcdurdin authored Nov 25, 2024
2 parents 2f401f5 + b0000ae commit c80a0ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions developer/src/common/web/utils/src/types/kps/kps-file-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ export class KpsFileReader {
boxXmlArray(data.Package?.StartMenu?.Items, 'Item');
boxXmlArray(data.Package?.Strings, 'String');

if(data.Package?.Info) {
// If no properties are defined on an <Info> subitem, then it will be a
// string, and needs to be boxed into a KpsInfoItem object
const info: any = data.Package.Info;
for(const k of Object.keys(info)) {
if(typeof info[k] == 'string') {
info[k] = { _: info[k], $: { URL: '' } };
}
}
}

return data;
}
};
4 changes: 2 additions & 2 deletions developer/src/kmc-package/src/compiler/kmp-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ export class KmpCompiler implements KeymanCompiler {
];

for (let [src,dst,isMarkdown] of keys) {
if (kpsInfo[src]) {
if (kpsInfo[src]?._ && (kpsInfo[src]._.trim() || kpsInfo[src].$?.URL)) {
kmpInfo[dst] = {
description: (kpsInfo[src]._ ?? (typeof kpsInfo[src] == 'string' ? kpsInfo[src].toString() : '')).trim()
description: (kpsInfo[src]._ ?? '').trim()
};
if(isMarkdown) {
kmpInfo[dst].description = markdownToHTML(kmpInfo[dst].description, false).trim();
Expand Down

0 comments on commit c80a0ae

Please sign in to comment.