Table of Contents
versionswitch Plugin
Compatible with DokuWiki
- 2025-05-14 "Librarian" unknown
- 2024-02-06 "Kaos" yes
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" unknown
Similar to translation
This plugin is somewhat similar to the translation plugin as it allows to easily jump between page with the same name in different namespaces. As the name suggests it is meant to jump between different named versions of documentation. This is especially useful when documenting software.
The idea is that for new software releases you will copy the old documentation to a new namespace so that users of old releases can still refer to previous versions of the documentation.
Installation
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
Recent updates:
- Version upped (2024-06-19 23:52)
- fix (and test) sorting (2024-06-19 09:05)
- Merge pull request #2 from cosmocode/bot/autofix (2024-06-17 12:27)
- 🤖 Automatic code style fixes (2024-06-17 12:17)
- disable cache in syntax (2024-06-17 12:16)
- upped version (2024-06-17 12:01)
- add some more doc blocks (2024-06-17 12:00)
- optimize for default regex (2024-06-17 11:56)
Configuration
The plugin exposes a single configuration option in the config manager. In it you configure the namespaces that contain version namespaces, with one per line.
A simple setup could look like this:
products:pixelfusion
With this setup a page named products:pixelfusion:7.1:processor
would show the pages products:pixelfusion:7.0:processor
and products:pixelfusion:6.0:processor
as other versions of the same feature.
If you have a more complex setup, you can use a regular expression to match sub namespaces as a second parameter (separated by whitespace). Eg:
products:pixelfusion products:quantumcanvas (latest_release|wip|archive:[^:]+)
This would consider products:quantumcanvas:latest_release:painter
, products:quantumcanvas:wip:painter
and products:quantumcanvas:archive:2022:painter
as versions of the same feature, but would ignore products:quantumcanvas:unrelated:painter
.
Usage
Once installed, the plugin can easily be added to a sidebar using the following syntax:
~~VERSIONSWITCH~~
The version selector will only be shown on pages that are within namespaces as per configured above.
The shown versions will take their name from the respective namespaces' start page title if any. ACLs are always honored when showing versions - non readable versions will not be shown.
Alternatively to the syntax, template authors can include the functionality directly into their template:
$vswitch = plugin_load('syntax', 'versionswitch'); if ($vswitch) { echo $vswitch->versionSelector() }