There is no standard way to extract a web/topic name pair from a string; some uses expand MAINWEB and TWIKIWEB, some use different defaults for the web, and plugins are even worse. This caused a "bug", because a user reasonably expected a %MAINWEB expansion but didn't happen.
The proposal here is to:
- Publish
normalizeWebTopicName via the func interface, so that plugins can benefit from the default
- Standardise usage throughout the TWiki code
Spec from
FuncDotPm:
---+++ normalizeWebTopicName($web, $topic) -> ($web, $topic)
| Description: | Parse a web and topic name, supplying defaults as appropriate. |
| Parameter: =$web= | Web name, identifying variable, or empty string |
| Parameter: =$topic= | Topic name, may be a web.topic string, required. |
| Return: | the parsed Web/Topic pair.
| Since: | TWiki::Plugins::VERSION 1.026 |
| *Input* | *Return* |
| <tt>( "Web", "Topic" ) </tt> | <tt>( "Web", "Topic" ) </tt> |
| <tt>( "", "Topic" ) </tt> | <tt>( "Main", "Topic" ) </tt> |
| <tt>( "", "" ) </tt> | <tt>( "Main", "WebHome" ) </tt> |
| <tt>( "", "Web/Topic" ) </tt> | <tt>( "Web", "Topic" ) </tt> |
| <tt>( "", "Web.Topic" ) </tt> | <tt>( "Web", "Topic" ) </tt> |
| <tt>( "Web1", "Web2.Topic" )</tt> | <tt>( "Web2", "Topic" ) </tt> |
| <tt>( "%MAINWEB%", "Topic" )</tt> | <tt>( "Main", "Topic" ) </tt> |
| <tt>( "%TWIKIWEB%", "Topic" )</tt> | <tt>( "TWiki", "Topic" ) </tt> |
where =Main= and =TWiki= are the web names set in $cfg{UsersWebName} and $cfg{SystemWebName} respectively.
Done in
DevelopBranch r3717
--
CrawfordCurrie - 28 Feb 2005
Good reasoning Crawford.
--
PeterThoeny - 01 Mar 2005