Feature Proposal: Add a Foswiki::Func::wikifyWebTopicName() API


  • 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.


# 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);




-- Contributors: PaulHarvey - 14 Dec 2011

See Tasks.Item11356

-- PaulHarvey - 14 Dec 2011


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

We've got JQueryWikiWord part of JQueryPlugin that we could use to have a perl equivalent as well. The main use of the jquery function is in a create-new-topic form to create topic names from a topic title, as well as when renaming a topic based on its topic title. It would be a lot more robust to support these operations on the server-side instead of using javascript as it is now done in NatSkin.

-- MichaelDaum - 02 Apr 2014

Regarding the "first space" in squabs. That's deprecated, and as of Foswiki 2.0, removed from the render code. So Squab behaviour is somewhat better defined now. Crawford, this one has been sitting since 2011. What more do you need to drop your objection.

-- GeorgeClark - 13 Nov 2015

Added myself as a committed developer to restart the timer.

-- GeorgeClark - 13 Nov 2015

Parking this proposal and removing myself from the committed developer. We have enough to do, and there is nothing here that anyone is currently asking for.

-- GeorgeClark - 19 Mar 2016
Topic revision: r9 - 19 Mar 2016, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy