Table of Contents
Struct Template Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" unknown
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" unknown
- 2020-07-29 "Hogfather" yes
Similar to dataloop, datatemplate, structtemplating
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
:
name | link |
---|---|
Facebook | https://www.facebook.com/pages/DokuWiki/52877633616 |
Twitter | https://twitter.com/dokuwiki |
GitHub | https://github.com/dokuwiki/dokuwiki |
… the following template:
<struct-template> ---- data ---- schema : socialmedia cols : name, link ---- [[{{$$socialmedia.link}}|{{$$socialmedia.name}}]] </struct-template>
… will render as:
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
- Support HTML templates (2022-03-11 23:53)
- Add README and LICENSE (2022-03-11 19:20)
- Support rendering Wiki templates (2022-03-11 18:44)
- Initial commit (2022-01-25 05:09)
Known Bugs and Issues
Please report bugs and issues at https://github.com/iainhallam/dokuwiki-plugin-structtemplate/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.