Skip to content

Commit af55da1

Browse files
committed
Sort rows and fixed qs escaping
1 parent 6ebc0a4 commit af55da1

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

dist/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21247,12 +21247,16 @@ async function main() {
2124721247
});
2124821248
});
2124921249

21250-
rows.forEach((row) => {
21251-
const category = row.properties[category_schema_entry[0]][0][0];
21252-
if (!category) throw new Error('Each row must have a category value');
21253-
const category_value = categories_map.get(category);
21254-
category_value.items.push(row.properties);
21255-
});
21250+
rows
21251+
.sort((rowA, rowB) =>
21252+
rowA.properties.title[0][0] > rowB.properties.title[0][0] ? 1 : -1
21253+
)
21254+
.forEach((row) => {
21255+
const category = row.properties[category_schema_entry[0]][0][0];
21256+
if (!category) throw new Error('Each row must have a category value');
21257+
const category_value = categories_map.get(category);
21258+
category_value.items.push(row.properties);
21259+
});
2125621260

2125721261
const newLines = [];
2125821262

@@ -21264,13 +21268,13 @@ async function main() {
2126421268
];
2126521269
category_info.items.forEach((item) =>
2126621270
content.push(
21267-
`<img src="https://img.shields.io/badge/-${qs.stringify(
21271+
`<img src="https://img.shields.io/badge/-${qs.escape(
2126821272
item.title[0][0]
2126921273
)}-${
2127021274
item[color_schema_entry[0]][0][0]
21271-
}?style=flat-square&amp;logo=${qs.stringify(
21275+
}?style=flat-square&amp;logo=${qs.escape(item.title[0][0])}" alt="${
2127221276
item.title[0][0]
21273-
)}" alt="${item.title[0][0]}"/>`
21277+
}"/>`
2127421278
)
2127521279
);
2127621280
newLines.push(...content, '<hr>');

src/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,16 @@ async function main() {
137137
});
138138
});
139139

140-
rows.forEach((row) => {
141-
const category = row.properties[category_schema_entry[0]][0][0];
142-
if (!category) throw new Error('Each row must have a category value');
143-
const category_value = categories_map.get(category);
144-
category_value.items.push(row.properties);
145-
});
140+
rows
141+
.sort((rowA, rowB) =>
142+
rowA.properties.title[0][0] > rowB.properties.title[0][0] ? 1 : -1
143+
)
144+
.forEach((row) => {
145+
const category = row.properties[category_schema_entry[0]][0][0];
146+
if (!category) throw new Error('Each row must have a category value');
147+
const category_value = categories_map.get(category);
148+
category_value.items.push(row.properties);
149+
});
146150

147151
const newLines = [];
148152

@@ -154,13 +158,13 @@ async function main() {
154158
];
155159
category_info.items.forEach((item) =>
156160
content.push(
157-
`<img src="https://img.shields.io/badge/-${qs.stringify(
161+
`<img src="https://img.shields.io/badge/-${qs.escape(
158162
item.title[0][0]
159163
)}-${
160164
item[color_schema_entry[0]][0][0]
161-
}?style=flat-square&amp;logo=${qs.stringify(
165+
}?style=flat-square&amp;logo=${qs.escape(item.title[0][0])}" alt="${
162166
item.title[0][0]
163-
)}" alt="${item.title[0][0]}"/>`
167+
}"/>`
164168
)
165169
);
166170
newLines.push(...content, '<hr>');

0 commit comments

Comments
 (0)