| 1 | = Flexible WikiPageNames = |
| 2 | |
| 3 | This page describes an experimental feature for having new custom-defined |
| 4 | wiki page names conventions. |
| 5 | |
| 6 | The implementation can be found in the |
| 7 | [source:branches/cboos-dev/flexible-branch flexible] branch. |
| 8 | |
| 9 | Each alternate Wiki Syntax is presented by a `IWikiPageNamesSyntaxProvider`. |
| 10 | By default, there are 3 WikiPageNames syntaxes to choose from. |
| 11 | This can easily be setup in the `[components]` section from the TracIni. |
| 12 | |
| 13 | Furthermore, it makes it easy to take full control of the wiki page names syntax |
| 14 | by writing an additional plugin. |
| 15 | For example, this is what we use: |
| 16 | {{{ |
| 17 | #!python |
| 18 | class BctWikiPageNames(Component): |
| 19 | """Like FlexibleWikiPageNames, but: |
| 20 | * allow initial lower case letter |
| 21 | * allow anything after the slash "/" |
| 22 | """ |
| 23 | |
| 24 | implements(IWikiPageNameSyntaxProvider) |
| 25 | |
| 26 | # IWikiPageNameSyntaxProvider methods |
| 27 | |
| 28 | def get_wiki_page_names_syntax(self): |
| 29 | return (WIKI_START + |
| 30 | r"(?:[A-Z\d]{2,}[a-z]+" # 1st way |
| 31 | r"|[a-z]?[A-Z\d]+[a-z]+(?:/?[A-Z\d]+[a-z]*)+)" + # 2nd way |
| 32 | WIKI_TARGET + WIKI_END) |
| 33 | |
| 34 | }}} |
| 35 | |
| 36 | The `WIKI_START`, `WIKI_TARGET` and `WIKI_END` constants correspond |
| 37 | to pieces of regular expressions that can be reused from syntax provider |
| 38 | to syntax provider. |
| 39 | |