Site map

%{ tmpfile=/tmp/werc_sitemap_$pid.txt saveddf=$dirfilter fn get_md_title { sed 's/^(................................................................[^ ]*).*$/\1/g; 1q' < $1 } fn get_html_title { # H1 is not reliable because htmlroff doesn't use it :( #desc=`{cat $1 | sed 32q | grep '<[Hh]1>' | sed 's/<[Hh]1>(.*)(<\/[Hh]1>|$)/\1/;s/<[^>]*>//g;1q'} # Pick the first line of body instead desc=`{sed -n '/<[Bb][Oo][Dd][Yy]/,/./s/(<[^>]*>|$)//gp' < $1} if(~ $#desc 0) desc=`{sed 's/<[^>]*>//g; 1q' < $1} } fn get_file_title { if(~ $1 */) { if(test -f $1/index.md) get_md_title $1/index.md if not if(test -f $1/index.html) get_html_title $1/index.html } if not if(~ $1 *.md) get_md_title $1 if not if(~ $1 *.html) get_html_title $1 if not echo '' } fn listDir { d=$1 dirfilter=$saveddf if(test -f $d/_werc/config) . ./$d/_werc/config if(~ $#perm_redir_to 0) { echo '' } } fltr_cache listDir $sitedir/ if(test -s $tmpfile) mv $tmpfile $sitedir/sitemap.txt & %}