Templates 2.0 (#636)

Templates 2.0 and a whole bunch of other refactoring
This commit is contained in:
Zef Hemel
2024-01-20 19:16:07 +01:00
committed by GitHub
parent 0a6a0016a2
commit f30b1d3418
171 changed files with 2038 additions and 1628 deletions
@@ -0,0 +1,9 @@
---
description: >
Adds a convenient "Copy to my space" button to any
template found via federation
tags: template
hooks.bottom.where: 'name =~ /^!/ and tags="template"'
---
# Template actions
* {[Page: Copy|Copy to my space]}: use this template in your space by making a local copy of it (and tweaking it as you like)
@@ -0,0 +1,18 @@
---
description: Adds Linked Mentions to pages
tags: template
hooks.bottom.where: 'true'
---
```template
# We need to escape handlebars directives here, since we're embedding
# this template into a template (INCEPTION)
template: |
{{escape "#if ."}}
# Linked Mentions
{{escape "#each ."}}
* [[{{escape "ref"}}]]: `{{escape "snippet"}}`
{{escape "/each"}}
{{escape "/if"}}
query: |
link where toPage = "{{@page.name}}" and page != "{{@page.name}}"
```
@@ -0,0 +1,9 @@
---
tags: template
description: |
Shows all tasks that contain a link the current page. For instance a task that references `[[John]]` in its name, would appear on the `John` page.
---
```query
task where name =~ /\[\[{{escapeRegexp @page.name}}\]\]/ where done = false render [[Library/Core/Query/Task]]
```
@@ -0,0 +1,11 @@
---
description: Adds a Table of Contents to pages
tags: template
hooks.top:
where: 'true'
# Show all the way at the top
order: 0
---
```toc
minHeaders: 3
```
@@ -0,0 +1,9 @@
---
tags: template
description: Queries all tasks tagged with a specific tag.
usage: Pass in the tag to filter on as the `value` of this template
---
```query
task where tags = "{{.}}" and done = false render [[Library/Core/Query/Task]]
```