[Home]WikiPatches/UnBracketText

UseModWiki | WikiPatches | RecentChanges | Preferences

Option to eliminate surrounding brackets from $BracketText

In config and wiki.pl, change $BracketText's line to be

$BracketText = 1;       # 1 = allow [URL text],   0 = no link descriptions, 2 = allow, but don't emit surrounding brackets
Add to StoreBracketUrl?

 sub StoreBracketUrl {
   my ($url, $text) = @_;
   if ($text eq "") {
     $text = &GetBracketUrlIndex($url);
   }
   return &StoreRaw("<a href=\"$url\">$text</a>") if 2 == $BracketText;
   return &StoreRaw("<a href=\"$url\">[$text]</a>");
 }

and similarly to StoreBracketLink?:

  sub StoreBracketLink {
    my ($name, $text) = @_;
    return &StoreRaw(&GetPageLinkText($name, "$text")) if 2 == $BracketText;
    return &StoreRaw(&GetPageLinkText($name, "[$text]"));
  }

and StoreBracketInterPage?:

  sub StoreBracketInterPage {
    my ($id, $text) = @_;
    my ($site, $remotePage, $url, $index);
    ($site, $remotePage) = split(/:/, $id, 2);
    $remotePage =~ s/&/&/g;  # Unquote common URL HTML
    $url = &GetSiteUrl($site);
    if ($text ne "") {
      #return "[$id]"  if ($url eq "");
      if ($url eq "") {
        return "$id $text" if 2 == $BracketText;
        return "[$id $text]";
      }
    } else {
      #return "[$id]"  if ($url eq "");
      if ($url eq "") {
        return "$id" if 2 == $BracketText;
        return "[$id]";
      }
      $text = &GetBracketUrlIndex($id);
    }
    $url .= $remotePage;
    return &StoreRaw("<a href=\"$url\">$text</a>") if 2 == $BracketText;
    return &StoreRaw("<a href=\"$url\">[$text]</a>");
  }


Great idea... couldn't get it to work though. -- MatthewSimpson

Please be more specific. I have something almost exactly the same running on our intranet wiki. I'm tempted to add this to the NextRelease with the MeatballWiki patches. -- SunirShah

Just implemented this. (Yesterday I couldn't even spell Perl, now I am a Perl programmer! Worked better when I removed the ?s. SimonDavis

Should be better now. ;)


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited September 28, 2002 8:28 am by Pembroke-ppp109667.sympatico.ca (diff)
Search: