Fixes + Roller Listings (Pin)
This commit is contained in:
parent
94bc7af2ab
commit
eff3b78fa9
|
@ -144,10 +144,6 @@ fi
|
||||||
|
|
||||||
touch "$gsl_file_db_post"
|
touch "$gsl_file_db_post"
|
||||||
|
|
||||||
# Check webserver files
|
|
||||||
[[ -f $gsl_srv_wip_page ]] \
|
|
||||||
&& gsl_process=wip
|
|
||||||
|
|
||||||
# Main Print
|
# Main Print
|
||||||
printf '%s\n%s\n%s\n' \
|
printf '%s\n%s\n%s\n' \
|
||||||
"Post:${PWD}/$gsl_post:$gsl_post_hash:$gsl_post_size" \
|
"Post:${PWD}/$gsl_post:$gsl_post_hash:$gsl_post_size" \
|
||||||
|
|
|
@ -26,14 +26,15 @@ cat -n "$gsl_srv_wip_page"
|
||||||
#======================================================================
|
#======================================================================
|
||||||
gsl__srv_sync() {
|
gsl__srv_sync() {
|
||||||
# Sync Files and Folders
|
# Sync Files and Folders
|
||||||
|
mkdir -p "$gsl_srv_wip"
|
||||||
for folder in `find $gsl_this_conf_domain/* -type d`
|
for folder in `find $gsl_this_conf_domain/* -type d`
|
||||||
do
|
do
|
||||||
rsync -a "$folder" "$gsl_srv_wip" && \
|
rsync -a --delete "$folder" "$gsl_srv_wip" && \
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
"$gsl_log_w" \
|
"$gsl_log_w" \
|
||||||
"Server" \
|
"Server" \
|
||||||
"Sync" \
|
"Sync" \
|
||||||
"$folder" \
|
"$folder in" \
|
||||||
"$gsl_srv_wip"
|
"$gsl_srv_wip"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -79,9 +80,9 @@ fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#======================================================================
|
#======================================================================
|
||||||
# Create Post Listing
|
# latest Posts listing Manager
|
||||||
#======================================================================
|
#======================================================================
|
||||||
gsl__page_create_listing() {
|
gsl__page_listing_create() {
|
||||||
# Check if Post is in list ; Status Made
|
# Check if Post is in list ; Status Made
|
||||||
gsl_checker_war=true
|
gsl_checker_war=true
|
||||||
gsl_listing_file="$gsl_dir_domain_listings/$gsl_post.list"
|
gsl_listing_file="$gsl_dir_domain_listings/$gsl_post.list"
|
||||||
|
@ -90,47 +91,46 @@ if [[ `ls -1 "$gsl_listing_file"* 2>/dev/null` ]];then
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
"$gsl_log_w" \
|
"$gsl_log_w" \
|
||||||
"Post" \
|
"Post" \
|
||||||
"List" \
|
"Latest" \
|
||||||
"$gsl_post_list $gsl_post already added to Latests" \
|
"$gsl_post_list $gsl_post ; already added to Listing" \
|
||||||
"$gsl_dir_domain_listings/"
|
"$gsl_dir_domain_listings/"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$gsl_post_list" in
|
case "$gsl_post_list" in
|
||||||
Pin)
|
Pin)
|
||||||
gsl__page_create_listing_file "$gsl_listing_file.1"
|
gsl_listing_start_n=1
|
||||||
|
[[ $gsl_post_pin ]] \
|
||||||
|
&& sed -i "s|gsl_post_pin.*|gsl_post_pin=$gsl_header_title|" \
|
||||||
|
"$gsl_this_conf_domain/$gsl_find_domain.conf" \
|
||||||
|
|| echo "gsl_post_pin=$gsl_header_title" \
|
||||||
|
>> "$gsl_this_conf_domain/$gsl_find_domain.conf"
|
||||||
;;
|
;;
|
||||||
Add)
|
Add)
|
||||||
# search for last listing number
|
# Check if a post is pinned
|
||||||
gsl_listing_last=`
|
[[ $gsl_post_pin ]] \
|
||||||
ls -1 *"$gsl_dir_domain_listings/"*".list."* \
|
&& gsl_listing_start_n=2 \
|
||||||
| tail -1 2>/dev/null`
|
|| gsl_listing_start_n=1
|
||||||
|
|
||||||
# Get Last listing number
|
|
||||||
! [[ $gsl_listing_last ]] \
|
|
||||||
&& gsl_listing_last_n=0 \
|
|
||||||
|| gsl_listing_last_n=${gsl_listing_last: -1}
|
|
||||||
|
|
||||||
# Set last listing number for this post
|
|
||||||
(( $gsl_listing_last_n <= $(( gsl_list_max_posts - 1)) )) \
|
|
||||||
&& gsl_listing_last_n=$(( $gsl_listing_last_n + 1 ))
|
|
||||||
|
|
||||||
gsl__page_create_listing_file \
|
|
||||||
"$gsl_listing_file.$gsl_listing_last_n"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cat "$gsl_dir_domain_listings/"*.list.* \
|
gsl__page_listing_roller
|
||||||
|
gsl__page_listing_create_file "$gsl_listing_file.$gsl_listing_start_n"
|
||||||
|
|
||||||
|
cat `ls -1r "$gsl_dir_domain_listings/"*.list.*` \
|
||||||
> "$gsl_dir_domain_tpl/last-posts-list.html" \
|
> "$gsl_dir_domain_tpl/last-posts-list.html" \
|
||||||
&& gsl__logs_print \
|
&& gsl__logs_print \
|
||||||
"$gsl_log_w" \
|
"$gsl_log_w" \
|
||||||
"Post" \
|
"Post" \
|
||||||
"List" \
|
"Latest" \
|
||||||
"Create Latest Listing (Merged .list.*)"\
|
"Create Listing (Merged .list.*)"\
|
||||||
"$gsl_dir_domain_tpl/last-post-list.html"
|
"$gsl_dir_domain_tpl/last-post-list.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl__page_create_listing_file() {
|
#======================================================================
|
||||||
|
# Create HTML List from selected Post
|
||||||
|
#======================================================================
|
||||||
|
gsl__page_listing_create_file() {
|
||||||
cat << EOPostSide > "$1"
|
cat << EOPostSide > "$1"
|
||||||
<li>
|
<li>
|
||||||
<span class="${gsl_site_css}_list-post-title">$gsl_header_title</span>
|
<span class="${gsl_site_css}_list-post-title">$gsl_header_title</span>
|
||||||
|
@ -142,11 +142,76 @@ EOPostSide
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
"$gsl_log_w" \
|
"$gsl_log_w" \
|
||||||
"Post" \
|
"Post" \
|
||||||
"List" \
|
"Latest" \
|
||||||
"$gsl_post_list $gsl_post to Latests"\
|
"$gsl_post_list $gsl_post to Listing" \
|
||||||
"$1"
|
"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#======================================================================
|
||||||
|
# latest Posts listing Rolling
|
||||||
|
#======================================================================
|
||||||
|
gsl__page_listing_roller() {
|
||||||
|
|
||||||
|
gsl__page_listing_file_mv() {
|
||||||
|
for n in `seq $gsl_listing_start_n $(( gsl_listing_last_n )) | sort -r`
|
||||||
|
do
|
||||||
|
gsl_listing_this_post=`ls -1 "$gsl_dir_domain_listings/"*".list.$n"`
|
||||||
|
gsl_listing_tmp_no_n=`echo ${gsl_listing_this_post%.*}`
|
||||||
|
gsl_listing_new_post="$gsl_listing_tmp_no_n.$(( n + 1 ))"
|
||||||
|
|
||||||
|
mv "$gsl_listing_this_post" \
|
||||||
|
"$gsl_listing_new_post"
|
||||||
|
done
|
||||||
|
gsl__logs_print \
|
||||||
|
"$gsl_log_w" \
|
||||||
|
"Post" \
|
||||||
|
"Latest" \
|
||||||
|
"Roll from Listing" \
|
||||||
|
"$gsl_dir_domain_listings/*.list.*"
|
||||||
|
}
|
||||||
|
|
||||||
|
# search for last listing number
|
||||||
|
gsl_listing_last=`
|
||||||
|
ls -1 "$gsl_dir_domain_listings/"*".list."* 2>/dev/null \
|
||||||
|
| tail -1`
|
||||||
|
|
||||||
|
if [[ $gsl_listing_last ]];then
|
||||||
|
|
||||||
|
# A Post is Pinned
|
||||||
|
if [[ $gsl_post_pin ]];then
|
||||||
|
gsl__logs_print \
|
||||||
|
"$gsl_log_w" \
|
||||||
|
"Post" \
|
||||||
|
"Latest" \
|
||||||
|
"Remove Pin $gsl_listing_rm_post_name from Listing" \
|
||||||
|
"$gsl_listing_rm_post_uri"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get Last listing number
|
||||||
|
gsl_listing_last_n=${gsl_listing_last: -1}
|
||||||
|
# Remove last file
|
||||||
|
if (( $gsl_listing_last_n == $gsl_list_max_posts ));then
|
||||||
|
gsl_listing_rm_post_uri=`
|
||||||
|
ls -1 "$gsl_dir_domain_listings/"*".list.$gsl_list_max_posts"`
|
||||||
|
gsl_listing_rm_post_name=`
|
||||||
|
basename "$gsl_listing_rm_post_uri" | awk -F"." '{print $1"."$2}'`
|
||||||
|
|
||||||
|
rm -f "$gsl_dir_domain_listings/"*".list.$gsl_list_max_posts" && \
|
||||||
|
gsl__logs_print \
|
||||||
|
"$gsl_log_w" \
|
||||||
|
"Post" \
|
||||||
|
"Latest" \
|
||||||
|
"Remove $gsl_listing_rm_post_name from Listing" \
|
||||||
|
"$gsl_listing_rm_post_uri"
|
||||||
|
gsl_listing_last_n=4
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Roll each ones + 1
|
||||||
|
gsl__page_listing_file_mv
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Create Final HTML Post/Page
|
# Create Final HTML Post/Page
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -93,14 +93,16 @@ case "$gsl_post_type" in
|
||||||
"${PWD}/$gsl_post"
|
"${PWD}/$gsl_post"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sed -i "s|$gsl_marker_type.*|${gsl_marker_type}post|" \
|
gsl_post_type="post"
|
||||||
|
sed -i "1i$gsl_marker_type$gsl_post_type" \
|
||||||
"$gsl_post" && \
|
"$gsl_post" && \
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
"$gsl_log_w" \
|
"$gsl_log_w" \
|
||||||
"Post" \
|
"Post" \
|
||||||
"Set as" \
|
"Set as" \
|
||||||
"Default $gsl_post_type: $gsl_post" \
|
"Default: $gsl_post_type for $gsl_post" \
|
||||||
"${PWD}/$gsl_post"
|
"${PWD}/$gsl_post"
|
||||||
|
gsl__get_sum "$gsl_post"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -205,9 +207,9 @@ if (( "$gsl_count_links" > 0 ));then
|
||||||
|
|
||||||
# Check URL
|
# Check URL
|
||||||
gsl_url_status=`
|
gsl_url_status=`
|
||||||
curl -o /dev/null --silent --head --write-out \
|
timeout 3 curl -o /dev/null --silent --head --write-out \
|
||||||
'%{http_code}' \
|
'%{http_code}' \
|
||||||
"$gsl_post_hf_2" 2>/dev/null`
|
"$gsl_post_hf_2" 2>/dev/null || gsl_utl_status=408`
|
||||||
|
|
||||||
case "$gsl_url_status" in
|
case "$gsl_url_status" in
|
||||||
1*|2*|3*)
|
1*|2*|3*)
|
||||||
|
@ -562,6 +564,7 @@ if ! [[ "$gsl_slug_err" ]];then
|
||||||
"Changed: $gsl_header_slug_test" \
|
"Changed: $gsl_header_slug_test" \
|
||||||
"${PWD}/$gsl_post"
|
"${PWD}/$gsl_post"
|
||||||
|
|
||||||
|
gsl__get_sum "$gsl_post"
|
||||||
gsl_header_slug=$gsl_header_slug_test
|
gsl_header_slug=$gsl_header_slug_test
|
||||||
gsl_checker_war=true
|
gsl_checker_war=true
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,10 @@ unset gsl_check_done
|
||||||
gsl_a11y_post=`mktemp`
|
gsl_a11y_post=`mktemp`
|
||||||
|
|
||||||
gsl__post_content_only
|
gsl__post_content_only
|
||||||
mkdir -p "$gsl_srv_wip"
|
|
||||||
gsl__srv_sync
|
gsl__srv_sync
|
||||||
|
|
||||||
# Create Listng Page
|
# Create Listng Page
|
||||||
gsl__page_create_listing
|
gsl__page_listing_create Add
|
||||||
|
|
||||||
gsl__do_italics "make" "$gsl_tmp_post" # First
|
gsl__do_italics "make" "$gsl_tmp_post" # First
|
||||||
gsl__do_header "make" "$gsl_marker_link" "$gsl_post"
|
gsl__do_header "make" "$gsl_marker_link" "$gsl_post"
|
||||||
|
@ -50,8 +49,11 @@ echo -ne "\r\033[2K"
|
||||||
|
|
||||||
rm -f "$gsl_tmp_post" # No more Needed tmp file post
|
rm -f "$gsl_tmp_post" # No more Needed tmp file post
|
||||||
|
|
||||||
|
# Create SRV folder according to post type
|
||||||
|
[[ "$gsl_post_type" == "post" ]] \
|
||||||
|
&& mkdir -p "$gsl_srv_wip/$gsl_header_slug/"
|
||||||
|
|
||||||
# Create HTML Page using gsl_a11y_post
|
# Create HTML Page using gsl_a11y_post
|
||||||
# cat "$gsl_a11y_post"
|
|
||||||
gsl__page_creator
|
gsl__page_creator
|
||||||
gsl__db_set_post_status
|
gsl__db_set_post_status
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,12 @@ do
|
||||||
# Post too small
|
# Post too small
|
||||||
if (( "$gsl_post_size" <= $gsl_post_min_size ));then
|
if (( "$gsl_post_size" <= $gsl_post_min_size ));then
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
"$gsl_log_e" \
|
"$gsl_log_w" \
|
||||||
"Post" \
|
"Post" \
|
||||||
"Size" \
|
"Size" \
|
||||||
"$gsl_post - Too small $gsl_post_size <= $gsl_post_min_size" \
|
"$gsl_post - Too small $gsl_post_size <= $gsl_post_min_size" \
|
||||||
"${PWD}/$gsl_post"
|
"${PWD}/$gsl_post"
|
||||||
|
gsl_checker_war=true
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ do
|
||||||
gsl__post_begin
|
gsl__post_begin
|
||||||
gsl__get_needed_headers
|
gsl__get_needed_headers
|
||||||
gsl__page_prepare_datas
|
gsl__page_prepare_datas
|
||||||
gsl__page_create_listing
|
gsl__page_listing_create "$gsl_post_list"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
gsl__logs_print \
|
gsl__logs_print \
|
||||||
|
|
Loading…
Reference in New Issue