scripts/CodeMirror/mode/tcl/index.html (view raw)
1<!doctype html>
2
3<title>CodeMirror: Tcl mode</title>
4<meta charset="utf-8"/>
5<link rel=stylesheet href="../../doc/docs.css">
6
7<link rel="stylesheet" href="../../lib/codemirror.css">
8<link rel="stylesheet" href="../../theme/night.css">
9<script src="../../lib/codemirror.js"></script>
10<script src="tcl.js"></script>
11<script src="../../addon/scroll/scrollpastend.js"></script>
12<div id=nav>
13 <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
14
15 <ul>
16 <li><a href="../../index.html">Home</a>
17 <li><a href="../../doc/manual.html">Manual</a>
18 <li><a href="https://github.com/codemirror/codemirror">Code</a>
19 </ul>
20 <ul>
21 <li><a href="../index.html">Language modes</a>
22 <li><a class=active href="#">Tcl</a>
23 </ul>
24</div>
25
26<article>
27<h2>Tcl mode</h2>
28<form><textarea id="code" name="code">
29##############################################################################################
30## ## whois.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help ## ##
31##############################################################################################
32## To use this script you must set channel flag +whois (ie .chanset #chan +whois) ##
33##############################################################################################
34## ____ __ ########################################### ##
35## / __/___ _ ___ _ ___/ /____ ___ ___ ########################################### ##
36## / _/ / _ `// _ `// _ // __// _ \ / _ \ ########################################### ##
37## /___/ \_, / \_, / \_,_//_/ \___// .__/ ########################################### ##
38## /___/ /___/ /_/ ########################################### ##
39## ########################################### ##
40##############################################################################################
41## ## Start Setup. ## ##
42##############################################################################################
43namespace eval whois {
44## change cmdchar to the trigger you want to use ## ##
45 variable cmdchar "!"
46## change command to the word trigger you would like to use. ## ##
47## Keep in mind, This will also change the .chanset +/-command ## ##
48 variable command "whois"
49## change textf to the colors you want for the text. ## ##
50 variable textf "\017\00304"
51## change tagf to the colors you want for tags: ## ##
52 variable tagf "\017\002"
53## Change logo to the logo you want at the start of the line. ## ##
54 variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
55## Change lineout to the results you want. Valid results are channel users modes topic ## ##
56 variable lineout "channel users modes topic"
57##############################################################################################
58## ## End Setup. ## ##
59##############################################################################################
60 variable channel ""
61 setudef flag $whois::command
62 bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
63 bind raw -|- "311" whois::311
64 bind raw -|- "312" whois::312
65 bind raw -|- "319" whois::319
66 bind raw -|- "317" whois::317
67 bind raw -|- "313" whois::multi
68 bind raw -|- "310" whois::multi
69 bind raw -|- "335" whois::multi
70 bind raw -|- "301" whois::301
71 bind raw -|- "671" whois::multi
72 bind raw -|- "320" whois::multi
73 bind raw -|- "401" whois::multi
74 bind raw -|- "318" whois::318
75 bind raw -|- "307" whois::307
76}
77proc whois::311 {from key text} {
78 if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
79 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
80 $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
81 }
82}
83proc whois::multi {from key text} {
84 if {[regexp {\:(.*)$} $text match $key]} {
85 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
86 return 1
87 }
88}
89proc whois::312 {from key text} {
90 regexp {([^\s]+)\s\:} $text match server
91 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Server:${whois::textf} $server"
92}
93proc whois::319 {from key text} {
94 if {[regexp {.+\:(.+)$} $text match channels]} {
95 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Channels:${whois::textf} $channels"
96 }
97}
98proc whois::317 {from key text} {
99 if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
100 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
101 [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
102 }
103}
104proc whois::301 {from key text} {
105 if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
106 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
107 }
108}
109proc whois::318 {from key text} {
110 namespace eval whois {
111 variable channel ""
112 }
113 variable whois::channel ""
114}
115proc whois::307 {from key text} {
116 putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Services:${whois::textf} Registered Nick"
117}
118proc whois::list {nick host hand chan text} {
119 if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
120 namespace eval whois {
121 variable channel ""
122 }
123 variable whois::channel $chan
124 putserv "WHOIS $text"
125 }
126}
127putlog "\002*Loaded* \017\00304\002\[\00306W\003hois\00304\]\017 \002by \
128Ford_Lawnmower irc.GeekShed.net #Script-Help"
129</textarea></form>
130 <script>
131 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
132 theme: "night",
133 lineNumbers: true,
134 indentUnit: 2,
135 scrollPastEnd: true,
136 mode: "text/x-tcl"
137 });
138 </script>
139
140 <p><strong>MIME types defined:</strong> <code>text/x-tcl</code>.</p>
141
142 </article>