DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:structtemplate

Struct Template Plugin

Compatible with DokuWiki

  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" unknown
  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown

plugin Use struct data to fill in a template, as many times as there are results.

Last updated on
2022-03-11
Provides
Syntax
Repository
Source
Requires
struct

Tagged with html, struct, template

Installation

:!: External requirements: This plugin requires the following additional components that must be installed separately:

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

Social media links:

With a struct schema, socialmedia:

namelink
Facebookhttp://www.facebook.com/pages/DokuWiki/52877633616
Twitterhttp://twitter.com/dokuwiki
GitHubhttps://github.com/splitbrain/dokuwiki

… the following template:

<struct-template>
---- data ----
schema: socialmedia
cols: name, link
----
 [[{{$$social.link}}|{{$$name}}]]
</struct-template>

… will render as:

Facebook Twitter GitHub

Syntax

Basic syntax

<struct-template>
---- data ----
schema: ...
cols: ...
filter: ...
sort: ...
----
...
</struct-template>

The opening tag can be any of the following:

  • <struct-template> or <struct-template inline>: will be enclosed in any element from outside the template
  • <STRUCT-TEMPLATE> or <struct-template block>: any block-level element before the template will be closed before rendering; if using the capitalised version, the end tag must be </STRUCT-TEMPLATE>

The data block can be pretty much any syntax from the struct table aggregation; each entry in the resulting data will be used once to render the template.

Value interpolation

Following the data block, the template will be interpreted as Wiki text in the normal DokuWiki format. Entries from the data can be used with a similar syntax to the struct value aggregation, but using a double dollar sign:

{{$$schema.column}}
{{$$%pageid%}}

Unlike the struct value aggregation, the schema must always be supplied. You can still use the actual struct value aggregation ({{$[page].[schema].column}}).

HTML template

If the DokuWiki HTML OK configuration setting is enabled, you can add a flag to the opening template tag to interpret the template as HTML, without having to render the Wiki text. This can speed up processing by a lot on a page with a few templates on.

<struct-template inline html>
...
</struct-template>

The html option must come after the inline or block specifier.

Development

Change Log

Subscribe to 'Struct Template Plugin Change Log' by RSS

Known Bugs and Issues

FAQ

[discussions should ideally be deleted and turned into FAQ entries along the way]

Discussion

Please sign your contribution with the button in the editor controls.

plugin/structtemplate.txt · Last modified: 2022-03-11 23:39 by iainhallam

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki