Improve API docgen sorting
This commit is contained in:
@ -12,8 +12,21 @@ const files = proc.execFileSync(
|
|||||||
|
|
||||||
console.log('.API');
|
console.log('.API');
|
||||||
|
|
||||||
for (const file of files) {
|
const links = files.map((file) => {
|
||||||
const doc = file.replace(baseDir, '');
|
const doc = file.replace(baseDir, '');
|
||||||
const title = path.parse(file).name;
|
const title = path.parse(file).name;
|
||||||
console.log(`* xref:${doc}[${startCase(title)}]`);
|
|
||||||
|
return {
|
||||||
|
xref: `* xref:${doc}[${startCase(title)}]`,
|
||||||
|
title,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Case-insensitive sort based on titles (so 'token/ERC20' gets sorted as 'erc20')
|
||||||
|
const sortedLinks = links.sort(function (a, b) {
|
||||||
|
return a.title.toLowerCase().localeCompare(b.title.toLowerCase());
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const link of sortedLinks) {
|
||||||
|
console.log(link.xref);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user