tpl: Add a querify function to generate query strings inside templates #2257

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@jimmysawczuk
Contributor
jimmysawczuk commented Jul 5, 2016 edited

The querify function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>
@bep
Collaborator
bep commented Jul 5, 2016

Looks good. Could you "correct" your commit messages (I know, pedantic, but we like the imperative mood and titles without period at the end).

@jimmysawczuk jimmysawczuk tpl: Add a querify function to generate query strings inside templates
The query function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>
eb2cad2
@jimmysawczuk jimmysawczuk changed the title from tpl: Adds a querify function to generate query strings inside templates. to tpl: Add a querify function to generate query strings inside templates Jul 5, 2016
@jimmysawczuk
Contributor

@bep no problem, fixed (I think) (and squashed into one commit).

@bep bep added a commit that closed this pull request Jul 5, 2016
@jimmysawczuk @bep jimmysawczuk + bep tpl: Add a querify function to generate query strings inside templates
The query function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>

Closes #2257
fbf4882
@bep bep closed this in fbf4882 Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment