Skip to content

Commit

Permalink
Make templates sturdier by wrapping values with quotes
Browse files Browse the repository at this point in the history
Allows templates to handle variables with spaces in them, by wrapping
values with quotes. Fixes bbugyi200#24.
  • Loading branch information
hardyoyo committed Jan 9, 2022
1 parent e4315c4 commit aa476c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cookie
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ function template_engine() {
evalue="$(eval "echo \"\$${evar}\"")"
if [[ -z "${evalue}" ]]; then
read -p "${evar}: " evalue <&5
eval "${evar}=${evalue}"
eval "${evar}=\"${evalue}\""
fi

new_contents="$(echo "${new_contents}" | sed "s/{{[ ]*${evar}[ ]*}}/${evalue}/g")"
Expand Down

0 comments on commit aa476c1

Please sign in to comment.