Skip to content

Commit 06ad6f8

Browse files
committed
vault: Update query_using_properties.md to use query.file.property()
1 parent 6fdbc77 commit 06ad6f8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ Read a Tasks instruction from a property in this file, and embed it in to any nu
2020
```tasks
2121
explain
2222
ignore global query
23-
{{query.file.frontmatter.task_instruction}}
23+
{{query.file.property('task_instruction')}}
2424
limit 10
2525
```
2626

2727
## Use a multi-line property: task_instructions
2828

29-
Once query.file.frontmatter is accessible, this will fail, as placeholders are applied after the query is split at line-endings...
29+
This fails as the `task_instructions` contains multiple lines , and placeholders are applied after the query is split at line-endings...
3030

3131
```tasks
3232
ignore global query
3333
folder includes Test Data
3434
explain
35-
{{query.file.frontmatter.task_instructions}}
35+
{{query.file.property('task_instructions')}}
3636
```
3737

3838
## Use a list property in a custom filter: root_dirs_to_search

tests/Obsidian/__test_data__/query_using_properties.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@
7777
"end": {
7878
"col": 62,
7979
"line": 37,
80-
"offset": 846
80+
"offset": 852
8181
},
8282
"start": {
8383
"col": 0,
8484
"line": 37,
85-
"offset": 784
85+
"offset": 790
8686
}
8787
}
8888
}
@@ -214,9 +214,9 @@
214214
{
215215
"position": {
216216
"end": {
217-
"col": 130,
217+
"col": 136,
218218
"line": 28,
219-
"offset": 669
219+
"offset": 675
220220
},
221221
"start": {
222222
"col": 0,
@@ -231,12 +231,12 @@
231231
"end": {
232232
"col": 3,
233233
"line": 35,
234-
"offset": 782
234+
"offset": 788
235235
},
236236
"start": {
237237
"col": 0,
238238
"line": 30,
239-
"offset": 671
239+
"offset": 677
240240
}
241241
},
242242
"type": "code"
@@ -246,12 +246,12 @@
246246
"end": {
247247
"col": 62,
248248
"line": 37,
249-
"offset": 846
249+
"offset": 852
250250
},
251251
"start": {
252252
"col": 0,
253253
"line": 37,
254-
"offset": 784
254+
"offset": 790
255255
}
256256
},
257257
"type": "heading"
@@ -261,12 +261,12 @@
261261
"end": {
262262
"col": 3,
263263
"line": 52,
264-
"offset": 1234
264+
"offset": 1240
265265
},
266266
"start": {
267267
"col": 0,
268268
"line": 39,
269-
"offset": 848
269+
"offset": 854
270270
}
271271
},
272272
"type": "code"
@@ -290,7 +290,7 @@
290290
}
291291
]
292292
},
293-
"fileContents": "---\nroot_dirs_to_search:\n - Formats/\n - Filters/\ntask_instruction: group by filename\ntask_instructions: |\n group by root\n group by folder\n group by filename\n---\n\n# query_using_properties\n\n- [ ] #task Task in 'query_using_properties'\n\n## Use a one-line property: task_instruction\n\nRead a Tasks instruction from a property in this file, and embed it in to any number of queries in the file:\n\n```tasks\nexplain\nignore global query\n{{query.file.frontmatter.task_instruction}}\nlimit 10\n```\n\n## Use a multi-line property: task_instructions\n\nOnce query.file.frontmatter is accessible, this will fail, as placeholders are applied after the query is split at line-endings...\n\n```tasks\nignore global query\nfolder includes Test Data\nexplain\n{{query.file.frontmatter.task_instructions}}\n```\n\n## Use a list property in a custom filter: root_dirs_to_search\n\n```tasks\nignore global query\nexplain\n\nfilter by function \\\n if (!query.file.hasProperty('root_dirs_to_search')) { \\\n throw Error('Please set the \"root_dirs_to_search\" list property, with each value ending in a backslash...'); \\\n } \\\n const roots = query.file.property('root_dirs_to_search'); \\\n return roots.includes(task.file.root);\n\nlimit groups 5\ngroup by root\n```\n",
293+
"fileContents": "---\nroot_dirs_to_search:\n - Formats/\n - Filters/\ntask_instruction: group by filename\ntask_instructions: |\n group by root\n group by folder\n group by filename\n---\n\n# query_using_properties\n\n- [ ] #task Task in 'query_using_properties'\n\n## Use a one-line property: task_instruction\n\nRead a Tasks instruction from a property in this file, and embed it in to any number of queries in the file:\n\n```tasks\nexplain\nignore global query\n{{query.file.property('task_instruction')}}\nlimit 10\n```\n\n## Use a multi-line property: task_instructions\n\nThis fails as the `task_instructions` contains multiple lines , and placeholders are applied after the query is split at line-endings...\n\n```tasks\nignore global query\nfolder includes Test Data\nexplain\n{{query.file.property('task_instructions')}}\n```\n\n## Use a list property in a custom filter: root_dirs_to_search\n\n```tasks\nignore global query\nexplain\n\nfilter by function \\\n if (!query.file.hasProperty('root_dirs_to_search')) { \\\n throw Error('Please set the \"root_dirs_to_search\" list property, with each value ending in a backslash...'); \\\n } \\\n const roots = query.file.property('root_dirs_to_search'); \\\n return roots.includes(task.file.root);\n\nlimit groups 5\ngroup by root\n```\n",
294294
"filePath": "Test Data/query_using_properties.md",
295295
"getAllTags": [
296296
"#task"

0 commit comments

Comments
 (0)