[WIP] Initial commit for qsgen3
This commit is contained in:
18
docs/zsdoc/data/functions/qsgen2/_youtube
Normal file
18
docs/zsdoc/data/functions/qsgen2/_youtube
Normal file
@ -0,0 +1,18 @@
|
||||
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}"
|
Reference in New Issue
Block a user