Templating: allow import name to be dynamic
Aperta
@mikeerickson ci sta già lavorando.
Dal 11/1/2024.
- Lingua principale
- JavaScript
- Stelle
- 204
- Fork
- 82
- Merge medio
- 22h 27m
- PR unite (30g)
- 3
Descrizione
A user has created a template that dynamically imports a template based on the day of the week.
What would be ideal would be to allow this import to load a template based on the calculated day, e.g.:
const daysOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
const today = daysOfWeek[this_date.getDay()]
const templateName = `☀️ Daily Note - ${today}`
...
<% import(`${templateName}`) -%>
This doesn't work as the code is currently written.
The string in the import statement is treated as a literal and is not interpolated.
***************************************************************************
ERROR
Method: NPTemplating.getTemplate:
Message: Template "${templateName}" Not Found or Empty
***************************************************************************
Would be nice to allow this to be dynamic so that the code above would load "☀️ Daily Note - Mon" or "☀️ Daily Note - Fri"
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Valutazione
Questa issue non è ancora stata valutata.