Namespace Index Plugin#

-- v1, July 2005, DF
-- v2, with improved formatting - ref suggestion by Adler, Sep 2006, DF
-- This page is obsolete! The NamespaceIndexPlugin is now included in NamespacePlugin, as a single package --DF, Aug 12, 2007.

Due to the absence of a hierarchical folder concept in JSPWiki, I am using extensively a dot syntax to group related pages together. (similar to the java package concept) Therefore, I needed a way to generate Index pages of a subset of wiki pages, based on a certain Namespace or page prefix.

   Zoo
   Zoo.Birds
   Zoo.Birds.Flamingo
   Zoo.Birds.Stork
For example, this plugin allows to generate an alphabetical index of all pages of the Zoo.Birds namespace. It would list all pages matching a certain Namespace, or page prefix, in alphabetical order. The links are displayed relative to the namespace base. Have a look at the PageIndex if you don't know how an index of pages looks like. The plugin implementation is based on the IndexPlugin

Related plugin: NamespacePlugin, IndexPlugin

Usage#

The plugin has the similar parameters as the base JSPWiki IndexPlugin, including the undocumented arguments exclude and include. Addditionally, the namespace parameter defines the prefix to be processed.


 [{brushed.jspwiki.namespaceplugin.NamespaceIndexPlugin }]
 [{NamespaceIndexPlugin }]
 [{NamespaceIndexPlugin namespace='UC'  }]
 [{NamespaceIndexPlugin namespace='UC' exclude='Sandbox' itemsPerLine='1' }]

Parameters:
  • namespace : Optional root page of the namespace. All listed pages share the same namespace prefix.
  • include : Optional regular expression which specifies which pages to include. Optional. When a namespace prefix is specified, the plugin automatically includes only all prefixed pages. If needed, this parameter allows you to specify additional include rules.
  • exclude : Optional regular expression which specifies which pages to exclude.
  • itemsPerLine : n. Break every 'n' items on line. Optional, default value is zero.
  • delimiter: Delimiting characters used to breakup the namespace. Default is a dot (.)

Installation notes#

Add following entry to your WEB-INF/jspwiki.properties file when you want to use the short plugin name. Make sure you don't leave any spaces at the end of the property definition.

jspwiki.plugin.searchPath = brushed.jspwiki.namespaceindexplugin,<other class paths>
Copy the Namespace.jar to the WEB-INF/lib directory.

This jar contains 2 plugins: NamespaceIndexPlugin and Namespace )

Finally, restart (or reload) your web-server.

Suggestions#

- instead of creating a very formalised index (list of letters, etc), there could be an option to just do a simple list. For instance if the name space is Zoo, we would get a list with a title Zoo and then the animals: Zoo

  • Birds
    • Flamingo
    • Pelican
  • Mamals
    • Cow
    • Cat

--Adler

That's an excellent suggestion. Indeed, it make sense for hierarchical namespaces to be able to generate this tree like structure. Would you see this as a mixture then, of an alphabetic tree and a hierarchtical tree ? (this is not clear from your example where I would expect cow and cat in the opposite order) --DF
indeed, sure! IMO, it should be alphabetic order. In my example I was just concerned with the organisation and forgot about the order, I'm sorry. (the other items were just luckly in order :) --Adler

- or, especially when you have a quite small number of pages, this could be enough (and saves a lot of space in your page)

  • Birds: Flamingo, Pelican,...
  • Mamals: Cat, Cow,...
Plugin has been updated: The output now contains an alpabetic list of all branches of the namespace, listing per branch all contained sub-pages.

Limiting depth#

What about limiting the depth? So, if I say [{NamespaceIndexPlugin depth=1 }] I would see just:
  • Birds
  • Mamals

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
jar
Namespace.jar 6.1 kB 1 05-Sep-2006 22:23 Dirk Frederickx
jar
NamespaceIndexPlugin.jar 4.8 kB 1 02-Oct-2005 22:45 DirkFrederickx
java
NamespaceIndexPlugin.java 9.4 kB 1 02-Oct-2005 22:45 DirkFrederickx
« This page (revision-23) was last changed on 07-Apr-2010 14:58 by 84.3.36.198