Edgewall Software

Version 1 (modified by Christian Boos, 19 years ago) ( diff )

Proposal for easily customizable WikiPageNames rules

Flexible WikiPageNames

This page describes an experimental feature for having new custom-defined wiki page names conventions.

The implementation can be found in the flexible branch.

Each alternate Wiki Syntax is presented by a IWikiPageNamesSyntaxProvider. By default, there are 3 WikiPageNames syntaxes to choose from. This can easily be setup in the [components] section from the TracIni.

Furthermore, it makes it easy to take full control of the wiki page names syntax by writing an additional plugin. For example, this is what we use:

class BctWikiPageNames(Component):
    """Like FlexibleWikiPageNames, but:
     * allow initial lower case letter
     * allow anything after the slash "/"
    """

    implements(IWikiPageNameSyntaxProvider)

    # IWikiPageNameSyntaxProvider methods

    def get_wiki_page_names_syntax(self):
        return (WIKI_START +
                r"(?:[A-Z\d]{2,}[a-z]+"                          # 1st way
                r"|[a-z]?[A-Z\d]+[a-z]+(?:/?[A-Z\d]+[a-z]*)+)" + # 2nd way
                WIKI_TARGET + WIKI_END)

The WIKI_START, WIKI_TARGET and WIKI_END constants correspond to pieces of regular expressions that can be reused from syntax provider to syntax provider.

Note: See TracWiki for help on using the wiki.