comparison s4-blog.sh @ 807:f5f3f932339b before-merging-world

Always showing article No.1
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 14 Jun 2020 19:52:08 +0900
parents f84cf537b5fb
children a842dc106ce3
comparison
equal deleted inserted replaced
805:f84cf537b5fb 807:f5f3f932339b
389 if [ $? -ne 0 -a ! -s $midfile ]; then 389 if [ $? -ne 0 -a ! -s $midfile ]; then
390 echo "時間をおいてください(Visit later please)." | html p 390 echo "時間をおいてください(Visit later please)." | html p
391 return 391 return
392 fi 392 fi
393 echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->' 393 echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
394 # If, nLimit = 50
395 # show article:1, hide(2, 3), show(4, ...)
396 # Therefore hide 2 or more article when narts>53
394 narts=`wc -l < $midfile` 397 narts=`wc -l < $midfile`
395 if [ -n "$nlimit" -a "$narts" -gt "$nlimit" ]; then 398 if [ -n "$nlimit" -a "$narts" -gt "$((nlimit+2))" ]; then
396 newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1` 399 newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1`
397 if [ -n "$newtop" ]; then 400 if [ -n "$newtop" ]; then
398 afternew=$((narts-newtop+1)) 401 afternew=$((narts-newtop+1))
399 [ $afternew -gt $nlimit ] && nlimit=$((afternew+0)) 402 [ $afternew -gt $((nlimit+2)) ] && nlimit=$((afternew+0))
400 err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit 403 err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit
401 fi 404 fi
402 fi 405 fi
403 if [ $nlimit -lt $narts ]; then 406 if [ $nlimit -lt $((narts-2)) ]; then
404 CAT="tail -n $nlimit" 407 n=0
408 omitline=$td/omitline
409 #CAT="tail -n $nlimit"
410 CAT=cat
405 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>" 411 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>"
406 showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>" 412 showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>"
407 cat<<-EOF 413 cat<<-EOF > $omitline
408 <tr><td>$limitedmsg<br>($((narts-$nlimit))件省略)</td> 414 <tr class="warn">
409 <th>$showalllink</th></tr> 415 <th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th>
416 <th>$showalllink</td></th>
410 EOF 417 EOF
411 else 418 else
412 CAT=cat 419 CAT=cat
413 fi 420 fi
414 # Start blog_replies table 421 # Start blog_replies table
415 $CAT $midfile | 422 $CAT $midfile |
416 while IFS='|' read id edit notify uid author uname icon aid \ 423 while IFS='|' read id edit notify uid author uname icon aid \
417 tm reki new hte fa imgids 424 tm reki new hte fa imgids
418 do 425 do
426 if [ -n "$omitline" ]; then
427 n=$((n+1))
428 if [ $n -eq 1 ]; then
429 :
430 elif [ $n -eq 2 ]; then
431 cat $omitline
432 continue
433 elif [ $n -lt $((narts-nlimit+1)) ]; then
434 continue
435 fi
436 fi
419 mf2=$tmpd/midfile2 437 mf2=$tmpd/midfile2
420 cachefile="$td/$id.row.html" 438 cachefile="$td/$id.row.html"
421 stampfile="$td/$id.row.stamp" 439 stampfile="$td/$id.row.stamp"
422 editlink="${edit:+<a href="$elink+$edit">編集</a> }" 440 editlink="${edit:+<a href="$elink+$edit">編集</a> }"
423 nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\ 441 nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\

yatex.org