diff --git a/control b/control index 46d8725..16e4ede 100644 --- a/control +++ b/control @@ -1,5 +1,5 @@ Package: egsl -Version: 0.0.12 +Version: 0.0.13 Section: custom Priority: optional Architecture: all diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index 0c88af9..cada8e5 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.0.12 +# Version: 0.0.13 # file: gsl # Folder: /usr/local/bin # By echolib @@ -11,18 +11,18 @@ if__command() { ! [[ `command -v $1` ]] \ && echo -e "$I_Red Missing $1 command" \ - && exit 1 + && exit } gsl__if_file() { if ! [[ -f "$1" ]];then echo "! Missing file: $1" - exit 1 + exit fi case "$2" in source) - source "$1" || exit 1 + source "$1" || exit ;; read) cat "$1" @@ -190,7 +190,7 @@ gsl__create_ff gsl__find_domain gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source -gsl__authors_list check || exit 1 +gsl__authors_list check || exit gsl__if_file "$gsl_dir_scripts/gsl__post_checkers" source gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source @@ -205,7 +205,7 @@ case "$1" in edit|-E) ! [[ "$2" ]] \ && echo "! Missing argument: post [FILE]" \ - && exit 1 + && exit gsl__if_file "$2" post if ! [[ "$EDITOR" ]];then @@ -257,7 +257,7 @@ case "$1" in db) ! [[ "$2" ]] \ && echo "! Missing argument: post [FILE]" \ - && exit 1 + && exit gsl__if_file "$2" post [[ -f "$gsl_dir_db/$gsl_this_post.db" ]] \ @@ -358,13 +358,13 @@ case "$1" in ;; *) echo "! Bad Argument: $2" - exit 1 + exit ;; esac ! [[ "$3" ]] \ && echo "! Missing argument: post [FILE]" \ - && exit 1 + && exit gsl__if_file "$3" post @@ -389,7 +389,7 @@ case "$1" in www) ! [[ "$2" ]] \ && echo "! Missing argument: OPT=add/remove" \ - && exit 1 + && exit if__command rsync gsl_www_act="$2" @@ -402,13 +402,13 @@ case "$1" in ;; *) echo "! Bad argument: $2 ? OPT=add/remove" - exit 1 + exit ;; esac ! [[ "$3" ]] \ && echo "! Missing argument: post [FILE]/all" \ - && exit 1 + && exit case "$3" in all) @@ -419,7 +419,7 @@ case "$1" in ;; *) echo "# Abandon" - exit 1 + exit ;; esac ;; diff --git a/var/lib/gsl/scripts/gsl__do_commons b/var/lib/gsl/scripts/gsl__do_commons index 568e4b3..fd8e095 100644 --- a/var/lib/gsl/scripts/gsl__do_commons +++ b/var/lib/gsl/scripts/gsl__do_commons @@ -112,7 +112,6 @@ do sed -i "s|$gsl_bold|$gsl_html_bold|g" "$2" ;; esac - fi done < <(grep -oPn "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2") @@ -178,27 +177,27 @@ case "$1" in gsl_html_icode_c="" while IFS=: read -r "n" "line" + do + unset gsl_icode_open + for i in $(seq 1 ${#line}) do - unset gsl_icode_open - for i in $(seq 1 ${#line}) - do - case "${line:i-1:1}" in - "$gsl_mark_code") - [[ "$gsl_icode_open" ]] \ - && gsl_html_line+="$gsl_html_icode_c" \ - && unset gsl_icode_open && continue - - gsl_icode_open=true - gsl_html_line+="$gsl_html_icode_o" - ;; - *) - gsl_html_line+="${line:i-1:1}" - ;; - esac - done - sed -i "${n}d" "$2" - sed -i "${n}i$gsl_html_line" "$2" - unset gsl_html_line + case "${line:i-1:1}" in + "$gsl_mark_code") + [[ "$gsl_icode_open" ]] \ + && gsl_html_line+="$gsl_html_icode_c" \ + && unset gsl_icode_open && continue + + gsl_icode_open=true + gsl_html_line+="$gsl_html_icode_o" + ;; + *) + gsl_html_line+="${line:i-1:1}" + ;; + esac + done + sed -i "${n}d" "$2" + sed -i "${n}i$gsl_html_line" "$2" + unset gsl_html_line done < <(grep -n "$gsl_mark_code" "$2") ;; esac diff --git a/var/lib/gsl/scripts/gsl__post_checkers b/var/lib/gsl/scripts/gsl__post_checkers index af2b737..2db73de 100644 --- a/var/lib/gsl/scripts/gsl__post_checkers +++ b/var/lib/gsl/scripts/gsl__post_checkers @@ -61,7 +61,7 @@ gsl__check_h1() { echo -ne ": Searching for #1..." gsl_post_begin=` -grep -n "#1" $gsl_post \ +grep -n "#1" $gsl_post \ | head -1 \ | awk -F: '{print $1}'` @@ -226,6 +226,7 @@ if (( "$gsl_count_links" > 0 ));then "$gsl_log_h_link" \ "Offline:$gsl_url_status ${gsl_post_hf_2:0:40}..." \ "${PWD}/$gsl_post" + # Decomment below if you want the error link avoiding convertion #gsl_checker_err=true return ;; diff --git a/var/lib/gsl/scripts/gsl__post_makers b/var/lib/gsl/scripts/gsl__post_makers index 9dc2df0..306236b 100644 --- a/var/lib/gsl/scripts/gsl__post_makers +++ b/var/lib/gsl/scripts/gsl__post_makers @@ -588,15 +588,9 @@ esac while IFS=: read -r "line_nbr" "this_image" do - + align_image=`awk -F: '{print $3}' <<< "$this_image"` - [[ $align_image ]] \ - && align_image=":$align_image" - - echo -ne "\r\033[2K: Converting Image... Line:$line_nbr $this_image" - gsl_html_src="src=\"$gsl_bpic_url/$gsl_post_hf_2\"" - gsl_html_alt="alt=\"$gsl_post_hf_3\"" - + case "$align_image" in R|r|D|d) gsl_html_class="class=\"${gsl_site_css}_image_right\"" @@ -612,9 +606,12 @@ do ;; esac + gsl_html_src="src=\"$gsl_bpic_url/$gsl_post_hf_2\"" + gsl_html_alt="alt=\"$gsl_post_hf_3\"" gsl_html_image="" - gsl_post_image="$gsl_mark_image:$gsl_post_hf_1$align_image" - sed -i "${line_nbr}s|$gsl_post_image|$gsl_html_image|" "$gsl_tmp_post" + + echo -ne "\r\033[2K: Converting Image... Line:$line_nbr $this_image" + sed -i "${line_nbr}s|$this_image|$gsl_html_image|" "$gsl_tmp_post" done < <(grep -n "$gsl_this_mark" "$gsl_tmp_post") } @@ -676,10 +673,10 @@ done < <(grep "$gsl_marker_file" "$gsl_post") #----------------------------------------------------------------------- gsl__make_inline_codes() { gsl_HTML_inline_code="" -sed -i "s|$gsl_mo_code|$gsl_HTML_inline_code|g" \ - "$gsl_tmp_post" -sed -i "s|$gsl_mc_code||g" \ - "$gsl_tmp_post" +sed -i "s|$gsl_mo_code|$gsl_HTML_inline_code|g" \ + "$gsl_tmp_post" +sed -i "s|$gsl_mc_code||g" \ + "$gsl_tmp_post" } #----------------------------------------------------------------------- @@ -718,6 +715,7 @@ do gsl__make_a11y_add_space unset gsl_start_line fi + gsl_set_space=`expr substr "$gsl_line" 3 1` gsl_start_line=$gsl_line_nbr unset gsl_stop_line diff --git a/var/lib/gsl/scripts/gsl__post_manager b/var/lib/gsl/scripts/gsl__post_manager index ee2c7ff..2f0c256 100644 --- a/var/lib/gsl/scripts/gsl__post_manager +++ b/var/lib/gsl/scripts/gsl__post_manager @@ -59,7 +59,8 @@ do "Delete" \ "$gsl_post_type ; $gsl_post has changed" \ "$gsl_srv_wip_page" - fi + fi + if [[ -f "$gsl_file_db_post" ]];then rm -f "$gsl_file_db_post" && \ gsl__logs_print \ @@ -215,9 +216,9 @@ fi gsl__check_nbr_posts() { gsl_nbr_posts=`ls -1 *.gsl 2>/dev/null | wc -l` -! (( $gsl_nbr_posts >= 1 )) \ +(( $gsl_nbr_posts == 0 )) \ && echo "! No Posts found with .gsl extension" \ - && exit 1 + && exit } #====================================================================== diff --git a/var/lib/gsl/scripts/gsl__tools b/var/lib/gsl/scripts/gsl__tools index 1917268..9d49019 100644 --- a/var/lib/gsl/scripts/gsl__tools +++ b/var/lib/gsl/scripts/gsl__tools @@ -41,7 +41,7 @@ find . -maxdepth 1 -not -type d -type f \ && exit $gsl_nbr_domains (( $gsl_nbr_domains == 0 )) \ && echo "! No registred domain here: change or set folder. See help new" \ - && exit 1 + && exit gsl_find_domain=` find . -maxdepth 1 -not -type d -type f \ @@ -63,7 +63,7 @@ gsl_this_conf_domain=`grep "$1" "$gsl_file_db_domains"` ! [[ "$gsl_this_conf_domain" ]] \ && echo "! Domain Not found: $1" \ - && exit 1 + && exit gsl_dir_domain_tpl="$gsl_this_conf_domain/templates" gsl_dir_domain_files="$gsl_this_conf_domain/files"