staskstate meta data
parent
72453bac88
commit
cc5c2ee316
|
@ -25,6 +25,13 @@ export const builtins: Record<string, Record<string, string>> = {
|
||||||
pos: "number",
|
pos: "number",
|
||||||
tags: "array",
|
tags: "array",
|
||||||
},
|
},
|
||||||
|
taskstate: {
|
||||||
|
ref: "string",
|
||||||
|
tags: "array",
|
||||||
|
state: "string",
|
||||||
|
count: "number",
|
||||||
|
page: "string",
|
||||||
|
},
|
||||||
tag: {
|
tag: {
|
||||||
ref: "string",
|
ref: "string",
|
||||||
name: "string",
|
name: "string",
|
||||||
|
|
|
@ -20,24 +20,22 @@ import { rewritePageRefs } from "$sb/lib/resolve.ts";
|
||||||
import { ObjectValue } from "$sb/types.ts";
|
import { ObjectValue } from "$sb/types.ts";
|
||||||
import { indexObjects, queryObjects } from "../index/plug_api.ts";
|
import { indexObjects, queryObjects } from "../index/plug_api.ts";
|
||||||
|
|
||||||
export type TaskObject = {
|
export type TaskObject = ObjectValue<
|
||||||
ref: string;
|
{
|
||||||
tags: string[];
|
|
||||||
page: string;
|
page: string;
|
||||||
pos: number;
|
pos: number;
|
||||||
name: string;
|
name: string;
|
||||||
done: boolean;
|
done: boolean;
|
||||||
state: string;
|
state: string;
|
||||||
deadline?: string;
|
deadline?: string;
|
||||||
} & Record<string, any>;
|
} & Record<string, any>
|
||||||
|
>;
|
||||||
|
|
||||||
export type TaskStateObject = {
|
export type TaskStateObject = ObjectValue<{
|
||||||
ref: string;
|
|
||||||
tags: string[];
|
|
||||||
state: string;
|
state: string;
|
||||||
count: number;
|
count: number;
|
||||||
page: string;
|
page: string;
|
||||||
};
|
}>;
|
||||||
|
|
||||||
function getDeadline(deadlineNode: ParseTree): string {
|
function getDeadline(deadlineNode: ParseTree): string {
|
||||||
return deadlineNode.children![0].text!.replace(/📅\s*/, "");
|
return deadlineNode.children![0].text!.replace(/📅\s*/, "");
|
||||||
|
|
|
@ -54,6 +54,18 @@ Although you may want to render it using a template such as [[template/task]] in
|
||||||
upnext render [[template/task]]
|
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
|
||||||
$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]].
|
List items (both bullet point and numbered items) are indexed by default with the `item` tag, and additional tags can be added using [[Tags]].
|
||||||
|
|
Loading…
Reference in New Issue