Added in wikicfg.pm Fix problems with multi-level webs referencing other webs and trying to resolve references to 1.2.3. Based on Andrea Sterbini's work from Sep 2000. # ========================= sub extendHandleCommonTags { # This is the place to define customized tags and variables # Called by sub handleCommonTags, after %INCLUDE:"..."% my( $text, $topic, $theWeb ) = @_; # for compatibility for earlier TWiki versions: $text=~ s/%INCLUDE:"(.*?)"%/&handleIncludeFile($1)/geo; $text=~ s/%INCLUDE:"(.*?)"%/&handleIncludeFile($1)/geo; # allow two level includes # do custom extension rule, like for example: # $text=~ s/%WIKIWEB%/$wikiToolName.$theWeb/go; my( $webDottedName ) = $webName; $webDottedName =~ s#/#.#go; $text=~ s/%WEBDOTTED%/$webDottedName/go; # handle the %MODULELIST% if needed $text=~ s/%MODULELIST%/&handleModuleList($theWeb)/geo; return $text; } # ================================================== # replace %MODULELIST% if this web has a topic ModuleList # result is a bit of javascript that allows a "jump to subweb" pulldown. # SGK 19-jan-01 sub handleModuleList { # insert %MODULELIST% if this web has one my ( $theWeb ) = @_; if (-e "$dataDir/$webPath/ModuleList.txt" ) { my $mlist = readTopic("ModuleList"); # we discard the parts before and after the list here # since they exist to make the modulelist topic itself more useful ( $beforeModules, $modulesPart, $afterModules) = split( //, $mlist); # now create the pulldown code $text="
\n"; return $text; } else { return ""; } } # SGK 1/19/01 # handle the top-level web reference in Web1.Web2.Web3 # since Web1 should be a link only if different from current web sub maybeWebLink { my ( $webref, $theWeb ) = @_; if ($webref eq $theWeb) { return ""; } else { my $link = internalLink ($webref, "$mainTopicname", $webref, "", "") ; return " " . $link . ". "; } } # ========================= sub extendGetRenderedVersionOutsidePRE { # This is the place to define customized rendering rules # Called by sub getRenderedVersion, in loop outside of tag
my( $text, $theWeb ) = @_;
# do custom extension rule, like for example:
# s/old/new/go;
# render *_text_* as "bold italic" text:
$text=~ s/(^|\s)\*_([^\s].*?[^\s])_\*(\s|$)/$1$2<\/EM><\/STRONG>$3/go;
# render 3-level dotted web names "Web.Subweb.SubSubWeb.Topic"
# SGK 1/19/01: Webnames must start with capital letter to avoid matching 1.2.3
$text=~ s#(^|\s)([A-Z]+[a-zA-Z0-9]*)\.([A-Z]+[a-zA-Z0-9]*)\.([A-Z]+[a-zA-Z0-9]*)\.([A-Z]+[a-zA-Z0-9]*)#&maybeWebLink($2,$theWeb).&internalLink($2,"$3/$mainTopicname",$3,$1,1).".".&internalLink("$2/$3","$4/$mainTopicname",$4,$1,1).".".&internalLink("$2/$3/$4",$5,$5,$1,1)#geo;
# render 2-level dotted web names "Web.Subweb.Topic"
$text=~ s#(^|\s)([A-Z]+[a-zA-Z0-9]*)\.([A-Z]+[a-zA-Z0-9]*)\.([A-Z]+[a-zA-Z0-9]*)#&maybeWebLink($2,$theWeb).&internalLink($2,"$3/$mainTopicname",$3,$1,1).".".&internalLink("$2/$3",$4,$4,$1,1)#geo;
$_ = $text;
return $_;
}