((p "A query transclusion is specified by the following sequence, starting at the first position in a line: " (kbd "{{{query:query-expression}}}") "." " " "The line must literally start with the sequence " (kbd "{{{query:") "." " " "Everything after this prefix is interpreted as a " (a (@ (href . "00001007700000")) "query expression") ".") (p "When evaluated, the query expression is evaluated, often resulting in a list of " (a (@ (href . "00001007040310")) "links") " to zettel, matching the query expression." " " "The result replaces the query transclusion element.") (p "For example, to include the list of all zettel with the " (a (@ (href . "00001006020000#tags")) "tags") " " (@L (@H "“") "#search" (@H "”")) ", ordered by title specify the following query transclude element:") (pre (code (@ (class . "language-zmk")) "{{{query:tags:#search ORDER title}}}")) (p "This will result in:") (div (@ (class . "example")) (ul (li (a (@ (href . "00001007780000")) "Formal syntax of query expressions")) (li (a (@ (href . "00001007720000")) "Query Directives")) (li (a (@ (href . "00001007700000")) "Query Expression")) (li (a (@ (href . "00001007770000")) "Query: Action List")) (li (a (@ (href . "00001007720300")) "Query: Context Directive")) (li (a (@ (href . "00001007720600")) "Query: Ident Directive")) (li (a (@ (href . "00001007720900")) "Query: Items Directive")) (li (a (@ (href . "00001007710000")) "Query: List of Zettel Identifier")) (li (a (@ (href . "00001007701000")) "Query: Search Expression")) (li (a (@ (href . "00001007705000")) "Search operator")) (li (a (@ (href . "00001007702000")) "Search term")) (li (a (@ (href . "00001007706000")) "Search value")) (li (a (@ (href . "00001007790000")) "Useful query expressions")) (li (a (@ (href . "00001007031140")) "Zettelmarkup: Query Transclusion")))) (p "For example, this allows to create a dynamic list of zettel inside a zettel, maybe to provide some introductory text followed by a list of child zettel.") (p "The query will deliver only those zettel, which the current user is allowed to read.") (p "In the above example, the action list is empty." " " "This leads to the described list of zettel.") (p "The following actions are supported, parameter and aggregate actions:") (dl (dt (kbd "N") " (or any word that starts with " (@L (@H "“") (kbd "N") (@H "”")) " (parameter)") (dd (p "The resulting list will be a numbered list.")) (dt (kbd "MINn") " (parameter)") (dd (p "Emit only those values with at least " (em "n") " aggregated values." " " (em "n") " must be a positive integer, " (kbd "MIN") " must be given in upper-case letters.")) (dt (kbd "MAXn") " (parameter)") (dd (p "Emit only those values with at most " (em "n") " aggregated values." " " (em "n") " must be a positive integer, " (kbd "MAX") " must be given in upper-case letters.")) (dt (kbd "TITLE") " (parameter)") (dd (p "All words following " (kbd "TITLE") " are joined together to form a title." " " "It is used for the " (kbd "ATOM") " and " (kbd "RSS") " action.")) (dt (kbd "ATOM") " (aggregate)") (dd (p "Transform the zettel list into an " (a (@ (href . "https://www.rfc-editor.org/rfc/rfc4287") (rel . "external")) "Atom 1.0") "-conformant document / feed." " " "The document is embedded into the referencing zettel.")) (dt (kbd "RSS") " (aggregate)") (dd (p "Transform the zettel list into a " (a (@ (href . "https://www.rssboard.org/rss-specification") (rel . "external")) "RSS 2.0") "-conformant document / feed." " " "The document is embedded into the referencing zettel.")) (dt (kbd "KEYS") " (aggregate)") (dd (p "Emit a list of all metadata keys, together with the number of zettel having the key.")) (dt (kbd "REDIRECT") ", " (kbd "REINDEX") " (aggregate)") (dd (p "Will be ignored." " " "These actions may have been copied from an existing " (a (@ (href . "00001012051400")) "API query call") " (or from a WebUI query), but are here superfluous (and possibly harmful).")) (dt "Any " (a (@ (href . "00001006020000")) "metadata key") " of type " (a (@ (href . "00001006035500")) "Word") " or of type " (a (@ (href . "00001006034000")) "TagSet") " (aggregates)") (dd (p "Emit an aggregate of the given metadata key." " " "The key can be given in any letter case" (sup (@ (id . "fnref:1")) (a (@ (class . "zs-noteref") (href . "#fn:1") (role . "doc-noteref")) "1")) "."))) (p "To allow some kind of backward compatibility, an action written in uppercase letters that leads to an empty result list, will be ignored." " " "In this case the list of selected zettel is returned.") (p "Example:") (pre (code (@ (class . "language-zmk")) "{{{query:tags:#search | tags}}}")) (p "This is a tag cloud of all tags that are used together with the tag #search:") (div (@ (class . "example")) (p (a (@ (class . "zs-font-size-2") (href . "?q=tags%3A%23search+tags%3A%23example")) "#example") (sup "1") " " (a (@ (class . "zs-font-size-3") (href . "?q=tags%3A%23search+tags%3A%23manual")) "#manual") (sup "14") " " (a (@ (class . "zs-font-size-2") (href . "?q=tags%3A%23search+tags%3A%23reference")) "#reference") (sup "1") " " (a (@ (class . "zs-font-size-3") (href . "?q=tags%3A%23search+tags%3A%23search")) "#search") (sup "14") " " (a (@ (class . "zs-font-size-2") (href . "?q=tags%3A%23search+tags%3A%23zettelmarkup")) "#zettelmarkup") (sup "1") " " (a (@ (class . "zs-font-size-3") (href . "?q=tags%3A%23search+tags%3A%23zettelstore")) "#zettelstore") (sup "14"))))