Fix: Images Alignement - + autres fix

This commit is contained in:
Cyrille L 2022-04-11 18:06:38 +02:00
parent 14196f870d
commit 64c30a31a5
7 changed files with 54 additions and 55 deletions

View File

@ -1,5 +1,5 @@
Package: egsl Package: egsl
Version: 0.0.12 Version: 0.0.13
Section: custom Section: custom
Priority: optional Priority: optional
Architecture: all Architecture: all

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Version: 0.0.12 # Version: 0.0.13
# file: gsl # file: gsl
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib
@ -11,18 +11,18 @@
if__command() { if__command() {
! [[ `command -v $1` ]] \ ! [[ `command -v $1` ]] \
&& echo -e "$I_Red Missing $1 command" \ && echo -e "$I_Red Missing $1 command" \
&& exit 1 && exit
} }
gsl__if_file() { gsl__if_file() {
if ! [[ -f "$1" ]];then if ! [[ -f "$1" ]];then
echo "! Missing file: $1" echo "! Missing file: $1"
exit 1 exit
fi fi
case "$2" in case "$2" in
source) source)
source "$1" || exit 1 source "$1" || exit
;; ;;
read) read)
cat "$1" cat "$1"
@ -190,7 +190,7 @@ gsl__create_ff
gsl__find_domain gsl__find_domain
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source 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_checkers" source
gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source
gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source
@ -205,7 +205,7 @@ case "$1" in
edit|-E) edit|-E)
! [[ "$2" ]] \ ! [[ "$2" ]] \
&& echo "! Missing argument: post [FILE]" \ && echo "! Missing argument: post [FILE]" \
&& exit 1 && exit
gsl__if_file "$2" post gsl__if_file "$2" post
if ! [[ "$EDITOR" ]];then if ! [[ "$EDITOR" ]];then
@ -257,7 +257,7 @@ case "$1" in
db) db)
! [[ "$2" ]] \ ! [[ "$2" ]] \
&& echo "! Missing argument: post [FILE]" \ && echo "! Missing argument: post [FILE]" \
&& exit 1 && exit
gsl__if_file "$2" post gsl__if_file "$2" post
[[ -f "$gsl_dir_db/$gsl_this_post.db" ]] \ [[ -f "$gsl_dir_db/$gsl_this_post.db" ]] \
@ -358,13 +358,13 @@ case "$1" in
;; ;;
*) *)
echo "! Bad Argument: $2" echo "! Bad Argument: $2"
exit 1 exit
;; ;;
esac esac
! [[ "$3" ]] \ ! [[ "$3" ]] \
&& echo "! Missing argument: post [FILE]" \ && echo "! Missing argument: post [FILE]" \
&& exit 1 && exit
gsl__if_file "$3" post gsl__if_file "$3" post
@ -389,7 +389,7 @@ case "$1" in
www) www)
! [[ "$2" ]] \ ! [[ "$2" ]] \
&& echo "! Missing argument: OPT=add/remove" \ && echo "! Missing argument: OPT=add/remove" \
&& exit 1 && exit
if__command rsync if__command rsync
gsl_www_act="$2" gsl_www_act="$2"
@ -402,13 +402,13 @@ case "$1" in
;; ;;
*) *)
echo "! Bad argument: $2 ? OPT=add/remove" echo "! Bad argument: $2 ? OPT=add/remove"
exit 1 exit
;; ;;
esac esac
! [[ "$3" ]] \ ! [[ "$3" ]] \
&& echo "! Missing argument: post [FILE]/all" \ && echo "! Missing argument: post [FILE]/all" \
&& exit 1 && exit
case "$3" in case "$3" in
all) all)
@ -419,7 +419,7 @@ case "$1" in
;; ;;
*) *)
echo "# Abandon" echo "# Abandon"
exit 1 exit
;; ;;
esac esac
;; ;;

View File

@ -112,7 +112,6 @@ do
sed -i "s|$gsl_bold|$gsl_html_bold|g" "$2" sed -i "s|$gsl_bold|$gsl_html_bold|g" "$2"
;; ;;
esac esac
fi fi
done < <(grep -oPn "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2") done < <(grep -oPn "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2")
@ -178,27 +177,27 @@ case "$1" in
gsl_html_icode_c="</code>" gsl_html_icode_c="</code>"
while IFS=: read -r "n" "line" while IFS=: read -r "n" "line"
do
unset gsl_icode_open
for i in $(seq 1 ${#line})
do do
unset gsl_icode_open case "${line:i-1:1}" in
for i in $(seq 1 ${#line}) "$gsl_mark_code")
do [[ "$gsl_icode_open" ]] \
case "${line:i-1:1}" in && gsl_html_line+="$gsl_html_icode_c" \
"$gsl_mark_code") && unset gsl_icode_open && continue
[[ "$gsl_icode_open" ]] \
&& gsl_html_line+="$gsl_html_icode_c" \ gsl_icode_open=true
&& unset gsl_icode_open && continue gsl_html_line+="$gsl_html_icode_o"
;;
gsl_icode_open=true *)
gsl_html_line+="$gsl_html_icode_o" gsl_html_line+="${line:i-1:1}"
;; ;;
*) esac
gsl_html_line+="${line:i-1:1}" done
;; sed -i "${n}d" "$2"
esac sed -i "${n}i$gsl_html_line" "$2"
done unset gsl_html_line
sed -i "${n}d" "$2"
sed -i "${n}i$gsl_html_line" "$2"
unset gsl_html_line
done < <(grep -n "$gsl_mark_code" "$2") done < <(grep -n "$gsl_mark_code" "$2")
;; ;;
esac esac

View File

@ -61,7 +61,7 @@ gsl__check_h1() {
echo -ne ": Searching for #1..." echo -ne ": Searching for #1..."
gsl_post_begin=` gsl_post_begin=`
grep -n "#1" $gsl_post \ grep -n "#1" $gsl_post \
| head -1 \ | head -1 \
| awk -F: '{print $1}'` | awk -F: '{print $1}'`
@ -226,6 +226,7 @@ if (( "$gsl_count_links" > 0 ));then
"$gsl_log_h_link" \ "$gsl_log_h_link" \
"Offline:$gsl_url_status ${gsl_post_hf_2:0:40}..." \ "Offline:$gsl_url_status ${gsl_post_hf_2:0:40}..." \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
# Decomment below if you want the error link avoiding convertion
#gsl_checker_err=true #gsl_checker_err=true
return return
;; ;;

View File

@ -588,15 +588,9 @@ esac
while IFS=: read -r "line_nbr" "this_image" while IFS=: read -r "line_nbr" "this_image"
do do
align_image=`awk -F: '{print $3}' <<< "$this_image"` 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 case "$align_image" in
R|r|D|d) R|r|D|d)
gsl_html_class="class=\"${gsl_site_css}_image_right\"" gsl_html_class="class=\"${gsl_site_css}_image_right\""
@ -612,9 +606,12 @@ do
;; ;;
esac esac
gsl_html_src="src=\"$gsl_bpic_url/$gsl_post_hf_2\""
gsl_html_alt="alt=\"$gsl_post_hf_3\""
gsl_html_image="<img $gsl_html_src $gsl_html_class $gsl_html_alt />" gsl_html_image="<img $gsl_html_src $gsl_html_class $gsl_html_alt />"
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") 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__make_inline_codes() {
gsl_HTML_inline_code="<code class=\"${gsl_site_css}_inline-code\">" gsl_HTML_inline_code="<code class=\"${gsl_site_css}_inline-code\">"
sed -i "s|$gsl_mo_code|$gsl_HTML_inline_code|g" \ sed -i "s|$gsl_mo_code|$gsl_HTML_inline_code|g" \
"$gsl_tmp_post" "$gsl_tmp_post"
sed -i "s|$gsl_mc_code|</code>|g" \ sed -i "s|$gsl_mc_code|</code>|g" \
"$gsl_tmp_post" "$gsl_tmp_post"
} }
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -718,6 +715,7 @@ do
gsl__make_a11y_add_space gsl__make_a11y_add_space
unset gsl_start_line unset gsl_start_line
fi fi
gsl_set_space=`expr substr "$gsl_line" 3 1` gsl_set_space=`expr substr "$gsl_line" 3 1`
gsl_start_line=$gsl_line_nbr gsl_start_line=$gsl_line_nbr
unset gsl_stop_line unset gsl_stop_line

View File

@ -59,7 +59,8 @@ do
"Delete" \ "Delete" \
"$gsl_post_type ; $gsl_post has changed" \ "$gsl_post_type ; $gsl_post has changed" \
"$gsl_srv_wip_page" "$gsl_srv_wip_page"
fi fi
if [[ -f "$gsl_file_db_post" ]];then if [[ -f "$gsl_file_db_post" ]];then
rm -f "$gsl_file_db_post" && \ rm -f "$gsl_file_db_post" && \
gsl__logs_print \ gsl__logs_print \
@ -215,9 +216,9 @@ fi
gsl__check_nbr_posts() { gsl__check_nbr_posts() {
gsl_nbr_posts=`ls -1 *.gsl 2>/dev/null | wc -l` 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" \ && echo "! No Posts found with .gsl extension" \
&& exit 1 && exit
} }
#====================================================================== #======================================================================

View File

@ -41,7 +41,7 @@ find . -maxdepth 1 -not -type d -type f \
&& exit $gsl_nbr_domains && exit $gsl_nbr_domains
(( $gsl_nbr_domains == 0 )) \ (( $gsl_nbr_domains == 0 )) \
&& echo "! No registred domain here: change or set folder. See help new" \ && echo "! No registred domain here: change or set folder. See help new" \
&& exit 1 && exit
gsl_find_domain=` gsl_find_domain=`
find . -maxdepth 1 -not -type d -type f \ 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" ]] \ ! [[ "$gsl_this_conf_domain" ]] \
&& echo "! Domain Not found: $1" \ && echo "! Domain Not found: $1" \
&& exit 1 && exit
gsl_dir_domain_tpl="$gsl_this_conf_domain/templates" gsl_dir_domain_tpl="$gsl_this_conf_domain/templates"
gsl_dir_domain_files="$gsl_this_conf_domain/files" gsl_dir_domain_files="$gsl_this_conf_domain/files"