cookutils rev 946
lighttpd/index.cgi: show "orphan types" hint in the parentheses (see /package/files).
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Jul 16 12:52:27 2017 +0300 (2017-07-16) |
parents | 79b65c3a4e40 |
children | c7179dd97e0b |
files | lighttpd/index.cgi |
line diff
1.1 --- a/lighttpd/index.cgi Fri Jul 14 15:58:38 2017 +0300 1.2 +++ b/lighttpd/index.cgi Sun Jul 16 12:52:27 2017 +0300 1.3 @@ -1153,7 +1153,8 @@ 1.4 echo "<section><h3>Quick jump:</h3><ul>" 1.5 echo "$split" | sed 'p' | xargs printf "<li><a href='#%s'>%s</a></li>\n" 1.6 echo "<li id='li-repeats' style='display:none'><a href='#repeats'>repeatedly packaged files</a></li>" 1.7 - echo "<li id='li-orphans' style='display:none'><a href='#orphans'>unpackaged files</a></li>" 1.8 + echo "<li id='li-orphans' style='display:none'><a href='#orphans'>unpackaged files</a>" 1.9 + echo "<span id='orphansTypes'></span></li>" 1.10 echo "</ul></section>" 1.11 1.12 for p in $split; do 1.13 @@ -1222,6 +1223,7 @@ 1.14 ' > $table 1.15 1.16 # Summary table 1.17 + orphans_types='()' 1.18 for i in head body; do 1.19 case $i in 1.20 head) echo -n '<table class="summary"><tr>';; 1.21 @@ -1231,11 +1233,18 @@ 1.22 tag=${j:0:3}; class="c${j:3:1}0"; [ "$class" == 'c00' ] && class='c01' 1.23 case $i in 1.24 head) echo -n "<th class='$class'>$tag</th>";; 1.25 - body) printf '<td>%s</td>' "$(grep ">$tag<" $table | wc -l)";; 1.26 + body) 1.27 + tagscount="$(grep ">$tag<" $table | wc -l)" 1.28 + printf '<td>%s</td>' "$tagscount" 1.29 + [ "$tagscount" -gt 0 ] && orphans_types="${orphans_types/)/ $tag)}" 1.30 + ;; 1.31 esac 1.32 done 1.33 done 1.34 echo '<td> </td></tr></table>' 1.35 + orphans_types="${orphans_types/( /(}" 1.36 + [ "$orphans_types" != '()' ] && 1.37 + echo "<script>document.getElementById('orphansTypes').innerText = '${orphans_types// /, }';</script>" 1.38 1.39 echo -n '<pre class="files">' 1.40 cat $table