shithub: werc

Download patch

ref: a66887bcdba6dd081902d5e1e95988f599a5f4cb
parent: 86ec5854b4763e19f0c4f2c8a5f3eaf473ca8cce
author: uriel <uriel@engel.se.cat-v.org>
date: Sat Jun 23 21:21:17 EDT 2007

Limite the length of descs and factor into sep function

--- a/pub/sitemap.tpl
+++ b/pub/sitemap.tpl
@@ -7,6 +7,10 @@
 rpath = `{pwd}
 rpath = $rpath^'/'^$sitedir
 
+fn getMdDesc {
+    sed 's/^(.......................................................................................................[^ ]*).*$/\1/g; 1q' < $1 
+}
+
 fn listDir {
     cd $1
     dirfilter = $saveddf
@@ -14,7 +18,7 @@
         . _config
 
     echo '<ul>'
-    for ( i in `{ls -d */ *.md *.html >[2] /dev/null |sed $dirfilter^'/index$/d;' } ) {
+    for ( i in `{ ls -d */ *.md *.html >[2]/dev/null |sed $dirfilter^'/index$/d;' } ) {
         cpath = `{ pwd | sed 's,^'^$"rpath/?^',,; s,//*,/,;' }
         if( ~ $#cpath 0 )
             cpath = ''
@@ -21,10 +25,10 @@
 
         desc = ''
         if (test -f $i.md) {
-            desc = `{ sed 1q < $i.md }
+            desc = `{ getMdDesc $i.md }
         }
         if (test -f $i/index.md) {
-            desc = `{ sed 1q < $i/index.md }
+            desc = `{ getMdDesc $i/index.md }
         }
         if (test -f $i.html) {
             # H1 is not reliable because htmlroff doesn't use it :(