tips:autolink
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tips:autolink [2010-03-26 11:57] – 192.54.144.229 | tips: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> | ||
- | # | + | # |
sub substi | sub substi | ||
Line 81: | Line 81: | ||
if($f =~ /($str)/i) | if($f =~ /($str)/i) | ||
{ | { | ||
- | $f =~ s/([\(\)., : | + | $f =~ s/([\(\"\)., : |
- | $f =~ s/ | + | $f =~ s/ |
- | $f =~ s/([\(\)., : | + | $f =~ s/([\(\)., :\"\*{2}\_{2}])($str)$/ |
#print $f."< | #print $f."< | ||
Line 185: | Line 185: | ||
autolink($ARGV[0], | autolink($ARGV[0], | ||
} | } | ||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Deployment ===== | ||
+ | |||
+ | - copy script into your web directory | ||
+ | - create a link page into your wiki (in sample this page is named **autolink** and is on the root page directory) | ||
+ | - cron script each night | ||
+ | | ||
+ | autolink.pl < | ||
+ | |||
+ | | ||
+ | | ||
+ | 40 0 * * * cd / | ||
+ | |||
+ | ===== The link page ===== | ||
+ | |||
+ | * **Only line started with ' | ||
+ | * **no space into table line**, except if you want to match spaces | ||
+ | * it's **case insensitive matching**, " | ||
+ | * **autolink.txt pages are ignored** | ||
+ | * for matchin whole wiki directory ':' | ||
+ | |||
+ | __The analysed line format is :__ | ||
+ | |< | ||
+ | |||
+ | |||
+ | ==== Sample of link page ==== | ||
+ | |||
+ | < | ||
+ | ====== Autolink ====== | ||
+ | |||
+ | == Fruits == | ||
+ | |||
+ | ^ appliance namespace | ||
+ | |fruits|apple|fruits: | ||
+ | |||
+ | == Instruments == | ||
+ | |||
+ | ^ appliance namespace | ||
+ | |instruments: | ||
+ | |instruments: | ||
+ | |||
+ | == All == | ||
+ | |||
+ | ^ appliance namespace | ||
+ | |: | ||
+ | |: | ||
</ | </ | ||
Line 193: | Line 244: | ||
* **apple** to **fruits: | * **apple** to **fruits: | ||
* **flute** to **instruments: | * **flute** to **instruments: | ||
- | * ... | + | * ... |
- | + | ||
- | ===== Discussion ===== | + | |
tips/autolink.1269601040.txt.gz · Last modified: 2010-03-26 11:57 by 192.54.144.229