Fixes Italics + Image Converter
This commit is contained in:
parent
f9bdad2da2
commit
6e9acd406d
|
@ -90,8 +90,8 @@ gsl_log_c_file="Content File"
|
|||
#-----------------------------------------------------------------------
|
||||
gsl_mo_p='('
|
||||
gsl_mc_p=')'
|
||||
gsl_mark_image='_image_'
|
||||
gsl_mark_code='_code_'
|
||||
gsl_mark_image='_image'
|
||||
gsl_mark_code='_code'
|
||||
gsl_mark_title='#'
|
||||
gsl_mark_bold='\*'
|
||||
gsl_mark_strong='\*\*'
|
||||
|
|
|
@ -180,10 +180,11 @@ _My Great Link+ # Open in new tab
|
|||
__My Great file
|
||||
|
||||
# Register in Header. image: 1 : FILENAME : ALT-TEXT
|
||||
__image:1
|
||||
_image:1:[OPT l|r|c (left, right, center, alignment)]
|
||||
_image:1:r
|
||||
|
||||
# Block-Code File: Register in Header. code: 1 : FILENAME : Alt Text
|
||||
__code:1
|
||||
_code:1
|
||||
|
||||
# Write in STRONG
|
||||
**this strong content**
|
||||
|
|
|
@ -65,10 +65,11 @@ _My Great Link+ # Open in new tab
|
|||
__My Great file
|
||||
|
||||
# Register in Header. image: 1 : FILENAME : ALT-TEXT
|
||||
__image:1
|
||||
_image:1:[OPT l|r|c (left, right, center, alignment)]
|
||||
_image:1:r
|
||||
|
||||
# Block-Code File: Register in Header. code: 1 : FILENAME : Alt Text
|
||||
__code:1
|
||||
_code:1
|
||||
|
||||
# Write in STRONG
|
||||
**this strong content**
|
||||
|
|
|
@ -21,8 +21,6 @@ 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() {
|
||||
unset ${!gsl_post_hf@}
|
||||
|
||||
while read -r "gsl_header_content_line"
|
||||
do
|
||||
gsl__get_header_fields "$2"
|
||||
|
@ -42,6 +40,7 @@ do
|
|||
case "$2" in
|
||||
"$gsl_marker_link") gsl__make_link ;;
|
||||
"$gsl_marker_abbr") gsl__make_abbr ;;
|
||||
"$gsl_marker_image") gsl__make_image ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
@ -118,19 +117,18 @@ esac
|
|||
# Do Italics + Get STATS | $1: Process $2:File
|
||||
#======================================================================
|
||||
gsl__do_italics() {
|
||||
case "$1" in
|
||||
"stats")
|
||||
gsl_stat_italics=0
|
||||
;;
|
||||
echo -ne "\r\033[2K: Counting Italics..."
|
||||
while IFS=: read -r "n" "italic"
|
||||
do
|
||||
|
||||
[[ `awk -v l="$n" 'NR == l && $1 ~ "_link"' "$2"` ]] && continue
|
||||
|
||||
case "$1" in
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Italics..."
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
echo -ne "\r\033[2K: Counting Italics..."
|
||||
while read -r "italic"
|
||||
do
|
||||
if [[ "$italic" ]] && \
|
||||
[[ `grep "$gsl_mark_italic$italic$gsl_mark_italic" "$2"` ]];then
|
||||
|
||||
|
@ -147,7 +145,7 @@ do
|
|||
|
||||
esac
|
||||
fi
|
||||
done < <(grep -oP "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2")
|
||||
done < <(grep -oPn "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2")
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MAIN
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__page_creator() {
|
||||
gsl__page_prepare_datas
|
||||
#gsl__page_prepare_datas
|
||||
gsl__check_templates
|
||||
gsl__html_meta_head
|
||||
gsl__page_create
|
||||
|
@ -25,7 +25,7 @@ cat -n "$gsl_srv_wip_page"
|
|||
# Get Datas for Post/Page
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__page_prepare_datas() {
|
||||
echo "$gsl_this_conf_domain"
|
||||
echo "D> $gsl_this_conf_domain"
|
||||
|
||||
# Check for Files & Folders in server
|
||||
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
||||
|
|
|
@ -16,6 +16,7 @@ unset gsl_check_done
|
|||
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
|
||||
|
|
|
@ -14,18 +14,20 @@
|
|||
# From: gsl__loop_posts | Convert Post from modules to HTML
|
||||
#=======================================================================
|
||||
gsl__all_makers() {
|
||||
clear
|
||||
unset gsl_check_done
|
||||
gsl__prepare_makers
|
||||
gsl__do_italics make "$gsl_tmp_post"
|
||||
gsl__do_header make "$gsl_marker_link" "$gsl_tmp_post"
|
||||
gsl__do_header make "$gsl_marker_abbr" "$gsl_tmp_post"
|
||||
gsl__page_prepare_datas
|
||||
|
||||
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_titles
|
||||
gsl_ct=0 && gsl__make_titles_div_open
|
||||
gsl_ct=0 && gsl__make_titles_div_close
|
||||
gsl__do_strongs_bolds make "$gsl_tmp_post"
|
||||
gsl__do_header "make" "$gsl_marker_image" "$gsl_post"
|
||||
gsl__do_strongs_bolds "make" "$gsl_tmp_post"
|
||||
gsl__make_paragraphs
|
||||
gsl__do_icode make "$gsl_tmp_post"
|
||||
gsl__do_icode "make" "$gsl_tmp_post"
|
||||
|
||||
#echo -ne "\r\033[2K: Searching and converting Block-Codes..."
|
||||
#gsl__check_bcodes
|
||||
|
@ -33,9 +35,7 @@ gsl__do_icode make "$gsl_tmp_post"
|
|||
gsl__check_cites
|
||||
gsl__make_a11y
|
||||
echo -ne "\r\033[2K"
|
||||
|
||||
# No more Needed tmp file post
|
||||
rm -f "$gsl_tmp_post"
|
||||
rm -f "$gsl_tmp_post" # No more Needed tmp file post
|
||||
|
||||
# Create HTML Page using gsl_a11y_post
|
||||
# cat "$gsl_a11y_post"
|
||||
|
@ -80,7 +80,7 @@ source "$gsl_this_conf_domain/$gsl_find_domain.conf"
|
|||
gsl__get_needed_headers
|
||||
|
||||
# Get extra Headers DATAS
|
||||
gsl_header_images=`gsl__get_header "$gsl_marker_image" "$gsl_post"`
|
||||
#gsl_header_images=`gsl__get_header "$gsl_marker_image" "$gsl_post"`
|
||||
gsl__post_content_only
|
||||
|
||||
# Code readability a11y
|
||||
|
@ -300,7 +300,7 @@ gsl_html_par_o2="<p class=\"${gsl_site_css}_paragraph-2\">"
|
|||
gsl_html_par_o3="<p class=\"${gsl_site_css}_paragraph-3\">"
|
||||
gsl_html_par_c="</p>"
|
||||
|
||||
echo -ne "\r\033[2K: Searching and converting Paragraphs..."
|
||||
echo -ne "\r\033[2K: Converting Paragraphs..."
|
||||
|
||||
while read -r "gsl_content_line_nbr" "gsl_content_line"
|
||||
do
|
||||
|
@ -490,9 +490,30 @@ EOCITE
|
|||
#-----------------------------------------------------------------------
|
||||
# Convert HTML: Images
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__make_images() {
|
||||
! [[ "$gsl_header_images" ]] \
|
||||
&& return
|
||||
gsl__make_image() {
|
||||
echo
|
||||
gsl_this_mark="$gsl_mark_image:$gsl_post_hf_1"
|
||||
while IFS=: read -r "line_nbr" "this_image"
|
||||
do
|
||||
align_image=`awk -F: '{print $3}' <<< "$this_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_alt="alt=\"$gsl_post_hf_3\""
|
||||
case "$align_image" in
|
||||
R|r|D|d)
|
||||
gsl_html_class="class=\"${gsl_site_css}_image_right\""
|
||||
;;
|
||||
L|l|G|g)
|
||||
gsl_html_class="class=\"${gsl_site_css}_image_left\""
|
||||
;;
|
||||
C|c)
|
||||
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"
|
||||
sed -i "${line_nbr}s|$gsl_post_image|$gsl_html_image|" "$gsl_tmp_post"
|
||||
done < <(grep -n "$gsl_this_mark" "$gsl_tmp_post")
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue