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

227
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,26 +29878,47 @@ 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(
() => animations({
fileName,
animations: animated
.animations(),
}),
).then(
() => connections({
fileName,
connections: animated
.connections(),
}),
).then(
() => command({
fileName,
command: animated
.command(),
link: './',
}),
) )
.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({
fileName,
animations: animated
.animations(),
}),
).then(
() => connections({
fileName,
connections: animated
.connections(),
}),
)
.then(
() => command({
fileName,
command: animated
.command(),
link: './',
}),
)
.then( .then(
() => touch({ () => touch({
fileName, fileName,
@ -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,26 +30221,45 @@ 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(
() => animations({ () => {
fileName, const l1 = animated.xml().split(/\r?\n/)[0];
animations: animated const l = object.xml().split(/\r?\n/)
.animations(), .reduce(
}), (acc, line, index) => {
).then( if (line.indexOf(l1) > -1) {
() => connections({ return index;
fileName, }
connections: animated return acc;
.connections(), },
}), -1,
).then( );
() => command({ return external_fs_.promises.appendFile(
fileName, fileName,
command: animated `\n[xml](${'../'.repeat(fileName.split('/').length)}${file}#L${objectLine + l})\n`,
.command(), ).then(l + 1);
link: '../../displays/', },
}),
) )
.then(
() => animations({
fileName,
animations: animated
.animations(),
}),
).then(
() => connections({
fileName,
connections: animated
.connections(),
}),
).then(
() => command({
fileName,
command: animated
.command(),
link: '../../displays/',
}),
)
.then( .then(
() => touch({ () => touch({
fileName, fileName,
@ -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,28 +30306,44 @@ 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({ () => {
fileName: `${dir}/${object.id}.md`, const l1 = object.xml().split(/\r?\n/)[0];
object, const l = global.xml().split(/\r?\n/)
}), .reduce(
).then( (acc, line, index) => {
() => references({ if (line.indexOf(l1) > -1) {
fileName: `${dir}/${object.id}.md`, return index;
object, }
displays, return acc;
myDisplayFields, },
}), -1,
).then( );
() => animated({ return external_fs_.promises.appendFile(
fileName: `${dir}/${object.id}.md`, fileName,
object, `\n[xml](${'../'.repeat(fileName.split('/').length)}${global.file}#L${l + 1})\n`,
}), ).then(l + 1);
},
) )
.then( .then(
() => external_fs_.promises.appendFile( (l) => objects_parameters({
`${dir}/${object.id}.md`, fileName: `${dir}/${object.id}.md`,
`\n## xml\n\n\`\`\`xml\n${object.xml()}\n\`\`\`\n`, object,
), }).then(
() => references({
fileName: `${dir}/${object.id}.md`,
object,
displays,
myDisplayFields,
}),
)
.then(
() => animated({
file: object.file,
line: l,
fileName: `${dir}/${object.id}.md`,
object,
}),
),
), ),
), ),
), ),
@ -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'),
) )