19 lines
760 B
Plaintext
19 lines
760 B
Plaintext
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} == *"#ytvideo"* ]]; then
|
|
if (${debug}) _msg debug "${0:t}_msg_1" " ${line}"
|
|
local yt_id=$(echo "${line}" | awk -F'#ytvideo ' '{print $2}')
|
|
local yt_iframe="<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/${yt_id}\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>"
|
|
line=${line//"#ytvideo ${yt_id}"/${yt_iframe}}
|
|
fi
|
|
modified_content+="${line}\n"
|
|
done
|
|
echo -e "${modified_content}"
|