Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Templating: allow import name to be dynamic

オープン
#514 コメント 0 件 リアクション 1 件 担当者 1 名 GitHub で見る

@mikeerickson がすでに取り組んでいます。

2024年1月11日 から。

評価

この issue はまだ評価されていません。

説明

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"

主要言語
JavaScript
スター
203
フォーク
81
平均マージ
52分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NotePlan/plugins のほかの issue

NotePlan/plugins の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。