Feature Proposal: Add a Foswiki::Func::wikifyWebTopicName() API
Motivation
- Normalising user input the same way that
Foswiki::Render does with [<nop>[freestyle text in lines]]
- We have a JS API, but no perl one. That's crazy.
- Where is this feature already
Description and Documentation
The simple goal is to make a
Foswiki::Func::normalizeWebTopicName() equivalent which reproduces the exact behaviour that
Foswiki::Render uses for normalizing text inside
[<nop>[squabs]] as web.topic names, and in fact, both should be using the exact same code.
Examples
# Will try to convert the text in $topic into a valid topic name, upper-casing between words
# as Foswiki::Render does with [[squab links]].
# If there were no valid chars in $topic, return undef for $topic.
# Similarly for $web.
my ($web, $topic) = ('SomeDefaultWeb', 'some ! cr$@(#zy3yy text');
($web, $topic) = Foswiki::Func::wikifyWebTopicName($web, $topic);
Impact
Implementation
--
Contributors: PaulHarvey - 14 Dec 2011
See
Tasks.Item11356
--
PaulHarvey - 14 Dec 2011
Discussion
Tricky. For compatibility, squabs have various undocumented or barely documented behaviours - such as treating the first space differently. Principle is good, though.
Where do you see this being used?
Raising a concern until behaviour is fully described.
--
CrawfordCurrie - 14 Dec 2011
Also need a %MACRO to expose this functionality, see
TrimAllSpaces
--
PaulHarvey - 23 Feb 2012