nitc :: Catalog :: table_packages
package_page
must have been called before so that information is computed.
# Produce a HTML table containig information on the packages
#
# `package_page` must have been called before so that information is computed.
fun table_packages(mpackages: Array[MPackage]): Template
do
alpha_comparator.sort(mpackages)
var res = new Template
res.add "<table data-toggle=\"table\" data-sort-name=\"name\" data-sort-order=\"desc\" width=\"100%\">\n"
res.add "<thead><tr>\n"
res.add "<th data-field=\"name\" data-sortable=\"true\">name</th>\n"
res.add "<th data-field=\"maint\" data-sortable=\"true\">maint</th>\n"
res.add "<th data-field=\"contrib\" data-sortable=\"true\">contrib</th>\n"
if deps.vertices.not_empty then
res.add "<th data-field=\"reqs\" data-sortable=\"true\">reqs</th>\n"
res.add "<th data-field=\"dreqs\" data-sortable=\"true\">direct<br>reqs</th>\n"
res.add "<th data-field=\"cli\" data-sortable=\"true\">clients</th>\n"
res.add "<th data-field=\"dcli\" data-sortable=\"true\">direct<br>clients</th>\n"
end
res.add "<th data-field=\"mod\" data-sortable=\"true\">modules</th>\n"
res.add "<th data-field=\"cla\" data-sortable=\"true\">classes</th>\n"
res.add "<th data-field=\"met\" data-sortable=\"true\">methods</th>\n"
res.add "<th data-field=\"loc\" data-sortable=\"true\">lines</th>\n"
res.add "<th data-field=\"score\" data-sortable=\"true\">score</th>\n"
res.add "<th data-field=\"errors\" data-sortable=\"true\">errors</th>\n"
res.add "<th data-field=\"warnings\" data-sortable=\"true\">warnings</th>\n"
res.add "<th data-field=\"warnings_per_kloc\" data-sortable=\"true\">w/kloc</th>\n"
res.add "<th data-field=\"doc\" data-sortable=\"true\">doc</th>\n"
res.add "</tr></thead>"
for p in mpackages do
res.add "<tr>"
res.add "<td><a href=\"p/{p.name}.html\">{p.name}</a></td>"
var maint = "?"
if p.metadata.maintainers.not_empty then maint = p.metadata.maintainers.first.name.html_escape
res.add "<td>{maint}</td>"
res.add "<td>{p.metadata.contributors.length}</td>"
if deps.vertices.not_empty then
res.add "<td>{deps.get_all_successors(p).length-1}</td>"
res.add "<td>{deps.successors(p).length}</td>"
res.add "<td>{deps.get_all_predecessors(p).length-1}</td>"
res.add "<td>{deps.predecessors(p).length}</td>"
end
res.add "<td>{mmodules[p]}</td>"
res.add "<td>{mclasses[p]}</td>"
res.add "<td>{mmethods[p]}</td>"
res.add "<td>{loc[p]}</td>"
res.add "<td>{score[p]}</td>"
res.add "<td>{errors[p]}</td>"
res.add "<td>{warnings[p]}</td>"
res.add "<td>{warnings_per_kloc[p]}</td>"
res.add "<td>{documentation_score[p]}</td>"
res.add "</tr>\n"
end
res.add "</table>\n"
return res
end
src/nitcatalog.nit:471,2--525,4