_qstags: Let's try a simpler substitution for speed
This commit is contained in:
parent
d3ccb64a73
commit
81b22db011
18
qsgen2
18
qsgen2
@ -1284,13 +1284,17 @@ function _qstags() {
|
||||
"#LT" "<" "#GT" ">" "#NUM" "#"
|
||||
)
|
||||
|
||||
for qstag html (${(kv)qstags})
|
||||
do
|
||||
# Escape tag for regex use
|
||||
local escapedTag=$(printf '%s' "$qstag" | sed 's/[].\[^$*]/\\&/g')
|
||||
if [[ "$content" =~ "$escapedTag" ]]; then
|
||||
content=${content//($qstag)/$html}
|
||||
fi
|
||||
#for qstag html (${(kv)qstags})
|
||||
# do
|
||||
# # Escape tag for regex use
|
||||
# local escapedTag=$(printf '%s' "$qstag" | sed 's/[].\[^$*]/\\&/g')
|
||||
# if [[ "$content" =~ "$escapedTag" ]]; then
|
||||
# content=${content//($qstag)/$html}
|
||||
# fi
|
||||
#done
|
||||
for qstag html (${(kv)qstags}); do
|
||||
# Direct replacement without regex check
|
||||
content=${content//${qstag}/${html}}
|
||||
done
|
||||
|
||||
echo "${content}"
|
||||
|
Loading…
Reference in New Issue
Block a user