DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:variants

variants Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" yes

plugin Allows to create different variants of a page that the user can select

Last updated on
2016-01-16
Provides
Syntax
Repository
Source

Similar to condition

Tagged with condition, if

This plugin allows to create variants of page that can be switched depending on a URL parameter or in later versions also a value that is stored in the session.

The parts that shall be different for the different variants can be specified using an if/else conditional syntax that can be nested and repeated in order to offer maximum flexibility.

Inside the syntax all kinds of other syntax can be used, though there could be problems/unwanted behaviors in certain cases. There are known issues with the include plugin, the include plugin can't correct links inside the variants syntax and includes inside the variants syntax are incorrectly assuming they were in the top level and thus incorrectly adjusting header levels. Most probably this will be fixed later.

:!: This is still an early version of the plugin with very few features. Even though this plugin could actually be useful in certain cases this is actually thought as a proof of concept.

Installation

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

<ifvar foo=bar>
foo equals bar!
<else>
foo doesn't equal bar!
</ifvar>

Syntax

<ifvar [key][!]=[value]>...[<else>...]</ifvar>
  • [key] is the key that shall be used in the URL/session (in later versions)
  • [value] is the value the value from the URL/session shall be checked against. If != is used, it is checked if the value does not equal the value from the URL/session.
  • An optional else branch can be specified that is shown when the condition is not met

Change Log

ToDo/Wish List

  • Instead of a URL parameter store the choice in the session and offer a syntax that allows the user to view/set this choice
  • Support larger/smaller comparisons instead of just simple equals/doesn't equal tests
  • Some instructions like those that record link information should always be executed regardless if the content is currently visible in order to ensure correct backlink information (for the new pagemove plugin)

Discussion

Please report bugs and feature requests in the issue tracker.

Yes, it works!

Nothing more to say yet, but I think I found another reason to praise michitux! — hh lohmannhh lohmann

2014-12-16 17:19

plugin/variants.txt · Last modified: 2016-01-16 20:34 by Michitux