[WIP] Initial commit for qsgen3
This commit is contained in:
28
docs/zsdoc/data/functions/qsgen2/_image
Normal file
28
docs/zsdoc/data/functions/qsgen2/_image
Normal file
@ -0,0 +1,28 @@
|
||||
if [[ ${globaldebug} == "true" ]]; then
|
||||
local debug=true
|
||||
else
|
||||
local debug=false
|
||||
fi
|
||||
|
||||
local content="${1}"
|
||||
local modified_content=""
|
||||
echo "${content}" | while IFS= read -r line; do
|
||||
if [[ ${line} == *"#showimg"* ]]; then
|
||||
if (${debug}) _msg debug "${0:t}_msg_1" " ${line}"
|
||||
local img_link=$(echo "${line}" | awk -F'#showimg ' '{print $2}')
|
||||
local image=$(echo "${img_link}" | awk -F'¤' '{print $1}')
|
||||
local img_alt=$(echo "${img_link}" | awk -F'¤' '{print $2}')
|
||||
local real_image=""
|
||||
if [[ ${image} =~ ^https?:// ]]; then
|
||||
real_image=${image}
|
||||
elif [[ ${image} =~ ^\/ ]]; then
|
||||
real_image=${image}
|
||||
else
|
||||
real_image="/images/${image}"
|
||||
fi
|
||||
local img_tag="<img src=\"${real_image}\" alt=\"${img_alt}\" width=\"500\" />"
|
||||
line=${line//"#showimg ${img_link}"/${img_tag}}
|
||||
fi
|
||||
modified_content+="${line}\n"
|
||||
done
|
||||
echo -e "${modified_content}"
|
Reference in New Issue
Block a user