Introduction
Introduction Statistics Contact Development Disclaimer Help
Sitemap improvemnts and cleanups: - swerc - anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log
Files
Refs
README
---
commit 6e9bf1d52439f1d46da6c4554d6dddafac97ada9
parent 73a136f87f8bbf39106c635ee34f1689b61d3b5d
Author: [email protected] <unknown>
Date: Sat, 20 Dec 2008 13:20:31 +0100
Sitemap improvemnts and cleanups:
- Avoid nedless tests
- Replace reference to /bin/sed with faster, simpler and probably more correct …
- Move inline html styling to style.css
- Various code cleanups, bring source style in line with other werc source.
Diffstat:
M lib/sitemap.tpl | 55 +++++++++++++++++------------…
M pub/style/style.css | 3 +++
2 files changed, 33 insertions(+), 25 deletions(-)
---
diff --git a/lib/sitemap.tpl b/lib/sitemap.tpl
@@ -3,7 +3,7 @@
%{
tmpfile=/tmp/werc_sitemap_$pid.txt
echo '' > $tmpfile
-saveddf = $dirfilter
+saveddf=$dirfilter
fn getMdDesc {
sed 's/^(.................................................................…
@@ -11,51 +11,56 @@ fn getMdDesc {
fn listDir {
d=$1
- dirfilter = $saveddf
- blogDirs = ()
- if (test -f $d/_werc/config)
- . $d/_werc/config
+ if(~ $#d 0)
+ d=''
+ dirfilter=$saveddf
+ blogDirs=()
+ if(test -f $d/_werc/config)
+ . ./$d/_werc/config
- echo '<ul>'
+ echo '<ul class="sitemap-list">'
# Don't hide blog dirs for now
- #if (! ~ $#blogDirs 0 || ~ $1 */blog */Blog )
+ #if(! ~ $#blogDirs 0 || ~ $1 */blog */Blog)
# echo ''
#if not
if(! ~ $#redirectPermanent 1)
{
- for ( i in `{ ls -d $d/*/ $d/*.md $d/*.html $d/*.txt >[2]/dev/null |sed $d…
- desc = ''
- if (test -f $i.md) {
- desc = `{ getMdDesc $i.md }
- }
- if (test -f $i/index.md) {
- desc = `{ getMdDesc $i/index.md }
- }
- if (test -f $i.html) {
+ for(i in `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $di…
+ desc=''
+ if(test -f $i.md)
+ desc=`{getMdDesc $i.md}
+ if not if(~ $i */ && test -f $i/index.md)
+ desc=`{getMdDesc $i/index.md}
+ if not if(test -f $i.html) {
# H1 is not reliable because htmlroff doesn't use it :(
- #desc = `{ cat $i.html |sed 32q | grep '<[Hh]1>' |sed 's/<[Hh]1>(.…
+ #desc = `{cat $i.html |sed 32q | grep '<[Hh]1>' |sed 's/<[Hh]1>(.*…
# Pick the first line of body instead
- desc = `{ /bin/sed -e '0,/<[Bb][Oo][Dd][Yy]/d;s/<[^>]*>//g;/^$/d' …
+ desc=`{sed -n '/<[Bb][Oo][Dd][Yy]/,/./s/(<[^>]*>|$)//gp' < $i.html}
+ if(~ $#desc 0)
+ desc=`{sed 's/<[^>]*>//g; 1q' < $i.html}
+ #desc=`{/bin/sed -e '0,/<[Bb][Oo][Dd][Yy]/d;s/<[^>]*>//g;/^$/d' < …
}
- if (! ~ $desc '')
- desc = ' - '$"desc
- tit = `{basename $i|sed 's/_/ /g'}
- echo '<li><a style="text-transform: capitalize" href="/'$i'">'^$"tit^'…
+
+ if(! ~ $#desc 0 && ! ~ $desc '')
+ desc=' - '$"desc
+ tit=`{echo /$i|sed 's/_/ /g; s,.*/([^/]+)/?$,\1,'}
+ echo '<li><a href="/'$i'">'^$"tit^'</a>' $"desc '</li>'
echo -n $baseuri^$i >> $tmpfile
- if (test -d $i) {
+ if(test -d $i) {
echo / >> $tmpfile
@{ listDir $i }
}
- if not echo >> $tmpfile
+ if not
+ echo >> $tmpfile
}
}
echo '</ul>'
}
cd $sitedir
-listDir .
+listDir ''
cp $tmpfile ./sitemap.txt
rm $tmpfile
diff --git a/pub/style/style.css b/pub/style/style.css
@@ -369,3 +369,6 @@ h1.dir-list-head, ul.dir-list {
text-transform: capitalize;
font-weight: bold;
}
+ul.sitemap-list a {
+ text-transform: capitalize;
+}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.