Template string interpolation
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- handlebars
- Ambito
- frontend
Direzione di ricerca
Inizia con il Handlebars parser e, se necessario, esamina come il pwn parser gestisce i nodi AST dei letterali stringa. Esamina come funziona già l’interpolazione nelle invocazioni tra parentesi angolari e confronta le sintassi proposte per le stringhe normali e i backtick. L’attività è completata quando saranno definiti una sintassi concordata, un piano di compatibilità o deprecazione e il supporto del parser, invece di una discussione di progettazione aperta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Just some quick notes for the idea to open up the discussion.
It's not very common, but occasionally you need to do string interpolations in Handlebars. Today, the solution is to use the concat helper.
{{notification message=(concat @user.firstName " " @user.lastName " has added you as a friend!")}}
It's not so bad, but it does add some noise. It would be nicer, in my opinion, to have a string interpolation syntax.
Ideally, it would be nice if we could just use the normal string syntax:
{{notification message="{{@user.firstName}} {{@user.lastName}} has added you as a friend!"}}
Note that this already works in angle bracket invocations, so it aligns nicely:
<Notification @message="{{@user.firstName}} {{@user.lastName}} has added you as a friend!" />
This would work if we are designing the language from scratch. You can always escape the mustaches if you meant for them to be literal mustaches, same as any other positions. Unfortunately, this will be a breaking change. While rare, it is possible that there are existing string literals that uses mustaches for this purpose.
The good thing about this is they are by definition static. So one option is to detect existing usages of unescaped mustaches in string literals, deprecate them to clear the space, then add the interpolation feature in the next major version. In the meantime, we can create an addon for apps to opt-in.
Another option is to do what JavaScript (which had the same problem and didn't have the luxury of bumping major versions) and use a different syntax for interpolated strings, say backticks:
{{notification message=`{{@user.firstName}} {{@user.lastName}} has added you as a friend!`}}
Personally, I would prefer to do the former, as it feels more consistent overall.
In terms of implementation, ideally this would be supported in the handlebars parser directly, but if not, we can re-parse string literal AST node in our pwn parser. Because it already "works" today (kind of by definition, because you can put anything in a string literal), I don't think it will cause any technical parsing challenge/ambiguities. But this is all just a quick sketch so I could be missing something.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 801
- Fork
- 411
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di emberjs/rfcs
-
each vs each-inAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
emberjs/rfcs#1100 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add LICENSEAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
emberjs/rfcs#982 · 9 commenti · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
emberjs/rfcs#974 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
emberjs/rfcs#940 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di emberjs/rfcs
Issue simili
-
Fixed-position outer <svg> lands outside a clip after scroll; fixed HTML boxes are re-anchoredAperta🔧 in development
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
xdjs/MusicNerdWeb#1532 ·
I maintainer di solito rispondono entro 1 giorno
-
Add a "Talk title" columnApertacontent html
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
bug extension extension: passbolt platform: macOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
raycast/extensions#32415 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno