changeset 408:138a0c6b09a7

Edit link in cached row file should be determined dynamically.
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 09 Feb 2017 19:45:06 +0859
parents 4d912c2d48df
children 388639a80a23
files s4-blog.sh
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Thu Feb 09 11:20:10 2017 +0900
+++ b/s4-blog.sh	Thu Feb 09 19:45:06 2017 +0859
@@ -222,6 +222,7 @@
   while IFS='|' read id edit notify uid uname icon aid tm new hte imgids; do
     cachefile="$td/$id.row.html"
     stampfile="$td/$id.row.stamp"
+    editlink="${edit:+<a href="$elink+$edit">編集</a> }"
 
     # First, check the availability of user-icon.
     # If not existent, clear and reset row cache by rm $stampfile
@@ -249,7 +250,7 @@
 
 	cat<<EOF
 <tr id="$id">
-<td class="$tdcls">$picon${edit:+<a href="$elink+$edit">編集</a> }#$aid
+<td class="$tdcls">${picon}__EDIT__#$aid
 <a href="$hlink+$uid">$uname</a>
 $tm
 ${notify:+$nt}</td>
@@ -308,7 +309,9 @@
       test -n "$stampfile" && date "+%F %T" > $stampfile
     fi
     # Printing a cached row
-    sed "/<td class=/s/__NEWCLS__/$new${new:+ }/" $cachefile
+    sed -e "/<td class=/s/__NEWCLS__/$new${new:+ }/" \
+	-e "/<td class=/s,__EDIT__,$editlink," \
+	$cachefile
   done
 
   textform='<div class="fold">

yatex.org