[Home]WikiPatches/BracketLinksWithAnchor

UseModWiki | WikiPatches | RecentChanges | Preferences

Another nice little patch. This one allows you to write stuff like the following.

[[FooBar#Baz|Suelz]]

It is rendered as Suelz. The important thing is the anchor.

This patch is made as WikiPatches/Where suggests.

--TilmannHolst, 2004-05-29


*** wiki.pl	2004-05-25 18:45:00.000000000 +0200
--- larpwiki-bracket-link-with-anchor.pl	2004-05-25 18:44:34.000000000 +0200
***************
*** 26,31 ****
--- 26,33 ----
  #    59 Temple Place, Suite 330
  #    Boston, MA 02111-1307 USA
  
+ # applied patch: BracketLinksWithAnchor
+ 
  package UseModWiki;
  use strict;
  local $| = 1;  # Do not buffer output (localized for mod_perl)
***************
*** 1637,1642 ****
--- 1639,1646 ----
        # Also, consider that one could write [[Bad Page|Good Page]]?
        s/\[\[$FreeLinkPattern\|([^\]]+)\]\]/&StorePageOrEditLink($1, $2)/geo;
        s/\[\[$FreeLinkPattern\]\]/&StorePageOrEditLink($1, "")/geo;
+       s/\[\[$AnchoredLinkPattern\|([^\]]+)\]\]/&StoreAnchoredLink($1,
+                                                      $2, $3)/geos if $NamedAnchors;
      }
      if ($BracketText) {  # Links like [URL text of link]
        s/\[$UrlPattern\s+([^\]]+?)\]/&StoreBracketUrl($1, $2, $useImage)/geos;
***************
*** 1977,1982 ****
--- 1981,1993 ----
    return &StoreRaw(&GetPageLinkText("$name#$anchor", "[$text]"));
  }
  
+ sub StoreAnchoredLink {
+   my ($name, $anchor, $text) = @_;
+ 
+   return &StoreRaw(&GetPageLinkText("$name#$anchor", "$text"));
+ }
+ 
+ 
  sub StorePageOrEditLink {
    my ($page, $name) = @_;


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited May 29, 2004 2:34 pm by TilmannHolst (diff)
Search: