Commit Graph

302 Commits

Author SHA1 Message Date
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