spinframework / spinframework/spin

Add escape syntax to variables expansion syntax (`spin-expressions`)

Open
#2,528 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

The current Mustache-inspired template syntax has no way of escaping double open quotes ({{).

While no one has complained about this yet (loudly enough for me to hear), we should probably proactively fix this as it would technically introduce a breaking change.

Some options:

  • \ escaping. Annoyingly, this would require double-backslash in TOML, but given the evident rarity of needing this maybe that is fine.
    var1 = "\\{{ not interpolated }}"
    var2 = "one backslash: \\\\" # 😬
    
  • Some kind of quoted literal in braces, like Go templates:
    var1 = "{{`{{`}} not interpolated }}"
    # or
    var1 = "{{`{{ not interpolated }}`}}"
    

Other suggestions welcome.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the spin-expressions parser and its existing interpolation tests. Review the proposed backslash and quoted-literal approaches, choose and document an escaping syntax, then add coverage showing literal {{ text and normal variable expansion still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.