added extra placeholders

This commit is contained in:
Gamosoft 2025-12-16 16:13:24 +01:00
parent c501b030d2
commit d422079b13
5 changed files with 24 additions and 6 deletions

View File

@ -777,6 +777,9 @@ def apply_template_placeholders(content: str, note_path: str) -> str:
{{time}} - Current time (HH:MM:SS) {{time}} - Current time (HH:MM:SS)
{{datetime}} - Current datetime (YYYY-MM-DD HH:MM:SS) {{datetime}} - Current datetime (YYYY-MM-DD HH:MM:SS)
{{timestamp}} - Unix timestamp {{timestamp}} - Unix timestamp
{{year}} - Current year (YYYY)
{{month}} - Current month (MM)
{{day}} - Current day (DD)
{{title}} - Note name without extension {{title}} - Note name without extension
{{folder}} - Parent folder name {{folder}} - Parent folder name
@ -795,6 +798,9 @@ def apply_template_placeholders(content: str, note_path: str) -> str:
'{{time}}': now.strftime('%H:%M:%S'), '{{time}}': now.strftime('%H:%M:%S'),
'{{datetime}}': now.strftime('%Y-%m-%d %H:%M:%S'), '{{datetime}}': now.strftime('%Y-%m-%d %H:%M:%S'),
'{{timestamp}}': str(int(now.timestamp())), '{{timestamp}}': str(int(now.timestamp())),
'{{year}}': now.strftime('%Y'),
'{{month}}': now.strftime('%m'),
'{{day}}': now.strftime('%d'),
'{{title}}': note.stem, '{{title}}': note.stem,
'{{folder}}': note.parent.name if str(note.parent) != '.' else 'Root', '{{folder}}': note.parent.name if str(note.parent) != '.' else 'Root',
} }

View File

@ -412,6 +412,9 @@ Creates a new note from a template with placeholder replacement.
- `{{time}}` - Current time (HH:MM:SS) - `{{time}}` - Current time (HH:MM:SS)
- `{{datetime}}` - Current datetime - `{{datetime}}` - Current datetime
- `{{timestamp}}` - Unix timestamp - `{{timestamp}}` - Unix timestamp
- `{{year}}` - Current year (YYYY)
- `{{month}}` - Current month (MM)
- `{{day}}` - Current day (DD)
- `{{title}}` - Note name without extension - `{{title}}` - Note name without extension
- `{{folder}}` - Parent folder name - `{{folder}}` - Parent folder name

View File

@ -226,6 +226,9 @@ Create notes from reusable templates with dynamic placeholder replacement.
- `{{time}}` - Current time (HH:MM:SS) - `{{time}}` - Current time (HH:MM:SS)
- `{{datetime}}` - Current date and time - `{{datetime}}` - Current date and time
- `{{timestamp}}` - Unix timestamp - `{{timestamp}}` - Unix timestamp
- `{{year}}` - Current year (YYYY)
- `{{month}}` - Current month (MM)
- `{{day}}` - Current day (DD)
- `{{title}}` - Note name (without extension) - `{{title}}` - Note name (without extension)
- `{{folder}}` - Parent folder name - `{{folder}}` - Parent folder name

View File

@ -40,6 +40,9 @@ Templates support dynamic placeholders that are replaced when you create a note:
| `{{time}}` | Current time | `14:30:45` | | `{{time}}` | Current time | `14:30:45` |
| `{{datetime}}` | Current date and time | `2025-11-26 14:30:45` | | `{{datetime}}` | Current date and time | `2025-11-26 14:30:45` |
| `{{timestamp}}` | Unix timestamp | `1732632645` | | `{{timestamp}}` | Unix timestamp | `1732632645` |
| `{{year}}` | Current year | `2025` |
| `{{month}}` | Current month | `11` |
| `{{day}}` | Current day | `26` |
| `{{title}}` | Note name (without .md) | `Weekly Meeting` | | `{{title}}` | Note name (without .md) | `Weekly Meeting` |
| `{{folder}}` | Parent folder name | `Projects` | | `{{folder}}` | Parent folder name | `Projects` |

View File

@ -2547,6 +2547,9 @@
<code style="font-family: monospace;">{{date}}</code>, <code style="font-family: monospace;">{{date}}</code>,
<code style="font-family: monospace;">{{time}}</code>, <code style="font-family: monospace;">{{time}}</code>,
<code style="font-family: monospace;">{{datetime}}</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;">{{title}}</code>,
<code style="font-family: monospace;">{{folder}}</code> <code style="font-family: monospace;">{{folder}}</code>
</div> </div>