Skip to content

Commit 3d5929d

Browse files
committed
Add Version column to language model table
New column added between Repository and Lemma Count: - Created addVersion() function fetching badgedata/fst-version.json - Updated tablecommon.js addTableHeader() to include Version (10%) and Lemma Count (10%) when called from addLangRepoTable - Adjusted column widths to fit new column: * Issues: 15% → 12% * Doc CI: 16% → 14% * Version: 10% (new) * Lemma Count: 10% (was flexible, now fixed) - Increased table from 7 to 8 columns - Updated colspan and addEmptyRow calls to match new column count - Badge displays with label 'V' for version
1 parent b7f9139 commit 3d5929d

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

assets/js/langtable.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function addLangRepoTable(repos, mainFilter, filters) {
145145
if (!repos || !Array.isArray(repos)) {
146146
const errorRow = document.createElement('tr');
147147
const errorCell = document.createElement('td');
148-
errorCell.colSpan = 7; // Match number of columns in header (extra column for addLangRepoTable)
148+
errorCell.colSpan = 8; // Match number of columns in header (extra columns for addLangRepoTable)
149149
errorCell.innerHTML = '<strong>⚠️ GitHub repository data is temporarily unavailable</strong><br><em>This usually resolves automatically. Please try refreshing the page in a few minutes.</em>';
150150
errorCell.style.textAlign = 'center';
151151
errorCell.style.padding = '30px 20px';
@@ -171,7 +171,7 @@ function addLangRepoTable(repos, mainFilter, filters) {
171171
}
172172
// If no repos found, inform the user:
173173
if (!tbody.firstChild) {
174-
tbody.appendChild(addEmptyRow(7));
174+
tbody.appendChild(addEmptyRow(8));
175175
}
176176
return table;
177177
}
@@ -186,8 +186,9 @@ function addTR(repo, extraColumn = false) {
186186

187187
row.appendChild(row_lang);
188188
row.appendChild(addRepo(repo));
189-
// Add extra column if requested
189+
// Add extra columns if requested
190190
if (extraColumn) {
191+
row.appendChild(addVersion(repo));
191192
row.appendChild(addLemmaCount(repo));
192193
}
193194
row.appendChild(addIssues(repo));
@@ -200,6 +201,18 @@ function addTR(repo, extraColumn = false) {
200201

201202
// Lang-specific helper functions
202203

204+
function addVersion(repo) {
205+
let row_version = document.createElement('td');
206+
const version_image = document.createElement('img');
207+
version_image.setAttribute(
208+
'src',
209+
'https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgiellalt%2F' + repo.name + '%2Fgh-pages%2Fbadgedata%2Ffst-version.json&label=V'
210+
);
211+
version_image.setAttribute('alt', 'FST Version');
212+
row_version.appendChild(version_image);
213+
return row_version;
214+
}
215+
203216
function addLemmaCount(repo) {
204217
let row_lemmas = document.createElement('td');
205218
const lemma_image = document.createElement('img');

assets/js/tablecommon.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8334,10 +8334,10 @@ function addTableHeader(fromLangRepoTable = false) {
83348334

83358335
let heading_3 = document.createElement('th');
83368336
heading_3.innerHTML = 'Issues';
8337-
heading_3.setAttribute('style', 'width: 15%;');
8337+
heading_3.setAttribute('style', 'width: 12%;');
83388338
let heading_4 = document.createElement('th');
83398339
heading_4.innerHTML = 'Doc Ci';
8340-
heading_4.setAttribute('style', 'width: 16%;');
8340+
heading_4.setAttribute('style', 'width: 14%;');
83418341
let heading_5 = document.createElement('th');
83428342
heading_5.innerHTML = 'Core CI';
83438343
heading_5.setAttribute('style', 'width: 12%;');
@@ -8347,12 +8347,16 @@ function addTableHeader(fromLangRepoTable = false) {
83478347

83488348
row_1.appendChild(heading_1);
83498349
row_1.appendChild(heading_2);
8350-
// Add extra column only when called from addLangRepoTable
8350+
// Add extra columns only when called from addLangRepoTable
83518351
if (fromLangRepoTable) {
83528352
let heading_2a = document.createElement('th');
8353-
heading_2a.innerHTML = 'Lemma Count';
8354-
// heading_2a.setAttribute('style', 'width: 10%;');
8353+
heading_2a.innerHTML = 'Version';
8354+
heading_2a.setAttribute('style', 'width: 10%;');
83558355
row_1.appendChild(heading_2a);
8356+
let heading_2b = document.createElement('th');
8357+
heading_2b.innerHTML = 'Lemma Count';
8358+
heading_2b.setAttribute('style', 'width: 10%;');
8359+
row_1.appendChild(heading_2b);
83568360
}
83578361
row_1.appendChild(heading_3);
83588362
row_1.appendChild(heading_4);

0 commit comments

Comments
 (0)