Fix: Stats

This commit is contained in:
Cyrille L 2022-03-12 16:16:21 +01:00
parent eff3b78fa9
commit 5b4b5e6cdf
3 changed files with 28 additions and 21 deletions

View File

@ -21,6 +21,17 @@ gsl_header_tags=`gsl__get_header "$gsl_marker_tags" "$gsl_post"`
# Check | Make in Loop from header datas $1: process $2:marker $3:file # Check | Make in Loop from header datas $1: process $2:marker $3:file
#====================================================================== #======================================================================
gsl__do_header() { gsl__do_header() {
# Init Stats
gsl_stat_abbr=0
gsl_stat_abbrs=0
gsl_stat_link=0
gsl_stat_links=0
gsl_stat_file=0
gsl_count_files=0
gsl_stat_image=0
gsl_stat_fcode=0
while read -r "gsl_header_content_line" while read -r "gsl_header_content_line"
do do
gsl__get_header_fields "$2" gsl__get_header_fields "$2"
@ -127,7 +138,9 @@ esac
# Do Italics + Get STATS | $1: Process $2:File # Do Italics + Get STATS | $1: Process $2:File
#====================================================================== #======================================================================
gsl__do_italics() { gsl__do_italics() {
gsl_stat_italics=0
echo -ne "\r\033[2K: Counting Italics..." echo -ne "\r\033[2K: Counting Italics..."
while IFS=: read -r "n" "italic" while IFS=: read -r "n" "italic"
do do
@ -161,9 +174,13 @@ done < <(grep -oPn "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2")
# Do Italics + Get STATS | $1: Process $2:File # Do Italics + Get STATS | $1: Process $2:File
#====================================================================== #======================================================================
gsl__do_icode() { gsl__do_icode() {
gsl_stat_icode=0
case "$1" in case "$1" in
"stats") "stats")
gsl_stat_icodes=0 echo -ne "\r\033[2K: Counting Inline-Codes..."
gsl_mark_icode=`grep -o "$gsl_mark_code" "$2" | wc -l`
gsl_stat_icode=$(( gsl_mark_icode / 2 ))
;; ;;
"make") "make")
@ -197,4 +214,3 @@ case "$1" in
;; ;;
esac esac
} }
# awk '{ for ( i = 1; i < NF; ++i ) print NR,$i; }' "$2"

View File

@ -43,9 +43,7 @@ done
# Get Datas for Post/Page # Get Datas for Post/Page
#---------------------------------------------------------------------- #----------------------------------------------------------------------
gsl__page_prepare_datas() { gsl__page_prepare_datas() {
#echo "D> $gsl_this_conf_domain" # Set wip folder from domain
# Check for Files & Folders in server
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip" gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
# Post or Page # Post or Page

View File

@ -12,15 +12,7 @@
gsl__all_checkers() { gsl__all_checkers() {
unset gsl_check_done unset gsl_check_done
# Stats
gsl_db_tmp=`mktemp` gsl_db_tmp=`mktemp`
gsl_stat_link=0
gsl_stat_abbr=0
gsl_stat_italics=0
gsl_stat_file=0
gsl_stat_image=0
gsl_stat_icode=0
gsl_stat_fcode=0
gsl__check_h1 || return gsl__check_h1 || return
gsl__post_content_only gsl__post_content_only
@ -400,6 +392,7 @@ fi
# From gsl__do_header: Check Files # From gsl__do_header: Check Files
#====================================================================== #======================================================================
gsl__check_fcode() { gsl__check_fcode() {
gsl__check_header_fields \ gsl__check_header_fields \
"Post" "$gsl_log_h_code" "$gsl_log_act_code" \ "Post" "$gsl_log_h_code" "$gsl_log_act_code" \
|| return || return
@ -438,7 +431,7 @@ gsl__get_content_line "_code:$gsl_post_hf_1" "$gsl_post" | wc -l`
if (( $gsl_count_fcodes > 0 ));then if (( $gsl_count_fcodes > 0 ));then
((gsl_stat_fcode+)) ((gsl_stat_fcode++))
else else