smfoote / tornado

HTML templates with asynchronous rendering, built with JavaScript.
http://smfoote.github.io/tornado/
Apache License 2.0
8 stars 3 forks source link

Allow alternative path separators in references #130

Open smfoote opened 8 years ago

smfoote commented 8 years ago

One common complaint about Dust is that dots in a reference are always interpreted as steps in the context path. This change allows for dots in the path to be interpreted as plain text strings instead of steps in the context path.

Example:

{com.linkedin.dots.in.path|myVal sep="|"}
{
  "com.linkedin.dots.in.path": {
    "myVal": "DOTS"
  }
}

TODO: Make this work for helpers as well (currently only works for references)

jimmyhchan commented 8 years ago

params in references feels awesome and strange. Feels inline with the "everything is a helper" mantra.

But it feels like we are hard coding the sep parameter. What if we need another reference modifier. Seems like we will run into issues. I want to say I want something more explicit.

wdyt?

{%referenceSep sep="|"}{com.linkedin.dots.in.path|myVal}{/referenceSep}
smfoote commented 8 years ago

I like it a lot. I was thinking it would be good to have a way to define a separator for a whole block, instead of on every reference.