From 5b4b5e6cdf351b3341fb813c94407078b4c7ddaf Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sat, 12 Mar 2022 16:16:21 +0100 Subject: [PATCH] Fix: Stats --- var/lib/gsl/scripts/gsl__do_commons | 20 ++++++++++++++++++-- var/lib/gsl/scripts/gsl__page_creator | 16 +++++++--------- var/lib/gsl/scripts/gsl__post_checkers | 13 +++---------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/var/lib/gsl/scripts/gsl__do_commons b/var/lib/gsl/scripts/gsl__do_commons index d5e6cbc..b293705 100644 --- a/var/lib/gsl/scripts/gsl__do_commons +++ b/var/lib/gsl/scripts/gsl__do_commons @@ -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 #====================================================================== 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" do gsl__get_header_fields "$2" @@ -127,7 +138,9 @@ esac # Do Italics + Get STATS | $1: Process $2:File #====================================================================== gsl__do_italics() { +gsl_stat_italics=0 echo -ne "\r\033[2K: Counting Italics..." + while IFS=: read -r "n" "italic" do @@ -161,9 +174,13 @@ done < <(grep -oPn "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2") # Do Italics + Get STATS | $1: Process $2:File #====================================================================== gsl__do_icode() { +gsl_stat_icode=0 + case "$1" in "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") @@ -197,4 +214,3 @@ case "$1" in ;; esac } -# awk '{ for ( i = 1; i < NF; ++i ) print NR,$i; }' "$2" diff --git a/var/lib/gsl/scripts/gsl__page_creator b/var/lib/gsl/scripts/gsl__page_creator index e5fd499..bf0639e 100644 --- a/var/lib/gsl/scripts/gsl__page_creator +++ b/var/lib/gsl/scripts/gsl__page_creator @@ -43,9 +43,7 @@ done # Get Datas for Post/Page #---------------------------------------------------------------------- gsl__page_prepare_datas() { -#echo "D> $gsl_this_conf_domain" - -# Check for Files & Folders in server +# Set wip folder from domain gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip" # Post or Page @@ -70,12 +68,12 @@ gsl_uri_site_logo="$gsl_uri/templates/$gsl_site_logo" #---------------------------------------------------------------------- gsl__check_srv_files() { if [[ -f "$1" ]];then - gsl__logs_print \ - "$gsl_log_i" \ - "SRV" \ - "Files" \ - "Exists" \ - "$1" + gsl__logs_print \ + "$gsl_log_i" \ + "SRV" \ + "Files" \ + "Exists" \ + "$1" fi } diff --git a/var/lib/gsl/scripts/gsl__post_checkers b/var/lib/gsl/scripts/gsl__post_checkers index 77d6dc4..13896cc 100644 --- a/var/lib/gsl/scripts/gsl__post_checkers +++ b/var/lib/gsl/scripts/gsl__post_checkers @@ -12,15 +12,7 @@ gsl__all_checkers() { unset gsl_check_done -# Stats 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__post_content_only @@ -400,6 +392,7 @@ fi # From gsl__do_header: Check Files #====================================================================== gsl__check_fcode() { + gsl__check_header_fields \ "Post" "$gsl_log_h_code" "$gsl_log_act_code" \ || return @@ -438,7 +431,7 @@ gsl__get_content_line "_code:$gsl_post_hf_1" "$gsl_post" | wc -l` if (( $gsl_count_fcodes > 0 ));then - ((gsl_stat_fcode+)) + ((gsl_stat_fcode++)) else @@ -448,7 +441,7 @@ else "$gsl_log_c_code" \ "Missing: _code:$gsl_post_hf_1" \ "${PWD}/$gsl_post" - gsl_checker_err=true + gsl_checker_err=true fi }