Tags:
create new tag
view all tags


Question

CanIRenderWikiWordsSpacedOut answers the question as to how to make WikiWords appear unspaced. This works for all such words in the body of the text. But how do you make them appear unsquashed in the Templates (in the footers and the headers)? Any help would be appreciated. Thanks.

  • TWiki version: 2000-12-01
  • Web server: Apache 1.3
  • Server OS: Mandrake 7.2 (Linux 2.2?)

-- TWikiGuest - 03 Apr 2001


Original Answer

I think I figured it out. The following seems to work:

Edit the function handleInternalTags found in Wiki.pm as indicated below.

The order of the lines are important - you can't space the link references, so those substitutions have to be made first. Of course, you will also need to add the spacedWikiWord function as described in CanIRenderWikiWordsSpacedOut.

    #################################################################
    # Changes made  to Space Out Web and Topic Names    ( 4/4/2001)
    # Make these changes to sub handleInternalTags in Wiki.pm
    # Must also have spacedWikiWord function added to Wiki.pm

    # Add this line (This does the link substitution first as we don't want this to be spaced)

    $_[0] =~ s/%WEB%\/% TOPIC%/$_[2]\/$_[1]/go;

    # Delete or comment out the following two lines:

    #$_[0] =~ s/%TOPIC%/$_[1]/go;
    #$_[0] =~ s/%WEB%/$_[2]/go;

    # Replace the above two lines with these:

    $_[0] =~ s/%TOPIC%/&spacedWikiWord($_[1])/geo; 
    $_[0] =~ s/%WEB%/&spacedWikiWord($_[2])/geo;

#####################################################################

-- TWikiGuest April 4, 2001


Alternative Method

Instead of using this, I decided that I wanted %NORMSPACEDTOPIC% to represent a spaced version of %TOPIC% (%SPACEDTOPIC% already exists, and seems to be a URL encoded version). So, I've done the following:

Add this sub in TWiki.pm:

sub handleNormSpacedTopic
{
    my( $theTopic ) = @_;
    my $spacedTopic = $theTopic;
    $spacedTopic =~ s/($singleLowerAlphaRegex+)($singleUpperAlphaNumRegex+)/$1 $2/go; 
    return $spacedTopic;
}

and also add this line in sub handleInternalTags:

    $_[0] =~ s/%NORMSPACEDTOPIC%/&handleNormSpacedTopic($_[1])/ge;

You can now use %NORMSPACEDTOPIC% in any templates or topics. Of course, you can also call this variable anything you like.

-- AdamMcMaster - 09 Mar 2004


Follow-up:

To also space out WikiWords in results from searches (like Index, etc.) do this:

In  WikiSearch.pm in the sub searchWikiWeb, right after the line $tempVal = $repeatText;

comment out or remove the following:

$tempVal =~ s/%WEB%/$thisWebName/go;
$tempVal =~ s/%TOPICNAME%/$topic/go;

and add the following three lines immediately after 
(these lines replace the above 2 and must be in this order to preserve links):

$tempVal =~ s/%WEB%\/%TOPICNAME%/$thisWebName\/$topic/go;
$tempVal =~ s/%WEB%/&spacedWikiWord($thisWebName)/geo;
$tempVal =~ s/%TOPICNAME%/&spacedWikiWord($topic)/geo;



- TWikiGuest 05-April 2001

This presumably will do what I want (display page titles with spaces), but I wonder why we don't consider a TWiki variation that uses names with spaces for files. At times (or almost always, they'd have to be referred to in (double) quotes. I wonder if there are also circumstances when they'd be displayed with %20s in them (like in the address bar). Would URLs have to be typed in with %20s? If so, that's a big downside.

-- RandyKramer - 05 Mar 2003

Or use the latest SpreadSheetPlugin to space out words. Exapmple:

  • You type: %CALC{"$PROPERSPACE(%WIKINAME%)"}%
  • You get: TWiki Guest

-- PeterThoeny - 10 Mar 2004

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2004-03-10 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.