DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:autolink

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:autolink [2010-03-26 12:03] 192.54.144.229tips:autolink [2015-01-29 16:46] (current) – [Sample of link page] 84.204.72.82
Line 7: Line 7:
 ===== Usage ===== ===== Usage =====
  
-this script can used to:+this script can be used to:
  
   * automatically add links to a word   * automatically add links to a word
Line 15: Line 15:
  
 <code perl autolink.pl> <code perl autolink.pl>
- #!/usr/bin/perl+#!/usr/bin/perl
  
 sub substi sub substi
Line 81: Line 81:
             if($f =~ /($str)/i)             if($f =~ /($str)/i)
             {             {
-             $f =~  s/([\(\)., :\*{2}\_{2}])($str)([\)\(., :\*{2}\_{2}])/$1\[\[$ns\|$2\]\]$3/gi; +             $f =~  s/([\(\"\)., :\*{2}\_{2}])($str)([\)\(., :\"\*{2}\_{2}])/$1\[\[$ns\|$2\]\]$3/gi; 
-             $f =~  s/^($str)([\)\(., :\*{2}\_{2}])/\[\[$ns\|$1\]\]/gi; +             $f =~  s/^($str)([\)\(., :\"\*{2}\_{2}])/\[\[$ns\|$1\]\]/gi; 
-             $f =~  s/([\(\)., :\*{2}\_{2}])($str)$/\[\[$ns\|$1\]\]/gi;+             $f =~  s/([\(\)., :\"\*{2}\_{2}])($str)$/\[\[$ns\|$1\]\]/gi;
  
 #print $f."<br/>"; #print $f."<br/>";
Line 185: Line 185:
   autolink($ARGV[0],$ARGV[1]);   autolink($ARGV[0],$ARGV[1]);
 } }
 +
 +
  
  
Line 190: Line 192:
  
  
-===== Deployement =====+===== Deployment =====
  
   - copy script into your web directory   - copy script into your web directory
Line 242: Line 244:
   * **apple** to **fruits:apple** into namesapce **fruits**   * **apple** to **fruits:apple** into namesapce **fruits**
   * **flute** to **instruments:cord:flute** into **instruments:wind**   * **flute** to **instruments:cord:flute** into **instruments:wind**
-  * ...+  * ... 
  
  
  
tips/autolink.1269601403.txt.gz · Last modified: 2010-03-26 12:03 by 192.54.144.229

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki