Wikify
From Scriptwiki
Script to add links to a script for this wiki.
; $1 = file alias wikify { if ($fopen(in)) { .fclose in } if ($fopen(out)) { .fclose out } .fopen in $1 if ($ferr) { echo -ag Couldn't open $1 | return } .fopen -no out wiki.txt if ($ferr) { echo -ag Couldn't open wiki.txt | return } var %comment while (!$fopen(in).eof) { bunset &line set -l %r $fread(in) if ($len(%r)) { if ($left($strip(%r),2) == /*) { var %comment = 1 } elseif ($left($strip(%r),2) == */) { var %comment = 0 } if ($left($strip(%r),1) != ;) && (!%comment) { set -l %r $regsubex(two,$regsubex(one,%r,/((?:^\s*|\x7B\s+|\x7C\s+)[.!]*(?:while|(?:else\s*)?if)\s+)(\((?>[^()]|(?2))*\))(\s+)(\S+)/g,\1\2\3 $+ $makelink(\4)),/(^\s*|\x7B\s+|\x7C\s+)((?:[.!]*else\s+|[.!]*timer\S*\s+(?:-\w+\s+)?(?:\d\d?:\d\d(?::\d\d)?\s+)?\d+\s+\d+\s+)?[^\s\x7B]+)/g,\1 $+ $makelink(\2)) set -l %r $regsubex(%r,/(?<=^|\s|\x28|!|\x2C)(\$[^\s\(\)\x2C]+\x28?|\$\x28)/g,$makelink2(\1)) } bset &line 2 $regsubex(%r,/(.)/g,$asc(\1) $+ $chr(32)) } bset &line 1 32 .fwrite -bn out &line } .fclose in .fclose out run wiki.txt } ; $1 = command alias -l makelink { var %c = $regsubex($1,/^([.!]+)(.+),\2) , %dot = $regml(1) if ($read(commands.txt,nw,%c *)) { return $+(%dot,$chr(91),$chr(91),$iif($gettok($v1,2,32) == %c,%c,$+($v1,$chr(124),%c)),$chr(93),$chr(93)) } return $1 } ; $1 = $identifier( alias -l makelink2 { ; echo -ag id: $1 ; check for $!bla and $$bla and $$!bla var %id = $1 , %ex , %dbl , %br , %ret , %link , %n if ($mid(%id,2,1) == $) { var %id = $ $+ $right(%id,-2) , %dbl = 1 } if ($mid(%id,2,1) == !) { var %id = $ $+ $right(%id,-2) , %ex = 1 } if ($mid(%id,2,1) isnum 1-) { var %n = %id , %id = $!1 } if ($read(identifiers.txt,nw,%id *)) { var %link = $gettok($v1,2,32) } elseif ($right(%id,1) == $chr(40)) { var %id = $left(%id,-1) , %br = 1 if ($read(identifiers.txt,nw,%id *)) { var %link = $gettok($v1,2,32) } elseif ($read(identifiers.txt,nw,%id $+ *)) { var %link = $gettok($v1,2,32) } } elseif ($read(identifiers.txt,nw,%id $+ *)) { var %link = $gettok($v1,2,32) } if (%link == $null) { return $1 } var %link = $iif((%link != %id) || (%n),%link $+ $chr(124)) , %id = $iif(%n,%n,%id) if (%dbl) { var %ret = $+($chr(91),$chr(91),$$[[$$|]],$chr(93),$chr(93),$iif(%ex,$+($chr(91),$chr(91),!,$chr(93),$chr(93)))) } elseif (%ex) { var %ret = $+($chr(91),$chr(91),$,!,$chr(93),$chr(93)) } ; echo -ag return: $+(%ret,$chr(91),$chr(91),%link,$iif(%dbl || %ex,$right(%id,-1),%id),$chr(93),$chr(93),$iif(%br,$chr(40))) return $+(%ret,$chr(91),$chr(91),%link,$iif(%dbl || %ex,$right(%id,-1),%id),$chr(93),$chr(93),$iif(%br,$chr(40))) }
commands.txt
Abook Abook Ajinvite Ajinvite Alias Alias Aline Aline Ame Ame Amsg Amsg Anick Anick Aop Aop Auser Auser Autojoin Autojoin Avoice Avoice Background Background Ban Ban Bcopy Bcopy Beep Beep Bread Bread Break Break Breplace Breplace Bset Bset Btrunc Btrunc Bunset Bunset Bwrite Bwrite Channel Channel Clear Clear Clearall Clearall Clipboard Clipboard Close Close Cnick Cnick Color Color Continue Continue Copy Copy Ctcp Ctcp Ctcpreply Ctcpreply Ctcps Ctcps Dde Dde Ddeserver Ddeserver Debug Debug Dec Dec Describe Describe Did Did Disconnect Disconnect Dlevel Dlevel Dns Dns Dqwindow Dqwindow Ebeeps Ebeeps Echo Echo Editbox Editbox Else If-Then-Else Elseif If-Then-Else Emailaddr Emailaddr Enable Enable Events Events Exit Exit Fclose Fclose Filter Filter Findtext Findtext Firewall Firewall Flash Flash Flist Flist Flood Flood Flush Flush Flushini Flushini Fopen Fopen Fseek Fseek Fullname Fullname Fwrite Fwrite Goto Goto Groups Groups Guser Guser Hadd Hadd Haltdef Haltdef Hdec Hdec Hdel Hdel Help Help Hfree Hfree Hinc Hinc Hload Hload Hmake Hmake Hop Hop Hsave Hsave Ial Ial Ialclear Ialclear Ialmark Ialmark If If-Then-Else Ignore Ignore Inc Inc Iuser Iuser Join Join Linesep Linesep Load Load Loadbuf Loadbuf Localinfo Localinfo Log Log Menubar Menubar Mkdir Mkdir Mnick Mnick Msg Msg Noop Noop Notify Notify Omsg Omsg Onotice Onotice Partall Partall Play Play Pop Pop Protect Protect Pvoice Pvoice Qme Qme Qmsg Qmsg Query Query Queryrn Queryrn Remini Remini Remote Remote Remove Remove Rename Rename Resetidle Resetidle Return Return Rlevel Rlevel Rmdir Rmdir Run Run Ruser Ruser Save Save Saveini Saveini Say Say Server Server Set Set Setlayer Setlayer Signal Signal Sockaccept Sockaccept Sockclose Sockclose Socklist Socklist Socklisten Socklisten Sockmark Sockmark Sockopen Sockopen Sockread Sockread Sockrename Sockrename Sockudp Sockudp Sockwrite Sockwrite Speak Speak Switchbar Switchbar Timer Timer Timers Timers Timestamp Timestamp Titlebar Titlebar Tnick Tnick Tokenize Tokenize Toolbar Toolbar Treebar Treebar Ulist Ulist Unset Unset Unsetall Unsetall Updatenl Updatenl Userhost Userhost Uwho Uwho Var Local_Variables Vol Vol While While loops Winhelp Winhelp Write Write Writeini Writeini
identifiers.txt
$$ $$ $& $& $* $* $0 $0 $1 $1- $abook $abook $abs $abs $acos $acos $active $active $activecid $activecid $activewid $activewid $adate $adate $address( $address_(nick) $address $address_(remote) $addtok $addtok $addtokcs $addtokcs $agent $agent $agentname $agentname $agentstat $agentstat $agentver $agentver $alias $alias $and $and $anick $anick $aop $aop $appactive $appactive $appstate $appstate $asc $asc $asctime $asctime $asin $asin $atan $atan $avoice $avoice $away $away $awaymsg $awaymsg $awaytime $awaytime $base $base $beta $beta $bfind $bfind $bitoff $bitoff $biton $biton $bits $bits $bvar $bvar $bytes $bytes $calc $calc $cb $cb $cd $cd $ceil $ceil $chan( $chan_(window) $chan $chan_(remote) $chanmodes $chanmodes $chantypes $chantypes $chat $chat $chr $chr $cid $cid $clevel $clevel $click $click $cmdbox $cmdbox $cmdline $cmdline $cnick $cnick $color $color $comchan $comchan $compact $compact $cos $cos $count $count $cr $cr $crc $crc $crlf $crlf $ctime $ctime $ctrlenter $ctrlenter $date $date $day $day $daylight $daylight $dde $dde $ddename $ddename $decode $decode $deltok $deltok $devent $devent $dialog $dialog $did $did $disk $disk $dlevel $dlevel $dname $dname $duration $duration $ebeeps $ebeeps $editbox $editbox $encode $encode $error $error $eval $eval $evalnext $evalnext $exists $exists $file $file $filename $filename $filtered $filtered $finddir $finddir $finddirn $finddirn $findfile $findfile $findfilen $findfilen $findtok $findtok $findtokcs $findtokcs $fline $fline $floor $floor $fserve $fserve $fulldate $fulldate $fullname $fullname $fullscreen $fullscreen $getdir $getdir $getdot $getdot $gettok $gettok $gmt $gmt $hfind $hfind $hget $hget $highlight $highlight $hnick $hnick $host $host $hotline $hotline $hotlinepos $hotlinepos $ial $ial $ibl $ibl $idle $idle $iel $iel $ifmatch $ifmatch $ignore $ignore $iif $iif $iil $iil $inellipse $inellipse $ini $ini $inpoly $inpoly $inrect $inrect $inroundrect $inroundrect $insong $insong $instok $instok $int $int $ip $ip $isalias $isalias $isbit $isbit $isdde $isdde $isdir $isdir $isfile $isfile $isid $isid $islower $islower $istok $istok $istokcs $istokcs $isupper $isupper $lactivecid $lactivecid $left $left $len $len $level $level $lf $lf $line $line $lines $lines $lock $lock $locked $locked $log $log $logdir $logdir $logstamp $logstamp $logstampfmt $logstampfmt $longfn $longfn $longip $longip $lower $lower $maddress $maddress $mask $mask $matchtok $matchtok $matchtokcs $matchtokcs $md5 $md5 $me $me $menubar $menubar $mid $mid $mircdir $mircdir $mircexe $mircexe $mircini $mircini $mklogfn $mklogfn $mklogfn $mklogfn $mnick $mnick $mode $mode $modespl $modespl $mouse $mouse $msfile $msfile $network $network $nick( $nick_(nick) $nick $nick_(remote) $nofile $nofile $nopath $nopath $not $not $notags $notags $notify $notify $null $null $numtok $numtok $online $online $onpoly $onpoly $opnick $opnick $or $or $ord $ord $os $os $pi $pi $pi $pi $pic $pic $play $play $port $port $portable $portable $portfree $portfree $pos $pos $prefix $prefix $prop $prop $protect $protect $puttok $puttok $qt $qt $rand $rand $rawmsg $rawmsg $read $read $readini $readini $readn $readn $regex $regex $regml $regml $regsub $regsub $regsubex $regsubex $remote $remote $remove $remove $remtok $remtok $remtokcs $remtokcs $replace $replace $replacecs $replacecs $replacex $replacex $replacexcs $replacexcs $reptok $reptok $reptokcs $reptokcs $result $result $rgb $rgb $right $right $round $round $scid $scid $scon $scon $scriptdir $scriptdir $sdir $sdir $server $server $serverip $serverip $sfile $sfile $sha1 $sha1 $shortfn $shortfn $show $show $signal $signal $sin $sin $sline $sline $snick $snick $snicks $snicks $snotify $snotify $sock $sock $sockname $sockname $sorttok $sorttok $sorttokcs $sorttokcs $sqrt $sqrt $ssl $ssl $sslready $sslready $status $status $str $str $strip $strip $style $style $submenu $submenu $switchbar $switchbar $tan $tan $ticks $ticks $time $time $timestamp $timestamp $timestampfmt $timestampfmt $timezone $timezone $tip $tip $toolbar $toolbar $treebar $treebar $true $true $trust $trust $ulevel $ulevel $ulist $ulist $upper $upper $uptime $uptime $v1 $v1 $v2 $v1 $version $version $vnick $vnick $vol $vol $width $width $wildtok $wildtok $wildtokcs $wildtokcs $window( $window_(remote) $window $window_(picwin) $wrap $wrap $xor $xor $+ DollarPlus