Add a template to dump the parameters to a custom helper.

This commit is contained in:
Tom Alexander
2020-05-23 14:28:21 -04:00
parent 9892d2f61d
commit a6641d9c72
5 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
Chunk
-----
Some sort of object which contains an array of rendered elements. For example, using:
```
Testing dump parameters
{#names}
{.}
{/names}
```
The first interation would have `["Testing dump parameters", "Alice"]`.
Question: Do any helpers read from chunk or just write to it? If its just writing, then my current architecture of just returning a `String` would work fine, though having a shared buffer thats written to would probably reduce the allocations and therefore improve performance.
Context
-------
Some sort of object that contains essentially the "breadcrumbs" variable I am currently using to track the context tree. Also tracks template name, globals and options. I guess options would be that whole preserve whitespace or not option. I was just going to store this option on the dust renderer type, but I guess I should bake it into the breadcrumbs to pass into helpers if I implement support for custom helpers.
Bodies
------
No idea, but based on the name I assume it contains the contents of the helper, or at least some way to render the internal body of the helper.
Params
------
A mapping of the parameters directly on the helper.

View File

@@ -0,0 +1,6 @@
{
"names": [
"Alice",
"Bob"
]
}

View File

@@ -0,0 +1,7 @@
Testing dump parameters
{#names}
{.}
{@dumpParameters foo="bar"}
Internal
{/dumpParameters}
{/names}