xml-links

This commit is contained in:
gilesb 2023-11-22 20:53:14 +00:00
parent be08436d62
commit 23b97a1322
1 changed files with 147 additions and 80 deletions

133
index.js
View File

@ -29402,6 +29402,7 @@ var lib_default = /*#__PURE__*/__nccwpck_require__.n(lib);
`${dir}/${name}`, `${dir}/${name}`,
).then( ).then(
(buffer) => ({ (buffer) => ({
file: `${dir}/${name}`,
name: external_path_default().basename(name, '.xml').toLowerCase(), name: external_path_default().basename(name, '.xml').toLowerCase(),
buffer, buffer,
}), }),
@ -29863,6 +29864,7 @@ const findDisplay = (line, link) => {
fileName, fileName,
myDisplayFields, myDisplayFields,
display, display,
xml,
}) => { }) => {
await external_fs_.promises.appendFile( await external_fs_.promises.appendFile(
fileName, fileName,
@ -29876,7 +29878,27 @@ const findDisplay = (line, link) => {
(animated) => () => external_fs_.promises.appendFile( (animated) => () => external_fs_.promises.appendFile(
fileName, fileName,
`\n### ${animated.name}\n\n *${animated.type}*\n`, `\n### ${animated.name}\n\n *${animated.type}*\n`,
).then( )
.then(
() => {
const l1 = animated.xml().split(/\r?\n/)[0];
const l = xml.split(/\r?\n/)
.reduce(
(acc, line, index) => {
if (line.indexOf(l1) > -1) {
return index;
}
return acc;
},
-1,
);
return external_fs_.promises.appendFile(
fileName,
`\n[xml](${'../'.repeat(fileName.split('/').length)}${display.file}#L${l + 1})\n`,
);
},
)
.then(
() => animations({ () => animations({
fileName, fileName,
animations: animated animations: animated
@ -29888,7 +29910,8 @@ const findDisplay = (line, link) => {
connections: animated connections: animated
.connections(), .connections(),
}), }),
).then( )
.then(
() => command({ () => command({
fileName, fileName,
command: animated command: animated
@ -29903,12 +29926,6 @@ const findDisplay = (line, link) => {
.touch(), .touch(),
link: './', link: './',
}), }),
)
.then(
() => external_fs_.promises.appendFile(
fileName,
`\n#### xml\n\n\`\`\`xml\n${animated.xml()}\n\`\`\`\n`,
),
), ),
), ),
); );
@ -30029,6 +30046,10 @@ const findDisplay = (line, link) => {
fileName, fileName,
`# ${display.name}\n\n*display*\n`, `# ${display.name}\n\n*display*\n`,
); );
await external_fs_.promises.appendFile(
fileName,
`\n[xml](${'../'.repeat(root.split('/').length)}${display.file})\n`,
);
await reference_objects({ await reference_objects({
fileName, fileName,
@ -30039,6 +30060,7 @@ const findDisplay = (line, link) => {
fileName, fileName,
display, display,
myDisplayFields, myDisplayFields,
xml: display.xml(),
}); });
await display_references({ await display_references({
fileName, fileName,
@ -30056,10 +30078,6 @@ const findDisplay = (line, link) => {
display, display,
myDisplayFields, myDisplayFields,
}); });
await external_fs_.promises.appendFile(
fileName,
`\n## xml\n\n\`\`\`xml\n${display.xml()}\n\`\`\`\n`,
);
}), }),
); );
}); });
@ -30183,6 +30201,8 @@ var ft_view_fields_build = __nccwpck_require__(3204);
// dir, // dir,
// myGlobalFields, // myGlobalFields,
object, object,
line: objectLine,
file,
}) => { }) => {
await external_fs_.promises.appendFile( await external_fs_.promises.appendFile(
fileName, fileName,
@ -30201,6 +30221,25 @@ var ft_view_fields_build = __nccwpck_require__(3204);
fileName, fileName,
`\n### ${animated.id} - ${animated.name} - ${animated.type}\n`, `\n### ${animated.id} - ${animated.name} - ${animated.type}\n`,
).then( ).then(
() => {
const l1 = animated.xml().split(/\r?\n/)[0];
const l = object.xml().split(/\r?\n/)
.reduce(
(acc, line, index) => {
if (line.indexOf(l1) > -1) {
return index;
}
return acc;
},
-1,
);
return external_fs_.promises.appendFile(
fileName,
`\n[xml](${'../'.repeat(fileName.split('/').length)}${file}#L${objectLine + l})\n`,
).then(l + 1);
},
)
.then(
() => animations({ () => animations({
fileName, fileName,
animations: animated animations: animated
@ -30228,12 +30267,6 @@ var ft_view_fields_build = __nccwpck_require__(3204);
.touch(), .touch(),
link: '../../displays/', link: '../../displays/',
}), }),
)
.then(
() => external_fs_.promises.appendFile(
fileName,
`\n#### xml\n\n\`\`\`xml\n${object.xml()}\n\`\`\`\n`,
),
), ),
), ),
); );
@ -30273,27 +30306,43 @@ var ft_view_fields_build = __nccwpck_require__(3204);
`${dir}/${object.id}.md`, `${dir}/${object.id}.md`,
`# ${object.id}\n\n*object*\n`, `# ${object.id}\n\n*object*\n`,
).then( ).then(
() => objects_parameters({ () => {
const l1 = object.xml().split(/\r?\n/)[0];
const l = global.xml().split(/\r?\n/)
.reduce(
(acc, line, index) => {
if (line.indexOf(l1) > -1) {
return index;
}
return acc;
},
-1,
);
return external_fs_.promises.appendFile(
fileName,
`\n[xml](${'../'.repeat(fileName.split('/').length)}${global.file}#L${l + 1})\n`,
).then(l + 1);
},
)
.then(
(l) => objects_parameters({
fileName: `${dir}/${object.id}.md`, fileName: `${dir}/${object.id}.md`,
object, object,
}), }).then(
).then(
() => references({ () => references({
fileName: `${dir}/${object.id}.md`, fileName: `${dir}/${object.id}.md`,
object, object,
displays, displays,
myDisplayFields, myDisplayFields,
}), }),
).then( )
.then(
() => animated({ () => animated({
file: object.file,
line: l,
fileName: `${dir}/${object.id}.md`, fileName: `${dir}/${object.id}.md`,
object, object,
}), }),
)
.then(
() => external_fs_.promises.appendFile(
`${dir}/${object.id}.md`,
`\n## xml\n\n\`\`\`xml\n${object.xml()}\n\`\`\`\n`,
), ),
), ),
), ),
@ -30334,6 +30383,7 @@ var ft_view_fields_build = __nccwpck_require__(3204);
); );
await Promise.all( await Promise.all(
globals.map(async (global) => { globals.map(async (global) => {
console.log(global.file);
await external_fs_.promises.appendFile( await external_fs_.promises.appendFile(
`${root}/globals/README.md`, `${root}/globals/README.md`,
`* [${global.name}](./${global.name})\n`, `* [${global.name}](./${global.name})\n`,
@ -30371,7 +30421,7 @@ var ft_view_fields_build = __nccwpck_require__(3204);
/* harmony default export */ const src_document = ((root) => async ({ /* harmony default export */ const src_document = (({ root }) => async ({
displays, displays,
globals, globals,
}) => { }) => {
@ -30418,14 +30468,27 @@ var ft_view_fields_build = __nccwpck_require__(3204);
const displayFolder = process.env.DISPLAYFOLDER || core.getInput('display-folder');
const displayExcludeFile = process.env.DISPLAYEXCLUDEFILE || core.getInput('display-exclude-file');
const root = process.env.FOLDER || core.getInput('folder');
const globalFolder = process.env.GLOBALFOLDER || core.getInput('global-folder');
const globalExcludeFile = process.env.GLOBALEXCLUDEFILE || core.getInput('global-exclude-file');
console.log({
displayFolder,
displayExcludeFile,
folder: root,
globalFolder,
globalExcludeFile,
});
data({ data({
dir: process.env.DISPLAYFOLDER || core.getInput('display-folder'), dir: displayFolder,
exclude: process.env.DISPLAYEXCLUDEFILE || core.getInput('display-exclude-file'), exclude: displayExcludeFile,
}) })
.then( .then(
(displays) => data({ (displays) => data({
dir: process.env.GLOBALFOLDER || core.getInput('global-folder'), dir: globalFolder,
exclude: process.env.GLOBALEXCLUDEFILE || core.getInput('global-exclude-file'), exclude: globalExcludeFile,
}) })
.then( .then(
(globals) => ({ (globals) => ({
@ -30434,7 +30497,11 @@ data({
}), }),
), ),
) )
.then(src_document(process.env.FOLDER || core.getInput('folder'))) .then(src_document({
root,
displayFolder,
globalFolder,
}))
.then( .then(
() => console.log('done'), () => console.log('done'),
) )