Fix Italics, strongs, bolds in inline code
This commit is contained in:
parent
a2c31e41f4
commit
e45aee1e25
|
@ -58,9 +58,6 @@ case "$1" in
|
|||
gsl_stat_bolds=0
|
||||
;;
|
||||
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Strongs & Bolds..."
|
||||
;;
|
||||
esac
|
||||
|
||||
while read -r "strong"
|
||||
|
@ -73,7 +70,13 @@ do
|
|||
((gsl_stat_strongs++))
|
||||
;;
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Strong... $strong"
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$strong" ]] \
|
||||
&& continue
|
||||
|
||||
echo -ne "\r\033[2K: Converting Strong... $strong"
|
||||
gsl_strong="$gsl_mark_strong$strong$gsl_mark_strong"
|
||||
gsl_html_strong="<strong>$strong</strong>"
|
||||
sed -i "s|$gsl_strong|$gsl_html_strong|g" "$2"
|
||||
|
@ -85,8 +88,7 @@ done < <(grep -oP "(?<=$gsl_mark_strong).*?(?=$gsl_mark_strong)" "$2")
|
|||
|
||||
|
||||
# Bolds
|
||||
echo -ne "\r\033[2K: Counting Bolds..."
|
||||
while read -r "bold"
|
||||
while IFS=: read -r "n" "bold"
|
||||
do
|
||||
if [[ "$bold" ]] && \
|
||||
[[ `grep "$gsl_mark_bold$bold$gsl_mark_bold" "$2"` ]];then
|
||||
|
@ -94,17 +96,25 @@ do
|
|||
case "$1" in
|
||||
"stats")
|
||||
((gsl_stat_bolds++))
|
||||
echo -ne "\r\033[2K: Counting Bolds... $gsl_stat_bolds"
|
||||
;;
|
||||
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Bold... $bold"
|
||||
gsl_bold="$gsl_mark_bold$bold$gsl_mark_bold"
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$bold" ]] \
|
||||
&& continue
|
||||
|
||||
echo -ne "\r\033[2K: Converting Bold... Line $n: $bold"
|
||||
gsl_html_bold="<b>$bold</b>"
|
||||
sed -i "s|$gsl_bold|$gsl_html_bold|g" "$2"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
done < <(grep -oP "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2")
|
||||
done < <(grep -oPn "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2")
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
|
@ -123,12 +133,6 @@ do
|
|||
|
||||
[[ `awk -v l="$n" 'NR == l && $1 ~ "_link"' "$2"` ]] && continue
|
||||
|
||||
case "$1" in
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Italics..."
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$italic" ]] && \
|
||||
[[ `grep "$gsl_mark_italic$italic$gsl_mark_italic" "$2"` ]];then
|
||||
|
||||
|
@ -137,12 +141,17 @@ do
|
|||
((gsl_stat_italics++))
|
||||
;;
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Italic... $italic"
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$italic" ]] \
|
||||
&& continue
|
||||
|
||||
echo -ne "\r\033[2K: Converting Italic... $italic"
|
||||
gsl_italic="$gsl_mark_italic$italic$gsl_mark_italic"
|
||||
gsl_html_italic="<em>$italic</em>"
|
||||
sed -i "s|$gsl_italic|$gsl_html_italic|g" "$2"
|
||||
;;
|
||||
|
||||
esac
|
||||
fi
|
||||
done < <(grep -oPn "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2")
|
||||
|
@ -158,42 +167,35 @@ case "$1" in
|
|||
;;
|
||||
|
||||
"make")
|
||||
echo
|
||||
echo "Converting icodes..."
|
||||
gsl_html_icode_o="<code class=\"${gsl_site_css}-code\">"
|
||||
echo -ne "\r\033[2K: Convrting Inline-Codes..."
|
||||
;;
|
||||
esac
|
||||
gsl_html_icode_c="</code>"
|
||||
|
||||
echo -ne "\r\033[2K: Counting Inline-Codes..."
|
||||
while read -r "icode"
|
||||
while IFS=: read -r "n" "line"
|
||||
do
|
||||
if [[ "$icode" ]] && \
|
||||
[[ `grep "$gsl_mark_code$icode$gsl_mark_code" "$2"` ]];then
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
((gsl_stat_icode++))
|
||||
;;
|
||||
"make")
|
||||
echo -ne "\r\033[2K: Convrting Inline-Code... $icode"
|
||||
gsl_icode="$gsl_mark_code$icode$gsl_mark_code"
|
||||
gsl_html_icode="$gsl_html_icode_o$icode</code>"
|
||||
|
||||
for d in "${gsl_d[@]}"
|
||||
unset gsl_icode_open
|
||||
for i in $(seq 1 ${#line})
|
||||
do
|
||||
case "$icode" in
|
||||
*"$d"*)
|
||||
continue
|
||||
case "${line:i-1:1}" in
|
||||
"$gsl_mark_code")
|
||||
[[ "$gsl_icode_open" ]] \
|
||||
&& gsl_html_line+="$gsl_html_icode_c" \
|
||||
&& unset gsl_icode_open && continue
|
||||
|
||||
gsl_icode_open=true
|
||||
gsl_html_line+="$gsl_html_icode_o"
|
||||
;;
|
||||
*)
|
||||
sed -i "s${d}${gsl_icode}${d}${gsl_html_icode}${d}" "$2"
|
||||
break
|
||||
gsl_html_line+="${line:i-1:1}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
sed -i "${n}d" "$2"
|
||||
sed -i "${n}i$gsl_html_line" "$2"
|
||||
unset gsl_html_line
|
||||
done < <(grep -n "$gsl_mark_code" "$2")
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
done < <(grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)" "$2")
|
||||
}
|
||||
# awk '{ for ( i = 1; i < NF; ++i ) print NR,$i; }' "$2"
|
||||
|
|
|
@ -24,13 +24,13 @@ gsl__page_create_listing
|
|||
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__do_strongs_bolds "make" "$gsl_tmp_post"
|
||||
gsl__do_icode "make" "$gsl_tmp_post"
|
||||
gsl__make_titles
|
||||
gsl_ct=0 && gsl__make_titles_div_open
|
||||
gsl_ct=0 && gsl__make_titles_div_close
|
||||
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"
|
||||
|
||||
#echo -ne "\r\033[2K: Searching and converting Block-Codes..."
|
||||
#gsl__check_bcodes
|
||||
|
@ -135,12 +135,6 @@ gsl_html_long="<abbr title=\"$gsl_post_hf_2\">$gsl_post_hf_1</abbr>"
|
|||
sed -i "s|$gsl_post_hf_1|$gsl_html_long|" "$gsl_tmp_post"
|
||||
}
|
||||
|
||||
gsl_make_sb_show() {
|
||||
echo -ne "\r\033[2K: Converting... Line:$gsl_line_nbr $gsl_html_word"
|
||||
sed -i "s|$gsl_word_replace|$gsl_html_word|" "$gsl_tmp_post"
|
||||
unset ${!gsl_word@} ${!gsl_html@}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue