diff --git a/source/_data/miscellaneous.json b/source/_data/miscellaneous.json index 0321457..1480867 100644 --- a/source/_data/miscellaneous.json +++ b/source/_data/miscellaneous.json @@ -335,7 +335,7 @@ "description": "Federated, ActivityPub-compatible social network with friends, walls, and groups.", "codeLanguage": "Java", "techStack": "", - "license": "Unlicense (public domain)", + "license": "Public domain", "FediAccount": "@grishka@mastodon.social", "apClass": true, "zotClass": false, @@ -677,7 +677,7 @@ "description": "Federating guild website using GuildWars2 API.", "codeLanguage": "Go", "techStack": "", - "license": "-", + "license": "Unknown", "FediAccount": "@ben@mastodon.lubar.me", "apClass": true, "zotClass": false, @@ -731,7 +731,7 @@ "description": "A distributed social network by ActivityPub specification co-author Christopher Lemmer Webber.", "codeLanguage": "Racket", "techStack": "", - "license": "Apache-2", + "license": "Apache-2.0", "FediAccount": "@spritelyproject@octodon.social", "apClass": true, "zotClass": false, @@ -1289,7 +1289,7 @@ "description": "ActivityPub compliant, Mastodon-compatible transit alerts generated from GTFS-realtime Service Alerts", "codeLanguage": "Typescript", "techStack": "", - "license": "", + "license": "Unknown", "FediAccount": "", "apClass": true, "zotClass": false, @@ -1343,7 +1343,7 @@ "description": "Minimal ActivityPub server built with Laravel.", "codeLanguage": "PHP", "techStack": "Laravel", - "license": "-", + "license": "Unknown", "FediAccount": "@bugle@bugle.lol", "apClass": true, "zotClass": false, @@ -1397,7 +1397,7 @@ "description": "Social networking platform compatible with Mastodon, Pleroma, etc.", "codeLanguage": "Rust", "techStack": "Svelte", - "license": "-", + "license": "Unknown", "FediAccount": "", "apClass": true, "zotClass": false, diff --git a/themes/starter/layout/miscellaneous.ejs b/themes/starter/layout/miscellaneous.ejs index 654b58a..979f9a0 100644 --- a/themes/starter/layout/miscellaneous.ejs +++ b/themes/starter/layout/miscellaneous.ejs @@ -3,28 +3,48 @@ layout: layout --- <% - function langCount(arr) { - let langs = []; + // function langCount(arr) { + // let langs = []; + // arr.forEach(function(item) { + // let lang = item.codeLanguage; + // if (!lang) {return}; + // let check = langs.findIndex(function(x) {return x.language === lang}); + // if (check>=0) { + // langs[check].count +=1; + // } else { + // let newLang = {}; + // newLang.language = lang; + // newLang.count = 1; + // langs.push(newLang); + // } + // }); + // return langs; + // } + + function groupByKey(arr, key) { + let results = []; arr.forEach(function(item) { - let lang = item.codeLanguage; - if (!lang) {return}; - let check = langs.findIndex(function(x) {return x.language === lang}); + let keyValue = item[key]; + if (!keyValue) {return}; + let check = results.findIndex(function(x) {return x.name === keyValue}); if (check>=0) { - langs[check].count +=1; + results[check].count +=1; } else { - let newLang = {}; - newLang.language = lang; - newLang.count = 1; - langs.push(newLang); + let newGroup = {}; + newGroup.name = keyValue; + newGroup.count = 1; + results.push(newGroup); } }); - return langs; + return results; } const apps = site.data.miscellaneous.apps; - const langList = langCount(apps).sort((a,b) => b.count - a.count); + const langList = groupByKey(apps, "codeLanguage").sort((a,b) => b.count - a.count); + const licenseList = groupByKey(apps, "license").sort((a,b) => b.count - a.count); const byCategory = [['snMacro', 'Social network (macro)'], ['snMicro', 'Social network (micro)'], ['blogPub', 'Blog and Publishing'], ['media', 'Media sharing'], ['links', 'Link sharing'], ['evMeet', 'Events and Meetups'], ['files', 'File hosting'], ['data', 'Open data'], ['reviews', 'Reviewing'], ['games', 'Gaming'], ['dev', 'Software development'], ['extend', 'Extensions'], ['forums', 'Forums, boards'], ['other', 'Other']]; const byProtocol = [['sortDiaspora', 'diaspora'], ['sortZot', 'Zot'], ['sortAP', 'ActivityPub'], ['sortOstatus', 'OStatus']]; + const pattern = /[\s0.-]/g; %> <%- partial('_partial/heroheader') %> @@ -46,7 +66,13 @@ layout: layout

Sort by code language:

<% for (i in langList) { %> - + + <% } %> + +

Sort by license:

+ + <% for (i in licenseList) { %> + <% } %>
@@ -54,7 +80,7 @@ layout: layout <% let type = apps[item].categories %> <% let lang = apps[item].codeLanguage.toLowerCase() %> -