We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Support Web>WebNameAsWikiName (22 Mar 2003, PeterThoeny)
Tags:
create new tag
, view all tags

Question

I understand that Web names cannot be WikiWords, and have tested it out myself to make sure. I'm really needing to allow Web names as WikiWords (like GiftNet? and ArtisticSource? ). Any ideas on how to go about this? If a CVS version of TWiki allows this, that would be great. If not, I'm prepared to hack it in myself. I really need it smile

  • TWiki version: Dec 2001
  • Perl version:
  • Web server: apache
  • Server OS: debian gnu/linux
  • Web browser:
  • Client OS:

-- AdamTheo - 05 Dec 2002

Answer

Some recent work on InternationalisationEnhancements, in CVS, may make this a bit easier (there is now one place where the web name regex is defined), but it probably won't be as simple as just changing that regex. You may also need to add a non-matching lookahead regex elsewhere when matching wiki words, e.g. to make sure that FooBar.WeirdStuff doesn't link FooBar? as a WikiWord rather than as a web name. Of course, in FooBar. WeirdStuff? , the FooBar? is presumably a WikiWord.

You might also need to do some NOPing of web names etc. Overall, I doubt this will be a very simple thing to do, and it may involve some hackiness, but it should be possible.

UPDATE: Just tried this out locally on the latest TWikiAlphaRelease, and it does seem to work with virtually no effort! Here's the patch:

--- TWiki.pm    2002-12-05 20:19:39.000000000 +0000
+++ /twiki/lib/TWiki.pm 2002-12-05 21:02:59.000000000 +0000
@@ -420,7 +422,8 @@
     # Note: qr// locks in regex modes (i.e. '-xism' here) - see Friedl
     # book at http://regex.info/
     $wikiWordRegex = qr/[$upperAlpha]+[$lowerAlpha]+[$upperAlpha]+[$mixedAlphaNum]*/;
-    $webNameRegex = qr/[$upperAlpha]+[$lowerAlphaNum]*/;
+    # $webNameRegex = qr/[$upperAlpha]+[$lowerAlphaNum]*/;
+    $webNameRegex = qr/[$upperAlpha]+[$mixedAlphaNum]+/;
     $defaultWebNameRegex = qr/_[${mixedAlphaNum}_]+/;
     # FIXME: Should really be '+' not '*' - at least one character in
     # anchor

I'm not sure of the longer term implications of doing this, so a lot of testing is recommended, but ManagingWebs in the latest alpha has no problem creating such webs. I've only spent a few minutes looking at this, so I'm sure there will be things that don't work, but I managed to create and link topics, view WebTopicList, WebIndex, and so on.

You can have a topic ArtisticSource? in the web ArtisticSource? , which will be linked if it exists. If you don't want such topics auto-linked in templates, you may want to edit the TWikiPreferences to put some NOPs into some of the settings there.

-- RichardDonkin - 05 Dec 2002

Question

Execellent! Richard, you da man.

One question that just occurred to me is that I don't need for the links to be formed automatically. I am likely going to be using the bracket format to do links most of the time such as [[ArtisticSoource.Home][Artistic Source]]. Do you think this would make the linking to non-WikiWord webs easier?

And thanks for that patch, looks like I'll be upgrading from the dec 2001 release after all smile

UPDATE: hmm... I can't seem to find where to download the Alpha or Beta releases. I filled out that annoying download form, asking for alpha and beta releases, but the email that came doesn't have any info on them. Boy, getting TWiki is such a pain.

-- AdamTheo - 05 Dec 2002

Getting hold of TWikiAlphaReleases and TWikiBetaReleases is clearly documented in the Codev web. Beta is sent to everyone who asks nicely, Alpha can be downloaded at any time (unless the SF web server is down)

-- PeterThoeny - 06 Dec 2002

This patch should work with or without bracket format links, but it does need a lot more testing. InternationalisationEnhancements has had the useful side-effect of modularising the TWiki regexes for key concepts such as web name - it should also be possible for sites to vary the WikiWord format, e.g. to allow (say) I18nEnhancements? as a WikiWord.

Re the alpha / beta downloads - you should really get the beta and then download alpha on top, but if you are in a hurry you can just download the alpha since you already have the Dec 2001 topic files. I've added a line to the TWikiBetaRelease page explaining that you can get the beta download URL from the download form, and the alphas are downloadable directly from the links on the TWikiAlphaRelease page.

There has been some discussion of the current approach to alpha and beta downloads, see AlphaTesting and in particular TWikiBetaReleaseDiscussions.

-- RichardDonkin - 06 Dec 2002

I've been testing out your patch, Mr Donkin. For the past 5 days I've used it in creating new webs (both in the ManagingWebs? and console interfaces), linked to the webs using brackets and non-brackets, deleted webs, then recreated the webs, watched the WebChanges and WebNotify features, and I can safely say that after extensive testing on my system, the patch works without any errors or problems at all.

Any way to get this included in the latest alphas so I won't have to re-apply the patch every few days? smile Also, I'd say that since it seems to be stable on my system, the best way to find any problems with it I didn't catch is to include it in the alphas and see what others find.

Thanks again for the patch, Richard.

-- AdamTheo - 10 Dec 2002

Glad it worked so well - quite unusual in my experience smile ... I don't think this will be going into the core as-is, since it changes the normal definition of web name and would require almost every feature to be tested (including rename, raw mode, and all those odd ones that are rarely used); however, what we could perhaps do is make the web name and WikiWord formats definable in TWiki.cfg, shipping the normal ones as the default. Not sure if this will make it into the core for BeijingRelease but it would be nice if it did.

-- RichardDonkin - 10 Dec 2002

Yes, that would be excellent! If the web name and wikiword formats were defined in the twiki.cfg file, and could be changed, that would solve my problem for now. In fact, could it be taken a step further and define almost all of the regexp's in the twiki.cfg? at least the definition list, underline, and italics regexps since those are the ones I've been changing in my local installation? smile

-- AdamTheo - 13 Dec 2002

Is now in TWikiAlphaRelease, see Codev.WebNameAsWikiName

-- PeterThoeny - 22 Mar 2003

Topic attachments
I Attachment Action Size Date Who Comment
elsepatch WikinamesInWebNames.patch manage 0.8 K 21 Mar 2003 - 16:47 ColasNahaboo Richard patch, ready-to-apply to lib/Twiki.pm
Topic revision: r10 - 22 Mar 2003 - 05:37:19 - PeterThoeny
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback