Skip to content

Commit faf6652

Browse files
authored
Merge pull request #3316 from obsidian-tasks-group/shorten-property-names
refactor: Rename 'tasks_query_*' properties to 'TQ_*'
2 parents c6cb8dd + 250190d commit faf6652

22 files changed

+430
-428
lines changed

docs/Queries/Query File Defaults.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ To try this out:
3030
- Enable the Obsidian core Properties view plugin: `Settings` > `Core plugins` > turn on `Properties view`
3131
- Switch to Reading or Live Preview modes.
3232
- Run the `Properties view: Show file properties` command.
33-
2. Add one or more `tasks_query_*` properties to the file
33+
2. Add one or more `TQ_*` properties to the file
3434
- Click on `Add property`.
35-
- Start typing `tasks_query_`.
35+
- Start typing `TQ_`.
3636
- Or you can paste in property names from the [[#Supported Query File Defaults property values]] section below.
3737
- Press `<Return>` or `<Enter>` to add the property.
38-
3. Now you can modify these `tasks_query_*` properties to change the behaviour of Tasks searches in this file.
38+
3. Now you can modify these `TQ_*` properties to change the behaviour of Tasks searches in this file.
3939

4040
> [!info]
4141
> We plan to streamline the addition of these properties to notes.
@@ -50,7 +50,7 @@ You can make them wider with the following CSS Snippet.
5050
```css
5151
/* Make property labels wider, to fit the names of Tasks-specific properties */
5252
.metadata-content {
53-
--metadata-label-width: 18em;
53+
--metadata-label-width: 14em;
5454
}
5555
```
5656
<!-- endSnippet -->
@@ -84,27 +84,27 @@ These are all the properties currently supported by Tasks, as Query File Default
8484
<!-- snippet: DocsSamplesForDefaults.test.DocsSamplesForDefaults_supported-properties-empty.approved.yaml -->
8585
```yaml
8686
---
87-
tasks_query_explain:
88-
tasks_query_short_mode:
89-
tasks_query_show_tree:
90-
tasks_query_show_tags:
91-
tasks_query_show_id:
92-
tasks_query_show_depends_on:
93-
tasks_query_show_priority:
94-
tasks_query_show_recurrence_rule:
95-
tasks_query_show_on_completion:
96-
tasks_query_show_created_date:
97-
tasks_query_show_start_date:
98-
tasks_query_show_scheduled_date:
99-
tasks_query_show_due_date:
100-
tasks_query_show_cancelled_date:
101-
tasks_query_show_done_date:
102-
tasks_query_show_urgency:
103-
tasks_query_show_backlink:
104-
tasks_query_show_edit_button:
105-
tasks_query_show_postpone_button:
106-
tasks_query_show_task_count:
107-
tasks_query_extra_instructions:
87+
TQ_explain:
88+
TQ_short_mode:
89+
TQ_show_tree:
90+
TQ_show_tags:
91+
TQ_show_id:
92+
TQ_show_depends_on:
93+
TQ_show_priority:
94+
TQ_show_recurrence_rule:
95+
TQ_show_on_completion:
96+
TQ_show_created_date:
97+
TQ_show_start_date:
98+
TQ_show_scheduled_date:
99+
TQ_show_due_date:
100+
TQ_show_cancelled_date:
101+
TQ_show_done_date:
102+
TQ_show_urgency:
103+
TQ_show_backlink:
104+
TQ_show_edit_button:
105+
TQ_show_postpone_button:
106+
TQ_show_task_count:
107+
TQ_extra_instructions:
108108
---
109109
```
110110
<!-- endSnippet -->
@@ -125,27 +125,29 @@ File Defaults.
125125
```json
126126
{
127127
"types": {
128-
"tasks_query_explain": "checkbox",
129-
"tasks_query_short_mode": "checkbox",
130-
"tasks_query_show_tree": "checkbox",
131-
"tasks_query_show_tags": "checkbox",
132-
"tasks_query_show_id": "checkbox",
133-
"tasks_query_show_depends_on": "checkbox",
134-
"tasks_query_show_priority": "checkbox",
135-
"tasks_query_show_recurrence_rule": "checkbox",
136-
"tasks_query_show_on_completion": "checkbox",
137-
"tasks_query_show_created_date": "checkbox",
138-
"tasks_query_show_start_date": "checkbox",
139-
"tasks_query_show_scheduled_date": "checkbox",
140-
"tasks_query_show_due_date": "checkbox",
141-
"tasks_query_show_cancelled_date": "checkbox",
142-
"tasks_query_show_done_date": "checkbox",
143-
"tasks_query_show_urgency": "checkbox",
144-
"tasks_query_show_backlink": "checkbox",
145-
"tasks_query_show_edit_button": "checkbox",
146-
"tasks_query_show_postpone_button": "checkbox",
147-
"tasks_query_show_task_count": "checkbox",
148-
"tasks_query_extra_instructions": "text"
128+
"TQ_explain": "checkbox",
129+
"TQ_short_mode": "checkbox",
130+
"TQ_show_tree": "checkbox",
131+
"TQ_show_tags": "checkbox",
132+
"TQ_show_id": "checkbox",
133+
"TQ_show_depends_on": "checkbox",
134+
"TQ_show_priority": "checkbox",
135+
"TQ_show_recurrence_rule": "checkbox",
136+
"TQ_show_on_completion": "checkbox",
137+
"TQ_show_created_date": "checkbox",
138+
"TQ_show_start_date": "checkbox",
139+
"TQ_show_scheduled_date": "checkbox",
140+
"TQ_show_due_date": "checkbox",
141+
"TQ_show_cancelled_date": "checkbox",
142+
"TQ_show_done_date": "checkbox",
143+
"TQ_show_urgency": "checkbox",
144+
"TQ_show_backlink": "checkbox",
145+
"TQ_show_edit_button": "checkbox",
146+
"TQ_show_postpone_button": "checkbox",
147+
"TQ_show_task_count": "checkbox",
148+
"TQ_sort_by": "multitext",
149+
"TQ_group_by": "multitext",
150+
"TQ_extra_instructions": "text"
149151
}
150152
}
151153
```
-1.3 KB
Loading
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<!-- snippet: DocsSamplesForDefaults.test.DocsSamplesForDefaults_meta-bind-widgets-snippet.approved.md -->
22
```md
3-
short mode: `INPUT[toggle:tasks_query_short_mode]`
4-
tree: `INPUT[toggle:tasks_query_show_tree]`
5-
tags: `INPUT[toggle:tasks_query_show_tags]`
6-
id: `INPUT[toggle:tasks_query_show_id]` depends on: `INPUT[toggle:tasks_query_show_depends_on]`
7-
priority: `INPUT[toggle:tasks_query_show_priority]`
8-
recurrence rule: `INPUT[toggle:tasks_query_show_recurrence_rule]` on completion: `INPUT[toggle:tasks_query_show_on_completion]`
9-
start date: `INPUT[toggle:tasks_query_show_start_date]` scheduled date: `INPUT[toggle:tasks_query_show_scheduled_date]` due date: `INPUT[toggle:tasks_query_show_due_date]`
10-
created date: `INPUT[toggle:tasks_query_show_created_date]` cancelled date: `INPUT[toggle:tasks_query_show_cancelled_date]` done date: `INPUT[toggle:tasks_query_show_done_date]`
11-
urgency: `INPUT[toggle:tasks_query_show_urgency]`
12-
backlink: `INPUT[toggle:tasks_query_show_backlink]`
13-
edit button: `INPUT[toggle:tasks_query_show_edit_button]` postpone button: `INPUT[toggle:tasks_query_show_postpone_button]`
14-
task count: `INPUT[toggle:tasks_query_show_task_count]`
15-
extra instructions: `INPUT[textArea:tasks_query_extra_instructions]`
16-
explain: `INPUT[toggle:tasks_query_explain]`
3+
short mode: `INPUT[toggle:TQ_short_mode]`
4+
tree: `INPUT[toggle:TQ_show_tree]`
5+
tags: `INPUT[toggle:TQ_show_tags]`
6+
id: `INPUT[toggle:TQ_show_id]` depends on: `INPUT[toggle:TQ_show_depends_on]`
7+
priority: `INPUT[toggle:TQ_show_priority]`
8+
recurrence rule: `INPUT[toggle:TQ_show_recurrence_rule]` on completion: `INPUT[toggle:TQ_show_on_completion]`
9+
start date: `INPUT[toggle:TQ_show_start_date]` scheduled date: `INPUT[toggle:TQ_show_scheduled_date]` due date: `INPUT[toggle:TQ_show_due_date]`
10+
created date: `INPUT[toggle:TQ_show_created_date]` cancelled date: `INPUT[toggle:TQ_show_cancelled_date]` done date: `INPUT[toggle:TQ_show_done_date]`
11+
urgency: `INPUT[toggle:TQ_show_urgency]`
12+
backlink: `INPUT[toggle:TQ_show_backlink]`
13+
edit button: `INPUT[toggle:TQ_show_edit_button]` postpone button: `INPUT[toggle:TQ_show_postpone_button]`
14+
task count: `INPUT[toggle:TQ_show_task_count]`
15+
extra instructions: `INPUT[textArea:TQ_extra_instructions]`
16+
explain: `INPUT[toggle:TQ_explain]`
1717
```
1818
<!-- endSnippet -->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/* Make property labels wider, to fit the names of Tasks-specific properties */
22
.metadata-content {
3-
--metadata-label-width: 18em;
3+
--metadata-label-width: 14em;
44
}

resources/sample_vaults/Tasks-Demo/.obsidian/types.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@
1616
"creation date": "datetime",
1717
"project": "text",
1818
"sample_text_multiline_property": "text",
19-
"tasks_query_explain": "checkbox",
20-
"tasks_query_short_mode": "checkbox",
21-
"tasks_query_show_tree": "checkbox",
22-
"tasks_query_show_tags": "checkbox",
23-
"tasks_query_show_id": "checkbox",
24-
"tasks_query_show_depends_on": "checkbox",
25-
"tasks_query_show_priority": "checkbox",
26-
"tasks_query_show_recurrence_rule": "checkbox",
27-
"tasks_query_show_on_completion": "checkbox",
28-
"tasks_query_show_created_date": "checkbox",
29-
"tasks_query_show_start_date": "checkbox",
30-
"tasks_query_show_scheduled_date": "checkbox",
31-
"tasks_query_show_due_date": "checkbox",
32-
"tasks_query_show_cancelled_date": "checkbox",
33-
"tasks_query_show_done_date": "checkbox",
34-
"tasks_query_show_urgency": "checkbox",
35-
"tasks_query_show_backlink": "checkbox",
36-
"tasks_query_show_edit_button": "checkbox",
37-
"tasks_query_show_postpone_button": "checkbox",
38-
"tasks_query_show_task_count": "checkbox",
39-
"tasks_query_sort_by": "multitext",
40-
"tasks_query_group_by": "multitext",
41-
"tasks_query_extra_instructions": "text"
19+
"TQ_explain": "checkbox",
20+
"TQ_short_mode": "checkbox",
21+
"TQ_show_tree": "checkbox",
22+
"TQ_show_tags": "checkbox",
23+
"TQ_show_id": "checkbox",
24+
"TQ_show_depends_on": "checkbox",
25+
"TQ_show_priority": "checkbox",
26+
"TQ_show_recurrence_rule": "checkbox",
27+
"TQ_show_on_completion": "checkbox",
28+
"TQ_show_created_date": "checkbox",
29+
"TQ_show_start_date": "checkbox",
30+
"TQ_show_scheduled_date": "checkbox",
31+
"TQ_show_due_date": "checkbox",
32+
"TQ_show_cancelled_date": "checkbox",
33+
"TQ_show_done_date": "checkbox",
34+
"TQ_show_urgency": "checkbox",
35+
"TQ_show_backlink": "checkbox",
36+
"TQ_show_edit_button": "checkbox",
37+
"TQ_show_postpone_button": "checkbox",
38+
"TQ_show_task_count": "checkbox",
39+
"TQ_sort_by": "multitext",
40+
"TQ_group_by": "multitext",
41+
"TQ_extra_instructions": "text"
4242
}
4343
}

resources/sample_vaults/Tasks-Demo/Manual Testing/Frontmatter/Placeholder examples to capture in tests and docs.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
2-
tasks_query_explain: false
3-
tasks_query_short_mode: false
4-
tasks_query_show_tree: true
5-
tasks_query_show_tags: true
6-
tasks_query_show_id: true
7-
tasks_query_show_depends_on: true
8-
tasks_query_show_priority: true
9-
tasks_query_show_recurrence_rule: true
10-
tasks_query_show_on_completion: true
11-
tasks_query_show_created_date: true
12-
tasks_query_show_start_date: true
13-
tasks_query_show_scheduled_date: true
14-
tasks_query_show_due_date: true
15-
tasks_query_show_cancelled_date: true
16-
tasks_query_show_done_date: true
17-
tasks_query_show_urgency: true
18-
tasks_query_show_backlink: true
19-
tasks_query_show_edit_button: true
20-
tasks_query_show_postpone_button: true
21-
tasks_query_show_task_count: true
22-
tasks_query_sort_by:
2+
TQ_explain: false
3+
TQ_short_mode: false
4+
TQ_show_tree: true
5+
TQ_show_tags: true
6+
TQ_show_id: true
7+
TQ_show_depends_on: true
8+
TQ_show_priority: true
9+
TQ_show_recurrence_rule: true
10+
TQ_show_on_completion: true
11+
TQ_show_created_date: true
12+
TQ_show_start_date: true
13+
TQ_show_scheduled_date: true
14+
TQ_show_due_date: true
15+
TQ_show_cancelled_date: true
16+
TQ_show_done_date: true
17+
TQ_show_urgency: true
18+
TQ_show_backlink: true
19+
TQ_show_edit_button: true
20+
TQ_show_postpone_button: true
21+
TQ_show_task_count: true
22+
TQ_sort_by:
2323
- description
24-
tasks_query_group_by:
24+
TQ_group_by:
2525
- status.type
2626
- happens reverse
2727
- function task.tags.sort().join(' ')
28-
tasks_query_extra_instructions: |-
28+
TQ_extra_instructions: |-
2929
# press shift-return to add new lines
3030
# not done
3131
# sort by done date
@@ -39,28 +39,28 @@ tasks_query_extra_instructions: |-
3939

4040
<!-- placeholder to force blank line before included text --><!-- include: DocsSamplesForDefaults.test.DocsSamplesForDefaults_meta-bind-widgets-include.approved.md -->
4141

42-
short mode: `INPUT[toggle:tasks_query_short_mode]`
43-
tree: `INPUT[toggle:tasks_query_show_tree]`
44-
tags: `INPUT[toggle:tasks_query_show_tags]`
45-
id: `INPUT[toggle:tasks_query_show_id]` depends on: `INPUT[toggle:tasks_query_show_depends_on]`
46-
priority: `INPUT[toggle:tasks_query_show_priority]`
47-
recurrence rule: `INPUT[toggle:tasks_query_show_recurrence_rule]` on completion: `INPUT[toggle:tasks_query_show_on_completion]`
48-
start date: `INPUT[toggle:tasks_query_show_start_date]` scheduled date: `INPUT[toggle:tasks_query_show_scheduled_date]` due date: `INPUT[toggle:tasks_query_show_due_date]`
49-
created date: `INPUT[toggle:tasks_query_show_created_date]` cancelled date: `INPUT[toggle:tasks_query_show_cancelled_date]` done date: `INPUT[toggle:tasks_query_show_done_date]`
50-
urgency: `INPUT[toggle:tasks_query_show_urgency]`
51-
backlink: `INPUT[toggle:tasks_query_show_backlink]`
52-
edit button: `INPUT[toggle:tasks_query_show_edit_button]` postpone button: `INPUT[toggle:tasks_query_show_postpone_button]`
53-
task count: `INPUT[toggle:tasks_query_show_task_count]`
54-
extra instructions: `INPUT[textArea:tasks_query_extra_instructions]`
55-
explain: `INPUT[toggle:tasks_query_explain]`
42+
short mode: `INPUT[toggle:TQ_short_mode]`
43+
tree: `INPUT[toggle:TQ_show_tree]`
44+
tags: `INPUT[toggle:TQ_show_tags]`
45+
id: `INPUT[toggle:TQ_show_id]` depends on: `INPUT[toggle:TQ_show_depends_on]`
46+
priority: `INPUT[toggle:TQ_show_priority]`
47+
recurrence rule: `INPUT[toggle:TQ_show_recurrence_rule]` on completion: `INPUT[toggle:TQ_show_on_completion]`
48+
start date: `INPUT[toggle:TQ_show_start_date]` scheduled date: `INPUT[toggle:TQ_show_scheduled_date]` due date: `INPUT[toggle:TQ_show_due_date]`
49+
created date: `INPUT[toggle:TQ_show_created_date]` cancelled date: `INPUT[toggle:TQ_show_cancelled_date]` done date: `INPUT[toggle:TQ_show_done_date]`
50+
urgency: `INPUT[toggle:TQ_show_urgency]`
51+
backlink: `INPUT[toggle:TQ_show_backlink]`
52+
edit button: `INPUT[toggle:TQ_show_edit_button]` postpone button: `INPUT[toggle:TQ_show_postpone_button]`
53+
task count: `INPUT[toggle:TQ_show_task_count]`
54+
extra instructions: `INPUT[textArea:TQ_extra_instructions]`
55+
explain: `INPUT[toggle:TQ_explain]`
5656

5757
<!-- placeholder to force blank line after included text --><!-- endInclude -->
5858

5959
## Can now have logical operators inside placeholders
6060

6161
So we can easily control the query interactively now, via Obsidian's File Properties panel!!!
6262

63-
The `tasks_query_` prefix was chosen to stand for `Task Query`. Interpretation of all of these except `tasks_query_sort_by` and `tasks_query_group_by` is now built in to Tasks.
63+
The `TQ_` prefix was chosen to stand for `Task Query`. Interpretation of all of these except `TQ_sort_by` and `TQ_group_by` is now built in to Tasks.
6464

6565
To try this out:
6666

@@ -74,8 +74,8 @@ path includes {{query.file.path}}
7474
7575
# Instructions are listed in the order that items are displayed in Tasks search results
7676
77-
{{const prop = 'tasks_query_sort_by'; return query.file.hasProperty(prop) && query.file.property(prop).map((g) => 'sort by ' + g).join('\n') || ''}}
78-
{{const prop = 'tasks_query_group_by'; return query.file.hasProperty(prop) && query.file.property(prop).map((g) => 'group by ' + g).join('\n') || ''}}
77+
{{const prop = 'TQ_sort_by'; return query.file.hasProperty(prop) && query.file.property(prop).map((g) => 'sort by ' + g).join('\n') || ''}}
78+
{{const prop = 'TQ_group_by'; return query.file.hasProperty(prop) && query.file.property(prop).map((g) => 'group by ' + g).join('\n') || ''}}
7979
```
8080

8181
## Can now call functions inside placeholders

resources/sample_vaults/Tasks-Demo/Test Data/query_file_defaults_all_options_false.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
2-
tasks_query_explain: false
3-
tasks_query_short_mode: false
4-
tasks_query_show_tree: false
5-
tasks_query_show_tags: false
6-
tasks_query_show_id: false
7-
tasks_query_show_depends_on: false
8-
tasks_query_show_priority: false
9-
tasks_query_show_recurrence_rule: false
10-
tasks_query_show_on_completion: false
11-
tasks_query_show_created_date: false
12-
tasks_query_show_start_date: false
13-
tasks_query_show_scheduled_date: false
14-
tasks_query_show_due_date: false
15-
tasks_query_show_cancelled_date: false
16-
tasks_query_show_done_date: false
17-
tasks_query_show_urgency: false
18-
tasks_query_show_backlink: false
19-
tasks_query_show_edit_button: false
20-
tasks_query_show_postpone_button: false
21-
tasks_query_show_task_count: false
22-
tasks_query_extra_instructions: |-
2+
TQ_explain: false
3+
TQ_short_mode: false
4+
TQ_show_tree: false
5+
TQ_show_tags: false
6+
TQ_show_id: false
7+
TQ_show_depends_on: false
8+
TQ_show_priority: false
9+
TQ_show_recurrence_rule: false
10+
TQ_show_on_completion: false
11+
TQ_show_created_date: false
12+
TQ_show_start_date: false
13+
TQ_show_scheduled_date: false
14+
TQ_show_due_date: false
15+
TQ_show_cancelled_date: false
16+
TQ_show_done_date: false
17+
TQ_show_urgency: false
18+
TQ_show_backlink: false
19+
TQ_show_edit_button: false
20+
TQ_show_postpone_button: false
21+
TQ_show_task_count: false
22+
TQ_extra_instructions: |-
2323
# press shift-return to add new lines
2424
not done
2525
---

0 commit comments

Comments
 (0)