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
|
# Snd documentation index (generated by index.cl)
# html :play or html "play" ==> the whole string must match
# html(/^play$/) ==> regexp search
def html(str)
url = if str.kind_of?(Regexp)
# x --> ["play", "extsnd.html#sndplay"]
pair = snd_urls().detect do |x| str.match(x[0]) end
if pair.kind_of?(Array)
pair[1]
else
false
end
else
# String or Symbol
snd_url(str.to_s)
end
if url and (not url.empty?)
goto_html(url)
else
snd_print "no url for #{str}?"
false
end
end
def help(str)
snd_help(str) or snd_help(html(str))
end
def goto_html(url)
dir = [Dir.pwd,
html_dir(),
"/usr/doc/snd-11",
"/usr/share/doc/snd-11",
"/usr/local/share/doc/snd-11",
"/usr/doc/snd-10",
"/usr/share/doc/snd-10",
"/usr/local/share/doc/snd-10",
"/usr/doc/snd-8"].detect do |d|
if d.kind_of?(String)
if File.exist?(d + "/" + "snd.html")
d
end
end
end
if dir
case html_program()
when "netscape", "mozilla"
send_mozilla(dir + "/" + url)
else
system(format("%s file:%s/%s &", html_program(), dir, url))
end
else
snd_print "snd.html not found; set_html_dir(path) to appropriate path!"
end
url
end
|