Feature Proposal: Suggested Enhancement to WEB Variable
Motivation
The WEB variable does not work as expected in subwebs. Instead of showing the name of the current (sub)web, it shows the full path back up to the topmost parent web. There needs to be a simple way to show just the name of the current web, without resorting to a plugin.
Description and Documentation
Apparently, a new feature has recently been added
in TWiki that allows for specifying
%WEB{format=current}%
to just get the current webname (last element of the path). This would be handy to keep Foswiki in sync with TWiki.
However, this is a lot to type and not very flexible. What if I want to see, e.g., two levels? Or three?
(Use case: Our home wiki has many levels of subwebs, e.g.
http://wiki.cfcl.com/Projects/Access/Utiles/DS
is a subweb)
Suggestion:
A number that is larger than the maximum actual number of webs in the path would simply return the same value that
%WEB%
returns now.
Examples
Assuming
%WEB%
is
Engineering/TechPubs/Apps
:
%WEB{1}%
returns:
Apps
;
%WEB{2}%
returns:
TechPubs/Apps
, etc.
Impact
No backward compatibility issues.
Implementation
--
Contributors: VickiBrown - 14 Feb 2016
Discussion
Have a look at
WebLinkPlugin.
--
MichaelDaum - 15 Feb 2016
We can't change what
%WEB%
returns, and the
format
parameter that TWiki added is truly, deeply, horrible. Instead of that, I'd favour a
%CURWEB%
(pick a better name) variable that provides what you want.
It's cleaner, simpler to implement, and I'm really not bothered about staying in stync.
--
Main.CrawfordCurrie - 17 Feb 2016 - 09:40