DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:acmenu

AcMenu Plugin

Compatible with DokuWiki

  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" yes
  • 2017-02-19 "Frusterick Manners" yes

plugin An accordion menu for namespaces and relative pages

Last updated on
2023-02-09
Provides
Syntax
Repository
Source

Tagged with menu, navigation

Description

AcMenu provides an accordion menu which lists the content of namespaces in a tree-like format. The tree is built starting from the namespace where the AcMenu's syntax lives till the very end namespace.

This plugin respects the ACL rules and, moreover, the sneaky_index and hidepages options that come with your DokuWiki configuration.

Installation

Search and install ​the plugin using the Extension ​Manager. Refer to Plugin Installation Instructions on how to install plugins manually.

Syntax

In the sidebar page, use the syntax:

<acmenu>

Examples

Just some screenshots to give you an overall idea of the final result.

Suppose you want to create a sub-wiki in your main one, independent from it, as follows:

+--sidebar.txt
+--start.txt
+--products
|  +--start.txt
|  +--product_a.txt
+--services
|  +--start.txt
|  +--service_a.txt
+--branch
   +--sidebar.txt
   +--start.txt
   +--private
   |  +--start.txt
   |  +--confidential.txt
   +--products
   |  +--start.txt
   |  +--product_b.txt
   +--services
      +--start.txt
      +--service_b.txt

Then you can populate each sidebar.txt in the following manner:

  • in :sidebar.txt
    <acmenu>
  • in :branch:sidebar.txt
    [[..:start| Go Back]]
    <acmenu>

    where the Go Back link is made according to the namespaces criterion.

When a visitor is in :start.txt, the plugin shows the complete namespace tree collapsed except the namespace in which the sidebar.txt, with AcMenu's syntax, is.

If the visitor decides to open the sub-wiki :branch, the AcMenu plugin shows only its sidebar.

To deny access to certain namespaces or pages, the appropriate rule in the ACL management must be set. In addition, it's possible to conceal those namespaces for which the visitor has no read permission defining the sneaky_index option in your Configuration Manager.

Furthermore, it's possible to hide the sidebar.txt and the start.txt pages1) using the hidepages option in your Configuration Manager:

(?<=:)sidebar$|(?<=.:)start$|other-matches

The following image is the behaviour of the AcMenu plugin from the perspective of a user registered.

Since this plugin uses cookies to remember the pages visited (they are automatically deleted as soon as the window browser is closed) if the visitor comes back to :start.txt every namespace untoggled will remain so.

The order in which the directory tree is presented is the following:

  • first, folders from 0-9A-Za-z
  • then, files from 0-9A-Za-z

This means that, if the option useheading is enabled, it's possible to force the order of files using a progressive numeration in the first heading of each file.

Note also that the startpage is intentionally always kept on top of its menu and it's never renamed with its first heading, in order to provide a visual reference for the navigation.

Troubleshooting

Symptom: AcMenu isn't keeping unfolded any previously opened namespace.

Possible solution: be sure that JavaScript and cookies are enabled in your browser, otherwise AcMenu forgets the previously namespaces untoggled whenever a page is loaded.


Development

Known Bugs and Issues

Please, use the relative bug tracker or write here and then I will move there.
Torpedo 2017-03-09 16:32

1)
The explanation of the regular expression used in this example is the following:
  1. alternative matches must be separated by |
  2. to match a word at the end of a line the $ symbol must be used
  3. to be sure that the word to match is preceded by : or by any character . followed by : use (?<= )
With that syntax the following pages will be hidden:
  • :sidebar
  • :namespace:sidebar
  • :namespace:start
Whereas the following one will remain visible:
  • :start
Even if the hidden pages are not listed among the search results, they will still be reachable by typing their exact path in the search bar (eg. sidebar or namespace:sidebar).
plugin/acmenu.txt · Last modified: 2023-02-11 16:28 by torpedo

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