1 ### vim:ft=zsh:foldmethod=marker
2 ## url encoding for lookup queries, etc.
4 LOOKUP_guard || return 1
7 local input output ws=$'\t '
10 lu_parseopts_args=( s bool q bool )
11 LOOKUP_parseopts "$@" || return 1
12 if [[ ${opts[-q]} == 'yes' ]] ; then
13 # -q: QUERY is declared 'local -x QUERY' in backends.
14 # That means, it gets handed down to us. Apply our filters to it.
22 output=${(j::)input/(#b)([^A-Za-z0-9_${ws}.!~*\'\(\)+-])/%${(l:2::0:)$(([##16]#match))}}
24 if [[ ${opts[-s]} == 'yes' ]] ; then
25 output=${${output##[$ws]#}%%[$ws]#}
26 output="${output//+/%2B}"
27 output=${output//[$ws]##/+}
29 output="${output//[$ws]/%20}"
32 if [[ ${opts[-q]} == 'yes' ]] ; then