fix: convert link files +media link > 0.0.7

This commit is contained in:
Cyrille L 2022-04-07 14:58:26 +02:00
parent 77b3d02798
commit 00d3a3cd01
5 changed files with 34 additions and 20 deletions

View File

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

View File

@ -92,6 +92,7 @@ gsl_log_c_file="Content File"
#-----------------------------------------------------------------------
gsl_mo_p='('
gsl_mc_p=')'
gsl_mark_file='__'
gsl_mark_image='_image'
gsl_mark_fcode='_code'
gsl_mark_title='#'

View File

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

View File

@ -293,7 +293,7 @@ cat << EOMETAS >> "$gsl_html_meta"
<meta name='revisit-after' content="3 days">
<title>$gsl_header_title - $gsl_site_title</title>
<link rel="stylesheet" "media="screen" href="$gsl_uri/templates/styles.css" />
<link rel="stylesheet" media="screen" href="$gsl_uri/templates/styles.css" />
<link rel="shortcut icon" type="image/png" href="$gsl_uri/templates/favicon.png" />
<link rel='me' type='text/html' href="$gsl_site_auth_url">

View File

@ -25,6 +25,10 @@ gsl__page_listing_create Add
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
echo "M> $gsl_mark_file"
gsl__do_strongs_bolds "make" "$gsl_tmp_post"
gsl__make_list
gsl__do_icode "make" "$gsl_tmp_post"
@ -606,50 +610,59 @@ done < <(grep -n "$gsl_this_mark" "$gsl_tmp_post")
# Convert HTML: Files
#-----------------------------------------------------------------------
gsl__make_files() {
! [[ "$gsl_header_files" ]] \
&& return
echo
while read -r "gsl_this_file"
do
gsl_this_file=${gsl_this_file/file: /}
echo "Line> $gsl_this_file"
gsl_filetxt=`
awk -F" : " \
'{print $1}' \
<<< "$gsl_this_file"`
echo "1> $gsl_filetxt"
gsl_filename=`
awk -F" : " \
-v s="$gsl_marker_file$gsl_this_file" \
'match($0,s) {print $2}' \
"$gsl_post"`
'{print $2}' \
<<< "$gsl_this_file"`
echo "2> $gsl_filename"
gsl_filealt=`
awk -F" : " \
-v s="$gsl_marker_file$gsl_this_file" \
'match($0,s) {print $3}' \
"$gsl_post"`
'{print $3}' \
<<< "$gsl_this_file"`
echo "3> $gsl_filealt"
[[ "$gsl_filealt" ]] \
&& gsl_HTML_file_title=" title=\"$gsl_filealt\""
sleep 2
# Set HTML Link
case "$gsl_post_type" in
post) gsl_HTML_file_url="./files/$gsl_filename" ;;
page) gsl_HTML_file_url="../files/$gsl_filename" ;;
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_mo_file$gsl_this_file$gsl_mc_file"
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\"" \
"$gsl_HTML_file_title" \
" target=\"_blank\"" \
" class=\"${gsl_site_css}_file-link\">" \
"$gsl_this_file" \
"$gsl_filetxt" \
"</a>"`
sed -i "s|$gsl_mark_file|$gsl_HTML_file_link|g" \
"$gsl_tmp_post"
done < <(gsl__get_content_finder \
-o "$gsl_mo_file" \
-c "$gsl_mc_file" \
-f "$gsl_tmp_post")
done < <(grep "$gsl_marker_file" "$gsl_post")
}
#-----------------------------------------------------------------------