mirror of
https://github.com/danog/liquid.git
synced 2024-11-30 06:08:57 +01:00
parent
26bdd09897
commit
2e5cc60c90
@ -32,7 +32,7 @@ In brief, these aren't implemented:
|
||||
|
||||
- The `cycle` and `tablerow` tags
|
||||
- `{% when a or b %}`
|
||||
- The `sort_natural`, `url_decode`, and `url_encode` filters
|
||||
- The `sort_natural` filter
|
||||
- Loop ranges `{% for a in 1...10 %}`
|
||||
- Error modes
|
||||
- Whitespace control
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"html"
|
||||
"math"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -190,6 +191,8 @@ func AddStandardFilters(fd FilterDictionary) { // nolint: gocyclo
|
||||
fd.AddFilter("upcase", func(s, suffix string) string {
|
||||
return strings.ToUpper(s)
|
||||
})
|
||||
fd.AddFilter("url_encode", url.QueryEscape)
|
||||
fd.AddFilter("url_decode", url.QueryUnescape)
|
||||
|
||||
// debugging extensions
|
||||
// inspect is from Jekyll
|
||||
|
@ -96,6 +96,10 @@ var filterTests = []struct {
|
||||
{`" So much room for activities! " | lstrip`, "So much room for activities! "},
|
||||
{`" So much room for activities! " | rstrip`, " So much room for activities!"},
|
||||
|
||||
{`"%27Stop%21%27+said+Fred" | url_decode`, "'Stop!' said Fred"},
|
||||
{`"john@liquid.com" | url_encode`, "john%40liquid.com"},
|
||||
{`"Tetsuro Takara" | url_encode`, "Tetsuro+Takara"},
|
||||
|
||||
// number filters
|
||||
{`-17 | abs`, 17},
|
||||
{`4 | abs`, 4},
|
||||
|
Loading…
Reference in New Issue
Block a user