Skip to content

Commit

Permalink
Add special treatment of template repos
Browse files Browse the repository at this point in the history
  • Loading branch information
snomos committed Oct 24, 2023
1 parent 3b2c28c commit a588186
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SharedResources.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ domCore.appendChild(addRepoTable({{core_repos}}, 'giella-', ['maturity']))

<script>
const domTempl = document.querySelector('#templ');
domTempl.appendChild(addRepoTable({{template_repos}}, 'template-', []))
domTempl.appendChild(addTemplateTable({{template_repos}}, 'template-', []))
</script>
56 changes: 56 additions & 0 deletions assets/js/langtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8280,3 +8280,59 @@ function addDictTR(repo) {

return row;
}

function addTemplateTable(repos, mainFilter, filters) {
let table = document.createElement('table');
let thead = document.createElement('thead');
let tbody = document.createElement('tbody');

table.appendChild(thead);
table.appendChild(tbody);
thead.appendChild(addTableHeader());

for (const repo of repos) {
if (repo.name.startsWith(mainFilter)) {
if (filters === null || filters.length === 0) {
tbody.appendChild(addTemplTR(repo));
} else {
if (doesTopicsHaveSomeFilter(repo.topics, filters)) {
tbody.appendChild(addTemplTR(repo));
}
}
}
}
// If no repos found, inform the user:
if (!tbody.firstChild) {
tbody.appendChild(addEmptyRow());
}
return table;
}

function addTemplTR(repo) {
let row = document.createElement('tr');

let row_lang = document.createElement('td');
row_lang.appendChild(addr(reponame2templatename(repo.name), repo.name + '/'));

row.appendChild(row_lang);
row.appendChild(addRepo(repo));
row.appendChild(addRLicense(repo));
row.appendChild(addIssues(repo));
row.appendChild(addRDoc(repo));
row.appendChild(addCI(repo));

return row;
}

function reponame2templatename(reponame) {
parts = reponame.split('-');
return code2templatename[parts[2]]
}

const code2templatename {
"corpus": "Corpora",
"dict": "Dictionaries",
"keyboard": "Keyboards",
"lang": "Language models",
"shared": "Shared resources"
}

0 comments on commit a588186

Please sign in to comment.