-
Notifications
You must be signed in to change notification settings - Fork 16
/
Thesaurus.xml
129 lines (101 loc) · 2.27 KB
/
Thesaurus.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, October 13, 2006, 8:55 AM -->
<!-- MuClient version 3.80 -->
<!-- Plugin "Thesaurus" generated by Plugin Wizard -->
<muclient>
<plugin
name="Thesaurus"
author="Nick Gammon"
id="fed86e24fd1ed8a47d97ecb6"
language="Lua"
purpose="Lookup a word in a thesaurus"
date_written="2006-10-13 08:54:06"
requires="3.80"
version="1.0"
>
<description trim="y">
<![CDATA[
Type:
lookup
or
lookup <word>
eg.
lookup eat
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
match="^lookup( (?P<word>.*)){0,1}$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>-- find the word they want
local word = "%<word>"
if #word == 0 then
word = utils.inputbox ("Word to lookup in Thesaurus?", "Thesaurus")
end -- word not supplied
-- nil if dialog cancelled
if not word then
return
end -- cancelled dialog
-- see if in index
local pos = thes [word:lower ()]
-- don't know that word?
if not pos then
utils.msgbox ("The word '" .. word .. "' is not in the Thesaurus", "Not Found")
return
end -- not found
-- seek to it in the main file
thes_file:seek ("set", pos)
-- read that line
local line = thes_file:read ()
-- convert into table
local t = utils.split (line, ",")
-- display in list box
local choice = utils.listbox (
"Matching words for '" .. word ..
"'\\n\\nClick OK to copy to the clipboard", -- message
"Thesaurus: " .. word, -- title
t) -- table of words
if choice then
SetClipboard (t [choice])
end -- if one chosen
</send>
</alias>
</aliases>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="Thesaurus:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function OnPluginInstall ()
thes = {}
local name = GetInfo (66) .. "mobythes.aur"
thes_file = io.input (name)
repeat
local pos = thes_file:seek () --> where we are
local line = thes_file:read () --> read a line
if line then
local w = string.match (line, "[^,]+")
thes [w:lower ()] = pos
end -- of having a line
until not line
ColourNote ("white", "blue", "Thesaurus loaded")
end -- OnPluginInstall
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
]]>
</script>
</muclient>