91 Commits (a622a7e1bc40571c369133e2830cc6a078668c39)

Author SHA1 Message Date
Tom Alexander a622a7e1bc
Add an is_castable() function to stop casting to number for booleans in the @size helper. 4 years ago
Tom Alexander c300d18a75
Implement the outstanding type casts for serde_json. 4 years ago
Tom Alexander 83c86ff9b3
Move ComparisonNumber into the library and add an OwnedLiteral for booleans. 4 years ago
Tom Alexander 8ab315abfe
Adding stubs for type casting to string and boolean. 4 years ago
Tom Alexander 648ae5dfdb
Turns out I was wrong, the @size helper attempts to cast to a number regardless of the input and it uses that. Fixed the test. 4 years ago
Tom Alexander a6c22417e5
Implement Sizable for both OwnedLiterals and serde_json. 4 years ago
Tom Alexander 1a54e35736
Add tests and a Sizable trait for ContextElement. 4 years ago
Tom Alexander cdd10576e8
Wire up serde_json for the math functions. 4 years ago
Tom Alexander d8b8c223f0
Add stubs for the math functions. 4 years ago
Tom Alexander b897656cef
Fix all of the math test except for block template-based methods. 4 years ago
Tom Alexander dcbf8e83f6
Implement number casting. 4 years ago
Tom Alexander 9eb70f436c
Starting a type casting trait 4 years ago
Tom Alexander 241f6c04e4
Rename JsonNumber to ComparisonNumber. 4 years ago
Tom Alexander d6ad7c28f3
Move MathNumber into the library.
While this will be used for the OwnedLiterals since they must always exhibit the original DustJS behavior, I am going to keep exposing separate math functions for ContextElement instead of simply requiring them to implement Into<MathNumber> since people might want to implement math in unusual ways with unusual types.
4 years ago
Tom Alexander d9ce011113
Add implementation based on MathNumber. 4 years ago
Tom Alexander df0ae05648
Start of implementation for serde_json but I'm going to change my approach.
The permutations are pretty intense, so I think I'm going to do the same design I did for comparison where I have a JsonNumber (but I'll call this one MathNumber and rename JsonNumber to ComparisonNumber), convert the types to that, and then do the math.
4 years ago
Tom Alexander db11677b22
Implement addition for OwnedLiterals. 4 years ago
Tom Alexander 8ef3949a65
Fix float json to literal equality comparison by casting them both to float. 4 years ago
Tom Alexander d99aa44d8e
Add support for negative integers. 4 years ago
Tom Alexander 02bcefb75c
Remove outdated TODO. 4 years ago
Tom Alexander 03ff75b2de
Fix number comparison logic. 4 years ago
Tom Alexander 4d28120732
I have broken the comparison function. 4 years ago
Tom Alexander 5b656a44ad
For partial_cmp, convert OwnedLiterals into serde_json values. 4 years ago
Tom Alexander a378d6e6f3
Add comparisons for json floats but not yet between OwnedLiterals and json. 4 years ago
Tom Alexander d06fbea288
Remove unused code and clean up warnings. 4 years ago
Tom Alexander 669a698575
Re-enable the ContextElement implementation for serde_json 4 years ago
Tom Alexander 6bde22b667
Re-enabled compiling templates from bin.rs. 4 years ago
Tom Alexander f1ec0ffb9e
Got rid of most of the Clone traits on the parser types since some of the parser results now contain owned values rather than just references. 4 years ago
Tom Alexander b8b4759d45
Remove iteration_context, parameters_context, and most of bin.rs.
Since I'm changing a pretty core concept of the renderer, I'm going to be rebuilding it piece by piece. In the interest of being able to rapidly change things and check if they are valid through compilation, I need to eliminate most of the old code so I do not have that weighing me down.
4 years ago
Tom Alexander acb8dfb58e
Replaced the old renderer file with a new renderer file. 4 years ago
Tom Alexander 917da5a073
Put IntoContextElement everywhere. It compiles again. 4 years ago
Tom Alexander 966499db76
Switch the get_loop_elements implementation to only return populated arrays when its an array-like object. 4 years ago
Tom Alexander 59ee4f508f
Add a new trait to ContextElement for Truthiness.
Before I was relying on Loopable to both determine truthiness and get a list of elements to loop over. This will no longer work since I need to only set $idx and $len when iterating over actual arrays, as opposed to all truthy values, so I've finally made truthiness explicit.
4 years ago
Tom Alexander 92b9e571be
Array had the same javascript escaping string issue.
Filed a bug at https://github.com/linkedin/dustjs/issues/802 .
4 years ago
Tom Alexander 5424543122
Object also should not turn into a string during javascript escape. 4 years ago
Tom Alexander 7ff1f310f5
Same issue with numbers. 4 years ago
Tom Alexander 71378ed37d
Fix a bug w.r.t. quoting and escaping boolean values with filters. 4 years ago
Tom Alexander bd7866e973
Implement encodeURIComponent filter. 4 years ago
Tom Alexander 46d4f50410
Implement the encodeURI filter. 4 years ago
Tom Alexander 8d2728a767
Implement javascript string escaping. 4 years ago
Tom Alexander e22bffd2ba
Implemented the json stringify and parse filters. 4 years ago
Tom Alexander 6a9fe9e1be
Beginning of applying filters for json types. Currently only supports html escaping. 4 years ago
Tom Alexander 4645530473
Use the render function when doing string coercion for json values. 4 years ago
Tom Alexander 756fdb7d00
Tests are once again passing. 4 years ago
Tom Alexander 830bb06a92
Unifying number comparison. 4 years ago
Tom Alexander 731f235d9e
fix greater than. 4 years ago
Tom Alexander 03a8328148
Fix the equality test. 4 years ago
Tom Alexander 596611c03a
Mostly implemented the new comparison logic for json with new literals. 4 years ago
Tom Alexander c905e705ff
Transition to new literals compiling.
Tests still need work, as does the implementation for json.
4 years ago
Tom Alexander dd160c5708
Hitting an infinite loop on compare string and int. 4 years ago