Tom Alexander
cdd10576e8
Wire up serde_json for the math functions.
2020-06-13 22:55:38 -04:00
Tom Alexander
d8b8c223f0
Add stubs for the math functions.
2020-06-13 22:12:00 -04:00
Tom Alexander
b897656cef
Fix all of the math test except for block template-based methods.
2020-06-13 21:37:11 -04:00
Tom Alexander
dcbf8e83f6
Implement number casting.
2020-06-13 19:55:40 -04:00
Tom Alexander
9eb70f436c
Starting a type casting trait
2020-06-13 19:39:31 -04:00
Tom Alexander
241f6c04e4
Rename JsonNumber to ComparisonNumber.
2020-06-13 19:15:51 -04:00
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.
2020-06-13 19:13:02 -04:00
Tom Alexander
d9ce011113
Add implementation based on MathNumber.
2020-06-13 19:02:56 -04:00
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.
2020-06-13 18:34:13 -04:00
Tom Alexander
db11677b22
Implement addition for OwnedLiterals.
2020-06-13 17:50:22 -04:00
Tom Alexander
8ef3949a65
Fix float json to literal equality comparison by casting them both to float.
2020-06-13 16:32:57 -04:00
Tom Alexander
d99aa44d8e
Add support for negative integers.
2020-06-13 16:06:31 -04:00
Tom Alexander
02bcefb75c
Remove outdated TODO.
2020-06-13 15:33:21 -04:00
Tom Alexander
03ff75b2de
Fix number comparison logic.
2020-06-13 15:31:52 -04:00
Tom Alexander
4d28120732
I have broken the comparison function.
2020-06-13 14:55:27 -04:00
Tom Alexander
5b656a44ad
For partial_cmp, convert OwnedLiterals into serde_json values.
2020-06-13 14:19:03 -04:00
Tom Alexander
a378d6e6f3
Add comparisons for json floats but not yet between OwnedLiterals and json.
2020-06-13 13:47:43 -04:00
Tom Alexander
d06fbea288
Remove unused code and clean up warnings.
2020-06-07 13:27:57 -04:00
Tom Alexander
669a698575
Re-enable the ContextElement implementation for serde_json
2020-06-07 00:17:55 -04:00
Tom Alexander
6bde22b667
Re-enabled compiling templates from bin.rs.
2020-05-31 19:08:10 -04:00
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.
2020-05-31 19:01:51 -04:00
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.
2020-05-31 18:27:55 -04:00
Tom Alexander
acb8dfb58e
Replaced the old renderer file with a new renderer file.
2020-05-31 18:18:21 -04:00
Tom Alexander
917da5a073
Put IntoContextElement everywhere. It compiles again.
2020-05-30 17:50:27 -04:00
Tom Alexander
966499db76
Switch the get_loop_elements implementation to only return populated arrays when its an array-like object.
2020-05-24 16:27:13 -04:00
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.
2020-05-24 16:16:43 -04:00
Tom Alexander
92b9e571be
Array had the same javascript escaping string issue.
...
Filed a bug at https://github.com/linkedin/dustjs/issues/802 .
2020-05-23 22:37:56 -04:00
Tom Alexander
5424543122
Object also should not turn into a string during javascript escape.
2020-05-23 22:31:33 -04:00
Tom Alexander
7ff1f310f5
Same issue with numbers.
2020-05-23 22:06:25 -04:00
Tom Alexander
71378ed37d
Fix a bug w.r.t. quoting and escaping boolean values with filters.
2020-05-23 19:34:38 -04:00
Tom Alexander
bd7866e973
Implement encodeURIComponent filter.
2020-05-23 19:10:02 -04:00
Tom Alexander
46d4f50410
Implement the encodeURI filter.
2020-05-23 19:06:09 -04:00
Tom Alexander
8d2728a767
Implement javascript string escaping.
2020-05-23 18:40:09 -04:00
Tom Alexander
e22bffd2ba
Implemented the json stringify and parse filters.
2020-05-23 18:14:23 -04:00
Tom Alexander
6a9fe9e1be
Beginning of applying filters for json types. Currently only supports html escaping.
2020-05-23 17:23:48 -04:00
Tom Alexander
4645530473
Use the render function when doing string coercion for json values.
2020-05-17 15:52:38 -04:00
Tom Alexander
756fdb7d00
Tests are once again passing.
2020-05-17 00:40:55 -04:00
Tom Alexander
830bb06a92
Unifying number comparison.
2020-05-17 00:27:21 -04:00
Tom Alexander
731f235d9e
fix greater than.
2020-05-16 23:26:33 -04:00
Tom Alexander
03a8328148
Fix the equality test.
2020-05-16 23:19:02 -04:00
Tom Alexander
596611c03a
Mostly implemented the new comparison logic for json with new literals.
2020-05-16 23:07:05 -04:00
Tom Alexander
c905e705ff
Transition to new literals compiling.
...
Tests still need work, as does the implementation for json.
2020-05-16 22:31:40 -04:00
Tom Alexander
dd160c5708
Hitting an infinite loop on compare string and int.
2020-05-16 21:34:45 -04:00
Tom Alexander
054480b797
First stab at fixing the error, not a full success.
2020-05-16 21:30:51 -04:00
Tom Alexander
f640cb0440
Fixed greater than helper by using rust's PartialOrd implementation for Vec.
2020-05-16 18:16:07 -04:00
Tom Alexander
7d4cb14530
Add that check to the not-equals helper and update the json value implementation to mark all non-scalars as not-equals.
2020-05-16 15:30:17 -04:00
Tom Alexander
6dbeb77a28
Add arrays to all helpers tests.
2020-05-16 14:19:56 -04:00
Tom Alexander
2b5bec05be
Implemented partial_compare for scalar json values.
2020-05-16 14:08:59 -04:00
Tom Alexander
563fd1f6db
Starting comparison of json value to json value.
2020-05-16 13:44:34 -04:00
Tom Alexander
9851a2556d
Ordering implementation for comparison between json and literals.
2020-05-16 13:40:56 -04:00