mirror of
https://github.com/Luzifer/korvike.git
synced 2024-11-09 16:00:09 +00:00
Add urlescape function
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
695b089692
commit
2b2aadc279
2 changed files with 13 additions and 0 deletions
|
@ -67,6 +67,12 @@
|
|||
$ echo '{{ tplexec (file "my.tpl") }}' | korvike
|
||||
bar
|
||||
```
|
||||
- `{{ urlescape <input string> }}`
|
||||
Do an URL escape to use the input string inside an query parameter in an URL
|
||||
```console
|
||||
$ echo '{{ urlescape "Hellö Wörld@Golang" }}' | korvike
|
||||
Hell%C3%B6+W%C3%B6rld%40Golang
|
||||
```
|
||||
- `{{ vault <path> <key> [default value] }}`
|
||||
Read a key from Vault using `VAULT_ADDR` and `VAULT_TOKEN` environment variables (or `~/.vault-token` file) for authentication.
|
||||
```console
|
||||
|
|
7
functions/func_urlescape.go
Normal file
7
functions/func_urlescape.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package functions
|
||||
|
||||
import "net/url"
|
||||
|
||||
func init() {
|
||||
registerFunction("urlescape", url.QueryEscape)
|
||||
}
|
Loading…
Reference in a new issue