fix: link in listing ; images converter > 0.0.7

This commit is contained in:
Cyrille L 2022-04-07 17:12:50 +02:00
parent a42499c48c
commit 9b7f033e5b
4 changed files with 47 additions and 21 deletions

View File

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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# Version: 0.0.6
# Version: 0.0.7
# file: gsl
# Folder: /usr/local/bin
# By echolib

View File

@ -18,7 +18,9 @@ gsl__page_creator() {
gsl__check_templates
gsl__html_meta_head
gsl__page_create
cat -n "$gsl_srv_wip_page"
# Show html result in terminal
#cat -n "$gsl_srv_wip_page"
}
#======================================================================
@ -142,9 +144,15 @@ cat `ls -1r "$gsl_dir_domain_listings/"*.list.*` \
# Create HTML List from selected Post
#======================================================================
gsl__page_listing_create_file() {
# Set HTML Base Link
case "$gsl_post_type" in
post) gsl_bpost_url="$gsl_header_slug/index.html" ;;
page) gsl_bpost_url="$gsl_header_slug.html" ;;
esac
cat << EOPostSide > "$1"
<li>
<span class="${gsl_site_css}_list-post-title">$gsl_header_title</span>
<span class="${gsl_site_css}_list-post-title"><a href="$gsl_site_url/$gsl_bpost_url" class="${gsl_site_css}_list-post-link">$gsl_header_title</a></span>
<div class="${gsl_site_css}_list-post-metas">Le $gsl_header_date par $gsl_header_author<div>
<div class="${gsl_site_css}_list-post-info">$gsl_header_info</div>
</li>

View File

@ -26,7 +26,6 @@ gsl__do_italics "make" "$gsl_tmp_post" # First
gsl__do_header "make" "$gsl_marker_link" "$gsl_post"
gsl__do_header "make" "$gsl_marker_abbr" "$gsl_post"
gsl__make_files
gsl__do_strongs_bolds "make" "$gsl_tmp_post"
gsl__make_list
gsl__do_icode "make" "$gsl_tmp_post"
@ -260,14 +259,14 @@ done < <(grep -n "$gsl_mark_fcode" "$gsl_tmp_post" | head -n 1)
# From gsl__do_header: Make Link
#======================================================================
gsl__make_link() {
echo -ne "\r\033[2K: Converting Links... $gsl_post_hf_1"
gsl_post_hf_1="${gsl_post_hf_1}"
gsl_post_hf_1_t="${gsl_post_hf_1}+"
[[ "$sl_post_hf_3" ]] \
&& gsl_html_link_title=" title=\"$sl_post_hf_3\""
echo -ne "\r\033[2K: Converting Links... $gsl_post_hf_1"
# target blank
gsl_html_link_t=`
printf '%s%s%s%s' \
@ -300,12 +299,13 @@ sed -i "s|$gsl_post_hf_1|$gsl_html_long|" "$gsl_tmp_post"
# Find and convert Titles #1-6
#=======================================================================
gsl__make_titles() {
echo -ne ": Searching and converting Titles..."
for t in `seq 1 6`
do
while read -r "h" "content"
do
gsl_html_title="<h$t>$content</h$t>"
echo -ne "\r\033[2K: Converting Titles... $content"
sed -i "s^$h $content^$gsl_html_title^" \
"$gsl_tmp_post"
done < <(grep "#$t" "$gsl_tmp_post")
@ -318,7 +318,7 @@ done
# Open DIVs after titles for css
#=======================================================================
gsl__make_titles_div_open() {
echo -ne "\r\033[2K: Searching Titles and Open DIVs..."
echo -ne "\r\033[2K: Searching Titles and Opening DIVs..."
gsl_ct=$(( gsl_ct + 1 ))
gsl_content_title=`
@ -350,7 +350,7 @@ gsl__make_titles_div_open
# Close DIVs before titles for css
#=======================================================================
gsl__make_titles_div_close() {
echo -ne "\r\033[2K: Searching Titles and Open DIVs..."
echo -ne "\r\033[2K: Searching Titles and Closing DIVs..."
gsl_test_line="<div class=\"${gsl_site_css}_content"
@ -579,14 +579,25 @@ EOCITE
# Convert HTML: Images
#-----------------------------------------------------------------------
gsl__make_image() {
echo
gsl_this_mark="$gsl_mark_image:$gsl_post_hf_1"
# Set HTML base Link
case "$gsl_post_type" in
post) gsl_bpic_url="../images" ;;
page) gsl_bpic_url="images" ;;
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_uri/images/$gsl_post_hf_2\""
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\""
@ -597,10 +608,15 @@ do
C|c)
gsl_html_class="class=\"${gsl_site_css}_image_center\""
;;
*)
gsl_html_class="class=\"${gsl_site_css}_image_center\""
;;
esac
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"
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"
done < <(grep -n "$gsl_this_mark" "$gsl_tmp_post")
}
@ -609,6 +625,13 @@ done < <(grep -n "$gsl_this_mark" "$gsl_tmp_post")
#-----------------------------------------------------------------------
gsl__make_files() {
echo
# Set HTML Base Link
case "$gsl_post_type" in
post) gsl_bfile_url="../files" ;;
page) gsl_bfile_url="files" ;;
esac
while read -r "gsl_this_file"
do
gsl_this_file=${gsl_this_file/$gsl_marker_file/}
@ -631,23 +654,18 @@ do
[[ "$gsl_filealt" ]] \
&& gsl_HTML_file_title=" title=\"$gsl_filealt\""
# Set HTML Link
case "$gsl_post_type" in
post) gsl_HTML_file_url="../files/$gsl_filename" ;;
page) gsl_HTML_file_url="files/$gsl_filename" ;;
esac
# Convert file to link
gsl_mark_file="$gsl_mark_file$gsl_filetxt"
gsl_HTML_file_link=`
printf '%s%s%s%s%s%s' \
"<a href=\"$gsl_HTML_file_url\"" \
"<a href=\"$gsl_bfile_url/$gsl_filename\"" \
"$gsl_HTML_file_title" \
" target=\"_blank\"" \
" class=\"${gsl_site_css}_file-link\">" \
"$gsl_filetxt" \
"</a>"`
echo -ne "\r\033[2K: Converting File... $gsl_mark_file"
sed -i "s|$gsl_mark_file|$gsl_HTML_file_link|g" \
"$gsl_tmp_post"