Tom Alexander
0236f882b7
Delete the old new_breadcrumbs function that is no longer used.
2020-05-30 14:45:48 -04:00
Tom Alexander
d07ac3dcc9
Merge branch 'explicit_context_priority' into render
2020-05-30 14:43:23 -04:00
Tom Alexander
e7c05f597f
Add a test proving exists does not support parameters.
2020-05-30 14:42:34 -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
eb0eb8d4ca
Add priority tests for the other block types except helpers since I do not yet have a helper implemented that sets a value.
2020-05-30 13:47:13 -04:00
Tom Alexander
9bdc398a6d
Merge branch 'pseudo_context' into explicit_context_priority
2020-05-30 12:26:11 -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
0ca17e0885
Add tests that prove that the priority between explicit contexts and parameters varies across sections and partials.
2020-05-25 20:23:10 -04:00
Tom Alexander
92ad15ff85
Merge branch 'explicit_context_setting' into render
2020-05-25 19:34:48 -04:00
Tom Alexander
c78695d08e
Remove a TODO.
2020-05-25 19:34:36 -04:00
Tom Alexander
5b1e3c5fb0
Had to sort the input to the explicit_context_setting test because dustjs leaves the original order but serde_json sorts the keys.
2020-05-25 19:30:30 -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
4ce0899279
Expand the explicit context setting test to prove that injected_context gets inserted AFTER the current context when an explicit context is used.
2020-05-25 16:21:25 -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
e27ab16e06
Add a test for explicit context setting.
2020-05-24 17:19:34 -04:00
Tom Alexander
d813a878ca
Merge branch 'idx_and_len' into render
2020-05-24 16:58:08 -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
e0fe7475c5
Add a single element array test for idx_and_len.
...
This test is mostly because I am currently turning truthy values into single element arrays during render, so I need to make sure idx and len and not being set for non-array iteration.
2020-05-24 15:29:14 -04:00
Tom Alexander
9925802ae9
Add .$idx to nested section test.
2020-05-24 15:25:17 -04:00
Tom Alexander
93adaa518d
Add a test for $idx and $len inside nested sections.
2020-05-24 15:22:12 -04:00
Tom Alexander
fff401da7e
Add a test to confirm references are getting parsed.
2020-05-24 15:22:12 -04:00
Tom Alexander
abf251c68d
Add a test for $idx and $len.
2020-05-24 15:22:10 -04:00
Tom Alexander
381ed43645
Merge branch 'combined_walk_path' into render
2020-05-24 15:21:53 -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
1ad9753845
Add an ignored test for type casting.
...
I think in order to support type casting in a generic fashion so that custom non-json types can be used, I'll need to push the implementation of helpers off into the traits instead of handling it in the renderer. This is a larger undertaking than I was planning on starting at this very moment, so I'm going to leave this test disabled and move on to a couple smaller tasks I wanted to knock out before starting implementation on custom helpers.
2020-05-24 13:05:34 -04:00