Commit Graph

389 Commits

Author SHA1 Message Date
Tom Alexander
acb8dfb58e
Replaced the old renderer file with a new renderer file. 2020-05-31 18:18:21 -04:00
Tom Alexander
283430a45b
Merge the breadcrumb tree trait and struct into just a struct. 2020-05-31 18:14:26 -04:00
Tom Alexander
439601bbb5
First I'll try to eliminate the duplication between the BreadcrumbTree and BreadcrumbTreeNode. 2020-05-31 18:05:49 -04:00
Tom Alexander
1111b48270
Due to traits I am going to have to start hard-replacing the old renderer file. 2020-05-31 18:02:02 -04:00
Tom Alexander
de5914417e
All but explicit context for new_breadcrumbs_section. 2020-05-31 17:56:07 -04:00
Tom Alexander
b381789422
Slight progress on new_breadcrumbs_section. 2020-05-31 17:32:06 -04:00
Tom Alexander
2b532e7eb4
Going to try switching to boxed owned values to remove the template. 2020-05-31 17:25:41 -04:00
Tom Alexander
92dca74505
Running into issue where I need to know the type to create new tree node elements. 2020-05-31 16:40:39 -04:00
Tom Alexander
ff27c2c85d
Basic structure for the new tree renderer. 2020-05-31 16:21:13 -04:00
Tom Alexander
65445cc8fc
Finished implementing the new tree walking. 2020-05-31 16:16:21 -04:00
Tom Alexander
863744c42d
Got rid of the IceTreeIterator by using map(). 2020-05-31 16:02:30 -04:00
Tom Alexander
781b8f645a
Switch IntoIter over to the breadcrumb iterator. 2020-05-31 15:58:29 -04:00
Tom Alexander
ff13d22ab6
Renamed BreadcrumbTreeIterator to IceTreeIterator. 2020-05-31 15:52:46 -04:00
Tom Alexander
89c751e849
I think I need to implement iterating on the tree nodes. 2020-05-31 15:51:18 -04:00
Tom Alexander
3f49519bea
Initial structure for new implementation of walking functions using the heterogeneous tree. 2020-05-31 15:44:09 -04:00
Tom Alexander
456da98bed
Added an iter function which I think will let me automatically make iterators without having to explicitly take a reference to the tree. 2020-05-31 14:29:59 -04:00
Tom Alexander
bebedf56e4
Implement IntoIterator for references to a BreadcrumbTreeNode. 2020-05-31 14:27:31 -04:00
Tom Alexander
1be60511ed
Implement an iterator over the tree. 2020-05-31 14:17:21 -04:00
Tom Alexander
645b251f13
Initial setup for a heterogenous tree of IntoContextElement. 2020-05-31 13:52:20 -04:00
Tom Alexander
a578b57f12
Switch the call for IntoContextElement back to a static integer so it compiles again. 2020-05-31 13:21:47 -04:00
Tom Alexander
21b9e9282b
Ran into issue: Can't returned owned data when its expecting a trait object. 2020-05-30 18:28:33 -04:00
Tom Alexander
737c98d8b7
Add the renderer to calls to convert to a context element. 2020-05-30 18:16:58 -04:00
Tom Alexander
917da5a073
Put IntoContextElement everywhere. It compiles again. 2020-05-30 17:50:27 -04:00
Tom Alexander
975ab278ef
Starting an IntoContextElement trait to allow for delayed evaluation. 2020-05-30 16:34:32 -04:00
Tom Alexander
581f9f7e97
Update parser to treat all string rvalues as templates. 2020-05-30 15:49:13 -04:00
Tom Alexander
3352b777ae
Factor out the parsing of partial template names into its own parser for reuse as an rvalue. 2020-05-30 15:45:44 -04:00
Tom Alexander
0236f882b7
Delete the old new_breadcrumbs function that is no longer used. 2020-05-30 14:45:48 -04:00
Tom Alexander
add77cf6a5
Get rid of the concept of NamedBlock and replace it with a ParameterizedBlock special case that does not support an else block. 2020-05-30 14:39:31 -04:00
Tom Alexander
a0e2ba2b82
Had to update the 1-behind insertion for partial parameters to account for pseudo elements. 2020-05-30 12:24:50 -04:00
Tom Alexander
3c9a369908
Skipping over pseudo contexts has fixed most of the tests. 2020-05-30 11:50:55 -04:00
Tom Alexander
f04e84dc31
Attempted to move section over to the section-specific new breadcrumbs function.
I think the problem is, the index context needs to be a higher priority than the new context element, but when referencing data with `{.}` the new context element needs to take priority. I could either combine entries in the context tree so that variables like $idx and $len live side-by-side with real context elements, or try to implement a way to skip over index context elements when walking up the tree.
2020-05-25 23:28:49 -04:00
Tom Alexander
79f52ecdee
Add test for priorities while looping and split the new_breadcrumbs function into two separate new_breadcrumbs functions because sections and partials have different orderings. 2020-05-25 22:50:10 -04:00
Tom Alexander
108cffb771
Fully replaced conditional's Container type with ParameterizedBlock. 2020-05-25 21:26:16 -04:00
Tom Alexander
dc92973313
Switch parameterized blocks to having a Path for a name and taking a parser for a name matcher in the goal of merging with the conditional blocks. 2020-05-25 21:17:58 -04:00
Tom Alexander
2527baeff4
Pull the calls for the DustTag constructor up out of parameterized_block. 2020-05-25 20:40:58 -04:00
Tom Alexander
c78695d08e
Remove a TODO. 2020-05-25 19:34:36 -04:00
Tom Alexander
25eb9b10a0
I did it backwards, I needed to use the explicit context from the block, not the inline partial. 2020-05-25 19:24:49 -04:00
Tom Alexander
6845df7f96
First attempt at an implementation of the new breadcrumbs for blocks/inline partials. 2020-05-25 19:11:14 -04:00
Tom Alexander
83623897af
Integrate new_breadcrumbs into the helpers. 2020-05-25 18:27:54 -04:00
Tom Alexander
400602124e
Added tests proving that the explicit context is evaluated using the global context of the partial containing the block (NOT the inline partial, which is where the explicit context is written). 2020-05-25 17:53:04 -04:00
Tom Alexander
d02c98cb94
Add a special case to new_breadcrumbs for when theres an injected context but no explicit context or new context element and finish the partial integration. 2020-05-25 16:30:15 -04:00
Tom Alexander
17121aa85b
Integrated new_breadcrumbs into exists and not exists, and partially integrated it into partials. 2020-05-25 16:03:00 -04:00
Tom Alexander
32c047a9b9
Integrate the new_breadcrumbs function into sections. 2020-05-25 15:55:52 -04:00
Tom Alexander
d79447e602
Update the new_breadcrumbs function to return an Option to prevent needlessly cloning the breadcrumbs when no new contexts are to be added. 2020-05-25 15:49:30 -04:00
Tom Alexander
4a21ae5af3
Add tests for explicit context setting that check failure conditions and implement a helper function to generate a new breadcrumb stack. 2020-05-25 15:40:42 -04:00
Tom Alexander
8121c93392
Make the dust template parser all_consuming. 2020-05-25 14:17:38 -04:00
Tom Alexander
5b2ac7c2c2
Add parser support for explicit contexts in helpers. 2020-05-25 14:14:17 -04:00
Tom Alexander
12de0245c5
Implemented parser support for explicit contexts in partials. 2020-05-25 14:05:46 -04:00
Tom Alexander
9031108d2a
Implemented parsing for explicit contexts in NamedBlocks. 2020-05-25 13:55:17 -04:00
Tom Alexander
dbee569931
Finish adding explicit context to the parser for Container. 2020-05-25 13:38:31 -04:00
Tom Alexander
1152ff9974
Greatly expand the explicit_context_setting test.
Turns out explicit context setting works in a lot more places than the official dustjs pages indicate. Also some things don't make much sense (like setting it on a block works but not on an inline partial).
2020-05-24 18:16:16 -04:00
Tom Alexander
c09393da80
Switch the renderer over to using the new is_truthy value and add the injection of $idx and $len into the context tree. 2020-05-24 16:57:24 -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
055d88984e
Implement an injected context for iteration values. 2020-05-24 16:01:56 -04:00
Tom Alexander
fff401da7e
Add a test to confirm references are getting parsed. 2020-05-24 15:22:12 -04:00
Tom Alexander
39c579171b
Rename the new functions to replace the old functions. 2020-05-24 15:21:30 -04:00
Tom Alexander
46fe1f5204
Fix the last case by changing the lifetimes and delete the old fractured implementation. 2020-05-24 15:20:36 -04:00
Tom Alexander
4790ac77d6
Initial implementation combining owned_walk_path and walk_path. Works everywhere except one spot. 2020-05-24 14:56:09 -04:00
Tom Alexander
a58b605e59
Add support for dot paths to owned_walk_path. 2020-05-24 14:17:53 -04:00
Tom Alexander
b73561caf9
Add support for literal string blocks. 2020-05-23 23:46:46 -04:00
Tom Alexander
50079c6415
Add support in the renderer for handling paths containing dot. 2020-05-23 23:26:00 -04:00
Tom Alexander
95dc15f103
Update parser to preserve the dot and support paths beginning with a dot. 2020-05-23 23:12:51 -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
f3fef17d4b
I was wrong, html escape filter is appended even if an html escape filter is already there. 2020-05-23 18:18:59 -04:00
Tom Alexander
e22bffd2ba
Implemented the json stringify and parse filters. 2020-05-23 18:14:23 -04:00
Tom Alexander
624c83b680
Automatically appending the html escape filter on the renderer side. 2020-05-23 17:57:19 -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
5ddeeac966
minor cleanup. 2020-05-17 21:21:26 -04:00
Tom Alexander
93f9581d8a
Renamed the new partial implementation to the old partial name. 2020-05-17 21:17:34 -04:00
Tom Alexander
7be00ffea6
Remove the old partial implementation. 2020-05-17 21:15:03 -04:00
Tom Alexander
ecf2576a0a
Remove default case from render_tag. 2020-05-17 21:12:27 -04:00
Tom Alexander
10c8b25817
Implement the new partial type in the renderer. 2020-05-17 21:11:55 -04:00
Tom Alexander
402d8679e2
Switch the parser over to a new partial implementation for dynamic partials. 2020-05-17 20:44:17 -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
d77ab7401c
Switched over to using operators instead of compare in the renderer. 2020-05-16 23:10:04 -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
189dfb1755
Fix tests. 2020-05-16 22:39:29 -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
bc25c1ee16
Starting to remove the old RValues. 2020-05-16 22:19:51 -04:00
Tom Alexander
16d8891452
Implement partial_compare for OwnedLiteral. 2020-05-16 22:08:03 -04:00
Tom Alexander
bf35fd0ae4
equals implementation for literal. 2020-05-16 22:02:58 -04:00
Tom Alexander
6519add838
Starting an OwnedLiteral type instead of using rust's built-in primitives. 2020-05-16 21:52:44 -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
ce8b73f87a
Implement less than or equals. 2020-05-16 19:06:40 -04:00
Tom Alexander
30b7324049
Implement less-than. 2020-05-16 19:05:03 -04:00
Tom Alexander
496a5e0ac7
Had to manually interpret the partial_cmp output instead of using the built-in operators since gte confusingly returns true for mismatched values. 2020-05-16 18:36:47 -04:00
Tom Alexander
62cd73f9c9
Initial attempt at implementation, tests not working. 2020-05-16 18:28:23 -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
b53a9e1837
Cleaning up and factoring out reused code in the renderer. 2020-05-16 17:17:43 -04:00
Tom Alexander
6758d515f1
Have greater than helper very close to correct. Just need to make it compare arrays of scalars. 2020-05-16 16:24:36 -04:00
Tom Alexander
02abee1c53
Add a test for gte. 2020-05-16 15:45:57 -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
41e4874d75
Add a check to the equality helper to mark identical paths as equal. 2020-05-16 15:22:48 -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
Tom Alexander
8748cb7063
Structure for ordering, need to implement for serde_json::Value. 2020-05-16 13:31:52 -04:00
Tom Alexander
f4a935224c
Implemented the not equals helper. 2020-05-16 12:26:28 -04:00
Tom Alexander
e04a0be5e7
Add the rest of the helpers to the recursive extract inline partials function. 2020-05-16 12:13:40 -04:00
Tom Alexander
1b63bc4083
Add a test for integer literals. 2020-05-10 23:42:56 -04:00
Tom Alexander
6e6560c742
Revived the tests. 2020-05-10 23:38:59 -04:00
Tom Alexander
c88cab8316
Hook in the integer parser. 2020-05-10 23:13:25 -04:00
Tom Alexander
9ee8f41022
Implement the render send of integer literals. 2020-05-10 23:11:16 -04:00
Tom Alexander
79099a8654
Parsing positive integers. 2020-05-10 23:02:21 -04:00
Tom Alexander
7dd824ab4f
cleaning up. 2020-05-10 22:40:47 -04:00
Tom Alexander
68639481f5
Implement a real clone for ParametersContext. 2020-05-10 22:35:17 -04:00
Tom Alexander
46bb5558ac
Going to a more generic equality comparison for json. 2020-05-10 22:26:47 -04:00
Tom Alexander
6297fa0189
Rename NewParametersContext to ParametersContext. 2020-05-10 22:21:18 -04:00
Tom Alexander
75ba35a422
Cleaning up. 2020-05-10 22:20:39 -04:00
Tom Alexander
6261f7881c
Manual equals is working! 2020-05-10 22:14:07 -04:00
Tom Alexander
2fb7ca9db7
Making CastToAny more generic. 2020-05-10 22:05:48 -04:00
Tom Alexander
9baa669dea
Separating out CastToAny. 2020-05-10 22:04:41 -04:00
Tom Alexander
d5e0c93205
Comparisons between json strings vs rvalue literals is not working as I had hoped. 2020-05-10 21:49:03 -04:00
Tom Alexander
798d84828e
Implemented owned_walk_path. 2020-05-10 21:38:37 -04:00
Tom Alexander
dade738f55
The structure is all there, just need to implement owned_walk_path and clone on NewParametersContext. 2020-05-10 21:34:18 -04:00
Tom Alexander
4e274b9ea5
Running into the walking issue again. 2020-05-10 21:28:47 -04:00
Tom Alexander
137e7887a0
Finish implementing DTHelperEquals. 2020-05-10 21:14:51 -04:00
Tom Alexander
32abe41e1a
Generic implementation of CompareContextElement. 2020-05-10 21:11:49 -04:00
Tom Alexander
256051220d
Generic implementation of CloneIntoBoxedContextElement. 2020-05-10 21:07:31 -04:00
Tom Alexander
ba79369b5a
PartialEq works with results too. 2020-05-10 21:00:52 -04:00
Tom Alexander
7f89685537
PartialEq implemented too. 2020-05-10 21:00:06 -04:00
Tom Alexander
e986a1ba7a
PartialEq compiling with double lifetimes. 2020-05-10 20:58:47 -04:00
Tom Alexander
8fd2a9cf39
tentatively seems to be working. 2020-05-10 19:16:55 -04:00
Tom Alexander
c96b2257d7
Compiling.
Need to see if I can do a generic implemented of IntoBoxedContextElement for all objects implementing Copy, and I need to implement the compare code to make sure this all works before I start integrating this more.
2020-05-10 19:07:41 -04:00
Tom Alexander
5c79b436a0
Commenting out the parameterscontext type. 2020-05-10 19:01:02 -04:00
Tom Alexander
6fb329388f
Not having much luck. 2020-05-10 18:45:54 -04:00
Tom Alexander
b9cfa56c2f
May have to use unsafe code. 2020-05-10 18:35:24 -04:00
Tom Alexander
9573480973
converting the parameters 2020-05-10 18:19:06 -04:00
Tom Alexander
876bced188
Converting RValues. 2020-05-10 18:10:17 -04:00
Tom Alexander
f386e5c31b
Adding trait to cast to Any. 2020-05-10 17:12:15 -04:00
Tom Alexander
c438653449
No luck. 2020-05-10 15:02:59 -04:00
Tom Alexander
7e0e776486
Running into lifetime issues. 2020-05-10 14:53:12 -04:00
Tom Alexander
7a8247f38a
Getting the left and right sides. 2020-05-10 14:22:59 -04:00
Tom Alexander
55f816b53f
Finished implementing Named blocks and inline partials. 2020-05-09 22:49:17 -04:00
Tom Alexander
403f9e6530
Implement a recursive get_block. 2020-05-09 22:40:32 -04:00
Tom Alexander
6837fba489
Passing the block tree through the render functions. 2020-05-09 22:29:58 -04:00
Tom Alexander
9a33195c42
Generating the new treeX 2020-05-09 22:05:43 -04:00