4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-11-17 23:41:55 +01:00

html modlist sorting and opening in new tab

This commit is contained in:
LordMZTE 2020-05-02 18:59:38 +02:00
parent e91833cccc
commit 3b0df41008

View file

@ -186,6 +186,8 @@ public class Commands {
System.out.println("Delete " + htmlFile);
return;
}
ArrayList<ModInfo> mods = ModInfo.getModInfo();
Collections.sort(mods, Comparator.comparing(ModInfo :: getName));
ContainerTag table = body(
TagCreator.table(TagCreator.attrs("#mods"), TagCreator.tbody(
tr(td(b("Name")),
@ -193,7 +195,7 @@ public class Commands {
td(b("ID")),
td(b("Downloads"))
),
TagCreator.each(ModInfo.getModInfo(), i -> {
TagCreator.each(mods, i -> {
StringBuilder sb = new StringBuilder();
for(String author : i.getAuthors()) {
sb.append(author);
@ -202,7 +204,10 @@ public class Commands {
String authors = sb.toString();
authors = authors.substring(0, authors.length() - 2);
return tr(td(a(i.getName()).withHref(i.getLink())),
return tr(td(a(i.getName())
.withHref(i.getLink())
.withRel("noopener noreferrer")
.withTarget("_blank")),
td(authors),
td(String.valueOf(i.getId())),
td(String.valueOf(i.getDownloads())));