Added post-list [OPT] ; Add Post to HTML File Listing
This commit is contained in:
parent
8cb881c7bb
commit
5420c8353a
|
@ -128,3 +128,8 @@ gsl_marker_file='file: '
|
|||
|
||||
# Delimiters to seet for sed in case exists in inline-code
|
||||
gsl_d=(\, \. \? \% \# \- \: \^ \/ \_ \| )
|
||||
|
||||
|
||||
# Post-listing
|
||||
gsl_list_max_posts=5
|
||||
gsl_list_lines_per_post=5
|
||||
|
|
|
@ -135,10 +135,14 @@ case "$1" in
|
|||
case "$2" in
|
||||
-F)
|
||||
gsl_force_check=true
|
||||
[[ "$3" ]] && gsl__check_opt_post "$3"
|
||||
if [[ "$3" ]];then
|
||||
gsl__check_opt_post "$3"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
[[ "$2" ]] && gsl__check_opt_post "$2"
|
||||
if [[ "$2" ]];then
|
||||
gsl__check_opt_post "$2"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -164,10 +168,14 @@ case "$1" in
|
|||
case "$2" in
|
||||
-F)
|
||||
gsl_force_make=true
|
||||
[[ "$3" ]] && gsl__check_opt_post "$3"
|
||||
if [[ "$3" ]];then
|
||||
gsl__check_opt_post "$3"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
[[ "$2" ]] && gsl__check_opt_post "$2"
|
||||
if [[ "$2" ]];then
|
||||
gsl__check_opt_post "$2"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -188,6 +196,32 @@ case "$1" in
|
|||
"${PWD}"
|
||||
;;
|
||||
|
||||
post-list)
|
||||
if [[ "$2" ]];then
|
||||
gsl__check_opt_post "$2"
|
||||
else
|
||||
echo "! Select a Post to add to list"
|
||||
exit
|
||||
fi
|
||||
|
||||
gsl__check_nbr_posts
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"Post-List ; Add $2 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
gsl__loop_posts post-list
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"Post-List ; Add $2 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
;;
|
||||
|
||||
readme)
|
||||
if [[ -f "/var/lib/gsl/README.md" ]];then
|
||||
clear
|
||||
|
|
|
@ -86,6 +86,12 @@ fi
|
|||
#======================================================================
|
||||
gsl__page_create_listing() {
|
||||
# Check if Post is in list ; Status Made
|
||||
case "$1" in
|
||||
selected)
|
||||
true
|
||||
;;
|
||||
|
||||
*)
|
||||
case "$gsl_db_post_status" in
|
||||
wip|www)
|
||||
gsl__logs_print \
|
||||
|
@ -97,17 +103,16 @@ case "$gsl_db_post_status" in
|
|||
return
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
touch "$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
gsl_list_max_posts=5
|
||||
gsl_list_lines_per_post=5
|
||||
gsl_list_max_lines=$(( gsl_list_max_posts * gsl_list_lines_per_post))
|
||||
gsl_list_cur_lines=`
|
||||
cat "$gsl_dir_domain_tpl/last-posts-list.html" \
|
||||
| wc -l`
|
||||
|
||||
|
||||
if (( $((gsl_list_cur_lines )) >= $gsl_list_max_lines ));then
|
||||
for i in `seq 1 $gsl_list_lines_per_post`
|
||||
do
|
||||
|
@ -124,11 +129,12 @@ cat << EOPostSide >> "$gsl_dir_domain_tpl/last-posts-list.html"
|
|||
EOPostSide
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"$gsl_log_w" \
|
||||
"Post" \
|
||||
"Make" \
|
||||
"$gsl_post added to Latest listings" \
|
||||
"$gsl_file_db_posts"
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
gsl_checker_war=true
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
|
|
@ -106,6 +106,27 @@ do
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
post-list)
|
||||
case "$gsl_db_post_status" in
|
||||
wip|online)
|
||||
gsl_process="wip"
|
||||
gsl__post_begin
|
||||
gsl__get_needed_headers
|
||||
gsl__page_prepare_datas
|
||||
gsl__page_create_listing selected
|
||||
;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Status" \
|
||||
"$gsl_db_post_status: $gsl_post not Converted" \
|
||||
"$gsl_file_db_posts"
|
||||
gsl_checker_err=true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -130,8 +151,12 @@ done
|
|||
# Check NAME post from [OPT] ; should be from autocompletion
|
||||
#=======================================================================
|
||||
gsl__check_opt_post() {
|
||||
[[ `ls -1 *.gsl | grep "$1"` ]] \
|
||||
&& gsl_this_post="$1"
|
||||
if [[ `ls -1 *.gsl | grep "$1"` ]];then
|
||||
gsl_this_post="$1"
|
||||
else
|
||||
echo "! $1 Not Found"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
|
|
Loading…
Reference in New Issue