Files
plainleaf/libraries/Library/Std/Query Templates.md
T
Zef HemelandGitHub a524c64884 Go backend (#1555)
* Replaces old Deno server with a Go implementation
* Restructured the code base accordingly
2025-09-19 13:23:20 +02:00

1.3 KiB

#meta

A work-in-progress library of generally useful templates for rendering queries.

-- Renders a page object as a linked list item
templates.pageItem = template.new([==[
* [[${name}]]
]==])

-- Renders a page object as a linked list item with full path
templates.fullPageItem = template.new([==[
* [[${name}|${name}]]
]==])

-- Renders a task object as a togglable task
templates.taskItem = template.new([==[
* [${state}] [[${ref}]] ${name}
]==])

-- Renders an item object
templates.itemItem = template.new([==[
* [[${ref}]] ${name}
]==])

-- Renders a paragraph object
templates.paragraphItem = template.new([==[
* [[${ref}]] ${text}
]==])

-- Renders a tag object
templates.tagItem = template.new([==[
* [[tag:${name}|#${name}]]
]==])

Examples

template.pageItem: ${template.each(queryfrom index.tag "page" limit 3, templates.pageItem)}

template.taskItem:

* [ ] Task 1
* [ ] Task 2

${template.each(query, templates.taskItem)}

template.itemItem:

* Item 1
* Item 2

${template.each(query, templates.itemItem)}

template.tagItem:

* #tag1
* #tag2
* #tag3

${template.each(query, templates.tagItem)}