changeset 808:a842dc106ce3 feature-world

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 14 Jun 2020 22:21:19 +0900
parents fc271965bd56 (current diff) f5f3f932339b (diff)
children bf64c57a5509
files s4-blog.sh
diffstat 1 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Sun Jun 14 17:10:48 2020 +0900
+++ b/s4-blog.sh	Sun Jun 14 22:21:19 2020 +0900
@@ -391,22 +391,29 @@
     return
   fi
   echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
+  # If, nLimit = 50
+  # show article:1, hide(2, 3), show(4, ...)
+  # Therefore hide 2 or more article when narts>53
   narts=`wc -l < $midfile`
-  if [ -n "$nlimit" -a "$narts" -gt "$nlimit" ]; then
+  if [ -n "$nlimit" -a "$narts" -gt "$((nlimit+2))" ]; 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))
+      [ $afternew -gt $((nlimit+2)) ] && nlimit=$((afternew+0))
       err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit
     fi
   fi
-  if [ $nlimit -lt $narts ]; then
-    CAT="tail -n $nlimit"
+  if [ $nlimit -lt $((narts-2)) ]; then
+    n=0
+    omitline=$td/omitline
+    #CAT="tail -n $nlimit"
+    CAT=cat
     limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>"
     showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>"
-    cat<<-EOF
-	<tr><td>$limitedmsg<br>($((narts-$nlimit))件省略)</td>
-	    <th>$showalllink</th></tr>
+    cat<<-EOF > $omitline
+	<tr class="warn">
+	<th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th>
+	<th>$showalllink</td></th>
 	EOF
   else
     CAT=cat
@@ -416,6 +423,17 @@
   while IFS='|' read id edit notify uid author uname icon aid \
 	   tm reki new hte fa imgids
   do
+    if [ -n "$omitline" ]; then
+      n=$((n+1))
+      if [ $n -eq 1 ]; then
+	:
+      elif [ $n -eq 2 ]; then
+	cat $omitline
+	continue
+      elif [ $n -lt $((narts-nlimit+1)) ]; then
+	continue
+      fi
+    fi
     mf2=$tmpd/midfile2
     cachefile="$td/$id.row.html"
     stampfile="$td/$id.row.stamp"

yatex.org