changeset 806:fc271965bd56 feature-world

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 14 Jun 2020 17:10:48 +0900
parents 1de1319dce99 (current diff) f84cf537b5fb (diff)
children a842dc106ce3
files s4-blog.sh
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Sun Jun 14 12:48:43 2020 +0900
+++ b/s4-blog.sh	Sun Jun 14 17:10:48 2020 +0900
@@ -390,16 +390,28 @@
     echo "時間をおいてください(Visit later please)." | html p
     return
   fi
-  if [ -n "$nlimit" -a `wc -l < $midfile` -gt "$nlimit" ]; then
+  echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
+  narts=`wc -l < $midfile`
+  if [ -n "$nlimit" -a "$narts" -gt "$nlimit" ]; then
+    newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1`
+    if [ -n "$newtop" ]; then
+      afternew=$((narts-newtop+1))
+      [ $afternew -gt $nlimit ] && nlimit=$((afternew+0))
+      err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit
+    fi
+  fi
+  if [ $nlimit -lt $narts ]; then
     CAT="tail -n $nlimit"
-    limitedmsg="<small class=\"warn\">※最新${nlimit}件のみの表示</small>"
+    limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>"
     showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>"
-    echo $limitedmsg$showalllink | html p
+    cat<<-EOF
+	<tr><td>$limitedmsg<br>($((narts-$nlimit))件省略)</td>
+	    <th>$showalllink</th></tr>
+	EOF
   else
     CAT=cat
   fi
   # Start blog_replies table
-  echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
   $CAT $midfile |
   while IFS='|' read id edit notify uid author uname icon aid \
 	   tm reki new hte fa imgids

yatex.org