" gsl_html_par_o2="
" gsl_html_par_o3="
" gsl_html_par_c="
" echo -ne "\r\033[2K: Converting Paragraphs..." while read -r "gsl_content_line_nbr" "gsl_content_line" do case "$gsl_content_line" in ")") sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_c," \ "$gsl_tmp_post" ;; "("|"( 1") sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o1," \ "$gsl_tmp_post" ;; "( 2") sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o2," \ "$gsl_tmp_post" ;; "( 3") sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o3," \ "$gsl_tmp_post" ;; *) continue ;; esac done < <(cat -n "$gsl_tmp_post") } #======================================================================= # Replace gsl_mark_code #======================================================================= gsl__make_bcode() { # Get mark line nbr gsl_line_nbr=` gsl__get_mark_content_line \ "$gsl_mark_code" \ "$gsl_tmp_post" | head -1` #--------- # Convert #--------- gsl_css_class="${gsl_site_css}_block-code" gsl_header_content_line=`gsl__get_header "$gsl_marker_code" "$gsl_post"` gsl_file_tmp_code=`mktemp` # Set gsl_post_header_field_1 gsl_post_header_field_2 gsl__get_header_fields "$gsl_marker_code" # Create tmp file from block-code, adding span to get number lines in css gsl_file_bcode=`mktemp` while read -r "gsl_bcode_line" do echo "$gsl_bcode_line" >> "$gsl_file_bcode" done < <(cat "$gsl_dir_domain_files/$gsl_post_header_field_2") printf '%s %s\n%b\n%s\n' \ "" \ "$(cat "$gsl_file_bcode")" \ "" \ > "$gsl_file_tmp_code" sed -i "${gsl_line_nbr}r $gsl_file_tmp_code" "$gsl_tmp_post" sed -i "${gsl_line_nbr}d" "$gsl_tmp_post" rm -f "$gsl_file_tmp_code" rm -f "$gsl_file_bcode" } #----------------------------------------------------------------------- #======================================================================= # Replace and Convert this blockquote #======================================================================= gsl__make_cite() { gsl_file_tmp_cite=`mktemp` # File to Put whole Blockquote gsl_file_tmp_cite_content=`mktemp` # File to Put Blockquote CONTENT only gsl_file_tmp_cite_html=`mktemp` # File to Put final HTML blockquote # Put whole blockquote in file awk -v o="$gsl_cite_line_start" -v c="$gsl_cite_line_stop" \ 'NR >= o && NR <= c' \ "$gsl_tmp_post" \ > "$gsl_file_tmp_cite" # No more DATAS needed for next if any unset ${!gsl_bq_@} ${!gsl_html_cite_@} # Get DATAS from blockquote while read -r "gsl_content_line" do case "$gsl_content_line" in ---*) continue ;; _cite*) gsl_bq_author=`awk -F" : " '{print $2}' <<< "$gsl_content_line"` ;; _book*) gsl_bq_book=`awk -F" : " '{print $2}' <<< "$gsl_content_line"` ;; _lang*) gsl_bq_lang=`awk -F" : " '{print $2}' <<< "$gsl_content_line"` gsl_html_cite_lang=" lang=\"$gsl_bq_lang\"" ;; _year*) gsl_bq_year=`awk -F" : " '{print $2}' <<< "$gsl_content_line"` ;; _link*) gsl_bq_link=`awk -F" : " '{print $2}' <<< "$gsl_content_line"` gsl_html_cite_link=" cite=\"$gsl_bq_link\"" ;; *) [[ "$gsl_bq_author" ]] \ && echo " $gsl_content_line" >> "$gsl_file_tmp_cite_content" \ || echo " $gsl_content_line" >> "$gsl_file_tmp_cite_content" ;; esac done < <(cat "$gsl_file_tmp_cite") [[ "$gsl_bq_book" ]] \ && gsl_bq_ref=" - $gsl_bq_book" [[ "$gsl_bq_year" ]] \ && gsl_bq_ref+=" ($gsl_bq_year)" [[ "$gsl_bq_book" ]] \ && gsl_html_cite_book=" title=\"Book:$gsl_bq_ref\"" ! [[ "$gsl_bq_link" ]] && [[ "$gsl_bq_book" ]] \ && gsl_html_cite_link=" cite=\"$gsl_bq_book$gsl_bq_year\"" rm -f "$gsl_file_tmp_cite" # No more whole blockquote file needed gsl_file_tmp_cite=`mktemp` # File to put Converted HTML DATAS # Advanced or simple blockquote [[ "$gsl_bq_author" ]] \ && gsl__make_cite_advanced \ || gsl__make_cite_simple # Insert html blockquote file in Post sed -i "${gsl_cite_line_stop}r $gsl_file_tmp_cite_html" "$gsl_tmp_post" # Remove useless lines gsl_cite_total_lines=$(( $gsl_cite_line_stop - gsl_cite_line_start )) for i in `seq 0 $gsl_cite_total_lines` do sed -i "${gsl_cite_line_start}d" "$gsl_tmp_post" done rm -f "$gsl_file_tmp_cite_content" # No more blockquote CONTENT needed rm -f "$gsl_file_tmp_cite_html" # No more html blockquote file needed } #======================================================================= # from gsl__post_maker_cite : ADVANCED blockquote #======================================================================= gsl__make_cite_advanced() { gsl_css_class="class=\"${gsl_site_css}_quote\"" cat << EOCITE > "$gsl_file_tmp_cite_html" EOCITE } #======================================================================= # from gsl__post_maker_cite : SIMPLE blockquote #======================================================================= gsl__make_cite_simple() { gsl_css_class="${gsl_site_css}_simple-quote" cat << EOCITE > "$gsl_file_tmp_cite_html"
$(cat "$gsl_file_tmp_cite_content")EOCITE } #----------------------------------------------------------------------- #----------------------------------------------------------------------- # Convert HTML: Images #----------------------------------------------------------------------- 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="" 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") } #----------------------------------------------------------------------- # Convert HTML: Files #----------------------------------------------------------------------- gsl__make_files() { ! [[ "$gsl_header_files" ]] \ && return while read -r "gsl_this_file" do gsl_filename=` awk -F" : " \ -v s="$gsl_marker_file$gsl_this_file" \ 'match($0,s) {print $2}' \ "$gsl_post"` gsl_filealt=` awk -F" : " \ -v s="$gsl_marker_file$gsl_this_file" \ 'match($0,s) {print $3}' \ "$gsl_post"` [[ "$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_mo_file$gsl_this_file$gsl_mc_file" gsl_HTML_file_link=` printf '%s%s%s%s%s%s' \ "" \ "$gsl_this_file" \ ""` 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") } #----------------------------------------------------------------------- # Convert Inline-code #----------------------------------------------------------------------- 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"
}
#-----------------------------------------------------------------------
# Reading Code ; making readability
#-----------------------------------------------------------------------
gsl__make_a11y() {
echo -ne "\r\033[2K: Reading HTML Code for readability..."
gsl__make_a11y_add_space() {
gsl_set_space=$(( gsl_set_space * 2 ))
gsl_space=`printf "%${gsl_set_space}s" ""`
awk -v b="$gsl_start_line" \
-v c="$gsl_stop_line" \
-v space="$gsl_space" \
'NR > b && NR < c {print space $0}' \
"$gsl_tmp_post" \
>> "$gsl_a11y_post"
}
gsl_last_title_line=`
grep -n "