bwanders / dokuwiki-strata

Strata - a Semi-Structured Data plugin for Dokuwiki
https://www.dokuwiki.org/plugin:strata
17 stars 8 forks source link

Output a single value into another plugin's syntax #40

Closed FosseWay closed 7 years ago

FosseWay commented 7 years ago

My goal is to populate the syntax for the another extension using values in Strata data. Although this could equally apply to lots of other wiki extensions/syntax, in this example I'm looking at the SwitchPanel plugin

For instance, a four port switch could be specified as follows:

<switchpanel>
==line:4
1,Alpha
2,Beta
3,Gamma
4,Delta
</switchpanel>

which gives output: image

My goal is to do something like:

<switchpanel>
==line:4
1,<strata type="switchport" searchfield="id" searchkey="port1" getvalue="name">
2,<strata type="switchport" searchfield="id" searchkey="port2" getvalue="name">
3,<strata type="switchport" searchfield="id" searchkey="port3" getvalue="name">
4,<strata type="switchport" searchfield="id" searchkey="port4" getvalue="name">
</switchpanel>

to query existing strata objects, e.g.

<data switchport>
id: port1
name: Alpha
</data>

so that the values driving SwitchPanel can be held in Strata data objects, rather than hard-coded on the wiki page where the SwitchPanel representation exists. I realize there are some things I haven't thought of, like how to handle cases where more than one data object shares the same value of id, or a single object has more than one name.

I've looked at the various strata add-on plugins, but I haven't yet figured out how I could achieve this. Is it possible somehow?

bwanders commented 7 years ago

With the way the strata plugin works, and the way bwanders/dokuwiki-plugin-stratatemplatery handles template rendering, this is not possible at the moment.

I have opted to keep the strata rendering and templating abilities within the framework of the DokuWiki parser and renderer (by which I mean that it does not do any manipulation of the source text before the DokuWiki parser sees it). This has several benefits, but alas, also the drawback that what you propose is not possible unless you modify the switchpanel plugin.

(If you are willing to get your hands dirty yourself, I am more than willing to answer any questions you might have regarding the design and use of both bwanders/dokuwiki-plugin-stratatemplatery and bwanders/dokuwiki-plugin-templatery; open up an issue over there if you want to talk!)