Skip to content

Commit

Permalink
Merge pull request #8110 from google/tags-sort
Browse files Browse the repository at this point in the history
tags.html: sort output alphabetically
  • Loading branch information
m4rc1e authored Aug 29, 2024
2 parents 5a9eec5 + 9ae7007 commit 72687ed
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .ci/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ <h1>Google Fonts Tagger</h1>
},
saveCSV() {
this.Families = this.Families.filter((t) => t.Family !== "");
this.Families = Array.from(this.Families).sort((a, b) => {
if (`${a.Family},${a['Group/Tag']}` < `${b.Family},${b['Group/Tag']}`) {
return -1;
}
if (`${a.Family},${a['Group/Tag']}` > `${b.Family},${b['Group/Tag']}`) {
return 1;
}
return 0;
});
let csv = Papa.unparse(this.Families,
{
columns: ["Family", "Group/Tag", "Weight"],
Expand All @@ -207,6 +216,15 @@ <h1>Google Fonts Tagger</h1>
},
prCSV() {
this.Families = this.Families.filter((t) => t.Family !== "");
this.Families = Array.from(this.Families).sort((a, b) => {
if (`${a.Family},${a['Group/Tag']}` < `${b.Family},${b['Group/Tag']}`) {
return -1;
}
if (`${a.Family},${a['Group/Tag']}` > `${b.Family},${b['Group/Tag']}`) {
return 1;
}
return 0;
});
let csv = Papa.unparse(this.Families,
{
columns: ["Family", "Group/Tag", "Weight"],
Expand Down

0 comments on commit 72687ed

Please sign in to comment.