Skip to content

[templates] How featureful should the default processor be? #682

@domenic

Description

@domenic

From what I can tell the proposal includes the following features:

  • Stripping leading/trailing whitespace from expressions, so you can do {{ x }} instead of {{x}}.
  • Path searching with dots, so you can do {{x.y}}. (But not brackets, so you cannot do {{x["y"]}}.)
  • Fallback with ||. Doesn't appear to be in the formal spec. Does this use boolean semantics, so false or 0 trigger fallback? Or is it just undefined and null? Just undefined?

There's a lot of potential for scope creep here. I think the most minimal version omits all three of these so it's purely JavaScript property lookup. I'm not sure if that'd be too restrictive, or OK.

Note that Mustache doesn't allow any of these, I am pretty sure, and requires you to manipulate your data into an appropriate format beforehand. (Maybe it supports whitespace stripping?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions