Replies now display newest first on the board page
This commit is contained in:
parent
c46b15f228
commit
b851ee5c89
10
shi2.sh
10
shi2.sh
|
@ -68,20 +68,17 @@ get_op_post_html() {
|
|||
if [ $reply_num -gt $trim ]
|
||||
then
|
||||
# id of the most recent reply to be included on the board page
|
||||
local reply_lim="$(cat "$post_html_path" \
|
||||
local reply_lim="$(tac "$post_html_path" \
|
||||
| grep -E "<!--END REPLY [0-9]+-->" \
|
||||
| head -n "$(( trim + 1 ))" \
|
||||
| head -n "$trim" \
|
||||
| tail -n1 | grep -Eo '[0-9]+')"
|
||||
|
||||
|
||||
sed -i -e ':a' -e 'N' -e '$!ba' \
|
||||
-e "s/<!--BEGIN REPLY $reply_lim-->.*<!--END OP POST $post_id-->//g" \
|
||||
-e "s/<!--BEGIN REPLY [0-9]\+-->.*<!--BEGIN REPLY $reply_lim-->/<!--BEGIN REPLY $reply_lim-->/g" \
|
||||
"$temp_file"
|
||||
|
||||
cat "$temp_file"
|
||||
|
||||
printf "<!--END REPLIES %s-->\n</div>\n</div>\n<!--END OP POST %s-->" \
|
||||
"$post_id" "$post_id"
|
||||
else
|
||||
cat "$temp_file"
|
||||
fi
|
||||
|
@ -206,7 +203,6 @@ insert_post() {
|
|||
insert_at="<!--BEGIN POSTS-->"
|
||||
;;
|
||||
"reply")
|
||||
# In the future, we will want to display replies in reverse chronological order
|
||||
parent="$(get_post_data "$post_db_path" "parent")"
|
||||
replace="<!--BEGIN REPLY $post_id-->.*<!--END REPLY $post_id-->\n"
|
||||
# find existing reply end tags in the parent post html
|
||||
|
|
Loading…
Reference in New Issue