tweak: get working number of children

This commit is contained in:
Nuno Sempere 2022-07-26 02:32:47 +00:00
parent 4b969262a7
commit 73cb339bc7

View File

@ -14,26 +14,35 @@ fn get_mdate {
echo $t(6)^'-'^$t(2)^'-'^$t(3) echo $t(6)^'-'^$t(2)^'-'^$t(3)
} }
fn get_children {
children = `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
echo $children
}
fn listDir { fn listDir {
d=$1 d=$1
dirfilter=$saveddf dirfilter=$saveddf
if(test -f $d/_werc/config) if(test -f $d/_werc/config)
. $d/_werc/config . $d/_werc/config
if(~ $#perm_redir_to 0) { if(~ $#perm_redir_to 0) {
echo '<ul class="sitemap-list">' echo '<ul class="sitemap-list">'
siblings=`{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
for(i in `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}) { numsiblings = $#siblings
for(i in $siblings) {
filename=`{get_file_title $i} filename=`{get_file_title $i}
url=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '} url=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '}
dirname=`{echo /$url|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'} dirname=`{echo /$url|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
if(! ~ $#filename 0 && ! ~ $filename '') { if(! ~ $#filename 0 && ! ~ $filename '') {
# filename=' — '$"filename # filename=' — '$"filename
echo '<li><a href="'$url'">'^$"filename^'</a></li>' echo '<li><a href="'$url'">'^$"filename^'</a></li>'
echo $numsiblings
} }
if not { if not {
if(! ~ $"dirname $filtereddirs) if(! ~ $"dirname $filtereddirs)
echo '<li><a href="'$url'">'^$"dirname^'</a></li>' echo '<li><a href="'$url'">'^$"dirname^'</a></li>'
echo $numsiblings
} }
echo $base_url^$url >> $tmpfile echo $base_url^$url >> $tmpfile
echo '<url><loc>'$base_url^$url'</loc><lastmod>'^`{get_mdate $i}^'</lastmod></url>' >> $tmpfilex echo '<url><loc>'$base_url^$url'</loc><lastmod>'^`{get_mdate $i}^'</lastmod></url>' >> $tmpfilex