diff --git a/lib/builtin_query_functions.ts b/lib/builtin_query_functions.ts index b82bba90..192e039d 100644 --- a/lib/builtin_query_functions.ts +++ b/lib/builtin_query_functions.ts @@ -1,5 +1,5 @@ import type { FunctionMap } from "../plug-api/types.ts"; -import { niceDate, niceTime } from "./dates.ts"; +import { niceDate, niceTime, safeTime } from "./dates.ts"; export const builtinFunctions: FunctionMap = { // String functions @@ -83,6 +83,7 @@ export const builtinFunctions: FunctionMap = { return niceDate(new Date()); }, time: () => niceTime(new Date()), + safeTime: () => safeTime(new Date()), tomorrow: () => { const tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); diff --git a/lib/dates.ts b/lib/dates.ts index 63b0057c..c6176b87 100644 --- a/lib/dates.ts +++ b/lib/dates.ts @@ -12,7 +12,11 @@ export function niceDate(d: Date): string { export function niceTime(d: Date): string { const isoDate = d.toISOString(); - let [date, time] = isoDate.split("T"); + const [_, time] = isoDate.split("T"); // hh:mm:ss return time.split(".")[0]; } + +export function safeTime(d: Date): string { + return niceTime(d).replace(/:/g, "-"); +} diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index 5fed58e1..4ec2dc21 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -6,14 +6,15 @@ release. ## Edge _These features are not yet properly released, you need to use [the edge builds](https://community.silverbullet.md/t/living-on-the-edge-builds/27) to try them._ -* Nothing yet since 0.8.3. Stay tuned! +* Nothing yet since 0.8.4. Stay tuned! -## 0.8.3 +## 0.8.4 * [[Page Picker#Keyboard shortcuts]]: allow folder completion using Shift-Space (by [Marek S. Łukasiewicz](https://github.com/silverbulletmd/silverbullet/pull/961)) * New [[Page Decorations]]: ability to hide pages from the page picker and auto complete (by [Marek S. Łukasiewicz](https://github.com/silverbulletmd/silverbullet/pull/962)) * The [[Expression Language]] now supports decimal numbers 🤯 (e.g. `3.14`) * Non-existing pages that have been previously linked to (so effectively: broken links) now appear in the [[Page Picker]] (with a “Create page” hint) as well as in [[Links]] auto complete (marked as “Linked but not created”). This should make it easier to “fill in the gaps”: you can liberally create page links, and create those pages later easily via the page picker. * New [[Space Script]] feature: [[Space Script#Custom HTTP endpoints]]: create custom endpoints on your SilverBullet server (under the `/_/` prefix). +* Updated the [[^Library/Core/New Page/Quick Note]] template to now use a (Windows and Android) naming pattern using the new `safeTime` function, also tweaked the naming pattern slightly (put a `/` in between the date and time so that these are organized by date), updated [[Library/Core/Quick Notes]] to show full path. * Added Ruby [[Markdown/Syntax Highlighting]] (by [Bo Jeanes](https://github.com/silverbulletmd/silverbullet/pull/966)) * **Fix**: Due to some race conditions some situations pages would disappear from the index (e.g. from the [[Page Picker]]), this should now be fixed * New [[SETTINGS]]: `pwaOpenLastPage` and `useSmartQuotes` (latter by [Marek S. Łukasiewicz](https://github.com/silverbulletmd/silverbullet/pull/960)) diff --git a/website/Library/Core/New Page/Quick Note.md b/website/Library/Core/New Page/Quick Note.md index 06617c12..16a85d6b 100644 --- a/website/Library/Core/New Page/Quick Note.md +++ b/website/Library/Core/New Page/Quick Note.md @@ -2,7 +2,7 @@ description: "Create a quick note" tags: template hooks.newPage: - suggestedName: "Inbox/{{today}} {{time}}" + suggestedName: "Inbox/{{today}}/{{safeTime}}" confirmName: false command: "Quick Note" key: "Alt-Shift-n" diff --git a/website/Library/Core/Query/Full Page.md b/website/Library/Core/Query/Full Page.md new file mode 100644 index 00000000..0357f1c1 --- /dev/null +++ b/website/Library/Core/Query/Full Page.md @@ -0,0 +1,5 @@ +--- +tags: template +description: A page reference link as a list item showing the full page path +--- +* [[{{name}}|{{name}}]] \ No newline at end of file diff --git a/website/Library/Core/Quick Notes.md b/website/Library/Core/Quick Notes.md index f5f061e0..9398d29e 100644 --- a/website/Library/Core/Quick Notes.md +++ b/website/Library/Core/Quick Notes.md @@ -1,5 +1,5 @@ This is your {[Quick Note]} inbox. - + ```query -page where name =~ /^Inbox\// render [[Library/Core/Query/Page]] +page where name =~ /^Inbox\// render [[Library/Core/Query/Full Page]] ```