1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-30 06:48:58 +01:00
Commit Graph

377 Commits

Author SHA1 Message Date
3c60e26a82
Stop trimming ASAP 2022-01-06 14:26:41 +01:00
Oliver Steele
5cbe290051 Document missing filter keyword parameter feature 2021-07-06 10:33:12 +08:00
Oliver Steele
94c219b2c3 Rename golantci-lint -> Lint; run only master 2021-07-06 10:33:12 +08:00
Oliver Steele
522f0b321b Rename go action -> Build Status; only apply to main and master 2021-07-06 10:33:12 +08:00
Oliver Steele
0bc5e4c93e
Merge pull request #47 from luminsmart/master
🐛 Fix MaxUint32 assignment to platform int
2021-07-05 14:32:28 +08:00
Oliver Steele
6e83bd2960 Add @bendoerr as a contributor 2021-07-05 14:29:24 +08:00
Oliver Steele
55b3f39dc3 Apply @bendoerr's fix, in previous commit, to generated file's source 2021-07-05 14:27:52 +08:00
Ben Doerr
c0ad3cec70 🐛 Fix MaxUint32 assignment to platform int
This fixes an issue where math.MaxUint32 is assigned to a platform
dependent int type. This works on 64-bit platforms without issue due to
there being plenty of space. On 32-bit platforms this is wrong and will
not compile as math.MaxUint32 > math.MaxInt32.
2021-07-05 14:20:55 +08:00
Oliver Steele
beafe4eb95 Add @Eun as a contributor 2021-06-27 11:06:14 +08:00
Oliver Steele
7d49ec0a4f Enable gofmt linter 2021-06-26 15:24:21 +08:00
Oliver Steele
28ae2b46b4 Update GitHub Action badge URLs 2021-06-26 15:07:52 +08:00
Oliver Steele
eb28891df5 Fix markdown lint errors 2021-06-26 14:54:25 +08:00
Oliver Steele
d4e2f72022 Replace Appveyor -> GitHub Actions matrix 2021-06-26 14:49:05 +08:00
Oliver Steele
81ead91790 Replace travis by GitHub action 2021-06-26 14:43:59 +08:00
Oliver Steele
7840a5e8b8 Removed unused require 2021-06-26 14:21:50 +08:00
Oliver Steele
c8e431bbb5 Move golangci-lint from Travis -> GitHub Actions 2021-06-26 14:17:44 +08:00
Ben Doerr
16e265c7d2 🐛 Fix MaxUint32 assignment to platform int
This fixes an issue where math.MaxUint32 is assigned to a platform
dependent int type. This works on 64-bit platforms without issue due to
there being plenty of space. On 32-bit platforms this is wrong and will
not compile as math.MaxUint32 > math.MaxInt32.
2021-06-23 09:55:26 -04:00
Oliver Steele
f7a10b7ade Update required go version 2021-06-18 13:32:36 +08:00
Oliver Steele
42035af9b1 Replace gometalinter -> golangci; fix lint errors 2021-06-16 18:42:31 +08:00
Oliver Steele
26c51e4252 Add go.mod 2021-06-16 18:41:53 +08:00
Oliver Steele
3b040ccfe2
Merge pull request #40 from imiskolee/master
1. support json.Number for parse into number types
2020-11-07 13:05:15 +08:00
Oliver Steele
26998e1688
Merge pull request #33 from Eun/master
floor and ceil should return integers
2020-11-07 12:59:56 +08:00
misko
dd12222409 1. fix 2019-12-20 19:51:52 +08:00
Tobias Salzmann
5540947bf1 force explicit type checking 2018-07-31 17:47:45 +02:00
Tobias Salzmann
7ae2fa24ed floor and ceil should return integers 2018-07-25 17:18:10 +02:00
Oliver Steele
e0ae1590bf
Add latest PR to CHANGELOG 2018-06-05 16:36:56 -04:00
Oliver Steele
b8970ec180
Add a CHANGELOG 2018-06-05 16:33:11 -04:00
Oliver Steele
4e0fda9afd
Re-organize README 2018-06-05 16:33:08 -04:00
Oliver Steele
20a3b002f5
Add make pre-commit; lint before testing 2018-06-05 16:33:07 -04:00
Oliver Steele
ca945a04d1
Merge pull request #30 from nsf/master
Properly handle implicit conversion to integer types.
2018-06-05 15:27:13 -04:00
nsf
c32908a4f3 Returning proper error type causes less panics during expression eval.
When user-defined function is called, it does convert all the arguments using
MustConvert, which panics on error with an error. However 'func (e expression)
Evaluate(ctx Context)' from sub package "expressions" catches those panics and
converts some of them to errors. Raw errors returned from strconv functions
are "repanicked", but proper error types such as values.TypeError are not.
Hence we should use it here.
2018-05-31 23:49:25 +05:00
nsf
4354d48a04 Properly handle implicit conversion to integer types.
Go's reflect API is very picky about arguments to Call method. You can't just
pass in the "int" when function expects "int64", even on 64 bit machines. This
patch solves this problem by performing conversions properly. Truncation
problems however, as well as negative to uint issues are completely ignored.
Which is perhaps not ideal, but still better than returning "int" when "int32"
or "int64" is requested.

I did split the Kind switch cases and moved value -> int and value -> float
conversions to separate functions. An alternative to that would be using the
reflection API, which might be less performant. Not that it matters much, but
this solution is correct, even though looks a bit copy & pasty.

Oh and of course all "uint" types were completely missing in the function and
they are now added.
2018-05-31 23:18:57 +05:00
Oliver Steele
aadc886acd Minor formatting fixes in the README 2018-05-30 20:54:10 +00:00
Oliver Steele
d2be34e2e9 Add Contributors section; add nsf as contributor; adopt All Contributors and all-contributors-cli 2018-05-30 20:50:25 +00:00
Oliver Steele
9234f55cd9
Merge pull request #29 from nsf/master
Properly handle variadic functions.
2018-05-30 15:50:03 -04:00
nsf
1a2066b87e Properly handle variadic functions.
This commit addresses two issues:

1. For variadic functions 'convertCallArguments' was allocating exactly
   'len(args)' arguments, which might be less than required, as a result
   zero/default filling loop would panic with out of bounds error.

2. Even if we correctly allocate a proper amount of arguments, zero/default
   filling loop doesn't handle special variadic function type case, when last
   argument has a slice type and reflect API expects plain values as arguments.
   But actually we don't need that, because it's okay to omit variadic values
   altogether, hence the total amount of allocated arguments is
   max(len(args), rt.NumIn()-1).
2018-05-30 19:44:29 +05:00
Oliver Steele
e30a0e2788
Travis: add go 1.10; drop 1.8 2018-03-02 11:41:48 -05:00
Oliver Steele
3811e167ab
Remove errant file 2018-03-02 10:51:28 -05:00
Oliver Steele
8874615b3c Match Ruby string split semantics 2017-09-04 17:51:51 -04:00
Oliver Steele
a02d9e12b4 Follow go style guide re declaring empty slices 2017-09-03 12:13:20 -04:00
Oliver Steele
ba2ecf9542 Add go 1.9 to travis build matrix 2017-08-30 09:38:50 -04:00
Oliver Steele
b6c65ffee6 map[unhashable] returns nil instead of panic 2017-08-23 16:03:46 -04:00
Oliver Steele
a50dc106d2 Convert tests 2017-08-23 15:56:27 -04:00
Oliver Steele
d27c839ae3 variable names 2017-08-23 15:56:18 -04:00
Oliver Steele
1a12f12f1d Convert MapSlice -> map 2017-08-21 15:06:35 -04:00
Oliver Steele
bb24f32cbd list filters operate on MapSlice 2017-08-21 10:30:54 -04:00
Oliver Steele
e1c7224d9c variable names 2017-08-21 09:50:29 -04:00
Oliver Steele
cb6efbf216 join filter: default sep is space; omit nil entries 2017-08-20 11:33:58 -04:00
Oliver Steele
5ebf31a84a Default time format is compatible w/ Liquid 2017-08-18 10:43:31 -04:00
Oliver Steele
804e3d6970 Rearrange tests 2017-08-18 10:35:15 -04:00