staskstate meta data

pull/532/head
Zef Hemel 2023-10-13 17:10:57 +02:00
parent 72453bac88
commit cc5c2ee316
3 changed files with 31 additions and 14 deletions

View File

@ -25,6 +25,13 @@ export const builtins: Record<string, Record<string, string>> = {
pos: "number",
tags: "array",
},
taskstate: {
ref: "string",
tags: "array",
state: "string",
count: "number",
page: "string",
},
tag: {
ref: "string",
name: "string",

View File

@ -20,24 +20,22 @@ import { rewritePageRefs } from "$sb/lib/resolve.ts";
import { ObjectValue } from "$sb/types.ts";
import { indexObjects, queryObjects } from "../index/plug_api.ts";
export type TaskObject = {
ref: string;
tags: string[];
export type TaskObject = ObjectValue<
{
page: string;
pos: number;
name: string;
done: boolean;
state: string;
deadline?: string;
} & Record<string, any>;
} & Record<string, any>
>;
export type TaskStateObject = {
ref: string;
tags: string[];
export type TaskStateObject = ObjectValue<{
state: string;
count: number;
page: string;
};
}>;
function getDeadline(deadlineNode: ParseTree): string {
return deadlineNode.children![0].text!.replace(/📅\s*/, "");

View File

@ -54,6 +54,18 @@ Although you may want to render it using a template such as [[template/task]] in
upnext render [[template/task]]
```
## taskstate
[[🔌 Tasks]] support the default `x` and ` ` states (done and not done), but custom states as well. Custom states used across your space are kept in `taskstate`:
* [NOT STARTED] Task 1
* [IN PROGRESS] Task 2
And can be queried as follows:
```query
taskstate where page = "{{@page.name}}"
```
## item
$item
List items (both bullet point and numbered items) are indexed by default with the `item` tag, and additional tags can be added using [[Tags]].