Merge pull request #106 from gamosoft/features/additional-placeholders
as suggested by @brouberol in #100 adds new template placeholders: year month day
This commit is contained in:
commit
d44abdda72
|
|
@ -777,6 +777,9 @@ def apply_template_placeholders(content: str, note_path: str) -> str:
|
|||
{{time}} - Current time (HH:MM:SS)
|
||||
{{datetime}} - Current datetime (YYYY-MM-DD HH:MM:SS)
|
||||
{{timestamp}} - Unix timestamp
|
||||
{{year}} - Current year (YYYY)
|
||||
{{month}} - Current month (MM)
|
||||
{{day}} - Current day (DD)
|
||||
{{title}} - Note name without extension
|
||||
{{folder}} - Parent folder name
|
||||
|
||||
|
|
@ -795,6 +798,9 @@ def apply_template_placeholders(content: str, note_path: str) -> str:
|
|||
'{{time}}': now.strftime('%H:%M:%S'),
|
||||
'{{datetime}}': now.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'{{timestamp}}': str(int(now.timestamp())),
|
||||
'{{year}}': now.strftime('%Y'),
|
||||
'{{month}}': now.strftime('%m'),
|
||||
'{{day}}': now.strftime('%d'),
|
||||
'{{title}}': note.stem,
|
||||
'{{folder}}': note.parent.name if str(note.parent) != '.' else 'Root',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,6 +412,9 @@ Creates a new note from a template with placeholder replacement.
|
|||
- `{{time}}` - Current time (HH:MM:SS)
|
||||
- `{{datetime}}` - Current datetime
|
||||
- `{{timestamp}}` - Unix timestamp
|
||||
- `{{year}}` - Current year (YYYY)
|
||||
- `{{month}}` - Current month (MM)
|
||||
- `{{day}}` - Current day (DD)
|
||||
- `{{title}}` - Note name without extension
|
||||
- `{{folder}}` - Parent folder name
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,9 @@ Create notes from reusable templates with dynamic placeholder replacement.
|
|||
- `{{time}}` - Current time (HH:MM:SS)
|
||||
- `{{datetime}}` - Current date and time
|
||||
- `{{timestamp}}` - Unix timestamp
|
||||
- `{{year}}` - Current year (YYYY)
|
||||
- `{{month}}` - Current month (MM)
|
||||
- `{{day}}` - Current day (DD)
|
||||
- `{{title}}` - Note name (without extension)
|
||||
- `{{folder}}` - Parent folder name
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ Templates support dynamic placeholders that are replaced when you create a note:
|
|||
| `{{time}}` | Current time | `14:30:45` |
|
||||
| `{{datetime}}` | Current date and time | `2025-11-26 14:30:45` |
|
||||
| `{{timestamp}}` | Unix timestamp | `1732632645` |
|
||||
| `{{year}}` | Current year | `2025` |
|
||||
| `{{month}}` | Current month | `11` |
|
||||
| `{{day}}` | Current day | `26` |
|
||||
| `{{title}}` | Note name (without .md) | `Weekly Meeting` |
|
||||
| `{{folder}}` | Parent folder name | `Projects` |
|
||||
|
||||
|
|
|
|||
|
|
@ -2547,6 +2547,9 @@
|
|||
<code style="font-family: monospace;">{{date}}</code>,
|
||||
<code style="font-family: monospace;">{{time}}</code>,
|
||||
<code style="font-family: monospace;">{{datetime}}</code>,
|
||||
<code style="font-family: monospace;">{{year}}</code>,
|
||||
<code style="font-family: monospace;">{{month}}</code>,
|
||||
<code style="font-family: monospace;">{{day}}</code>,
|
||||
<code style="font-family: monospace;">{{title}}</code>,
|
||||
<code style="font-family: monospace;">{{folder}}</code>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue