Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: wolframAlpha Arguments: query Description: Call wolfram alpha with a query. By default, return a plaintext answer. Page type: webl Render function: Module: global Page source: var key = Wub_GetVaultValue("wolframalphakey2") ? nil; var res = nil; var format = ""; var html = ""; var P = nil; if key == nil then res = "no key" else format = ""; // "&format=plaintext"; var u = "http://api.wolframalpha.com/v2/query?input=" + Url_Encode(query) + "&appid=" + key + format; P = GetURL(u); html = html + `<div style="background-color:#FFFFFF;">` + "\n"; // get result every pod in Elem(P, "pod") do var title = pod.title ? nil; if title != nil then html = html + "<h3>" + title + "</h3>\n"; end; /* every img in Elem(pod, "img") do html = html + `<img src="` + img.src + `"><br>` + "\n"; end; */ every pt in Elem(pod, "plaintext") do html = html + `<p>` + Str_Trim(Text(pt)) + `</p>` + "\n"; end; if title == "Result" then res = pod end; if (res == nil) and (title != "Input") and Size(Elem(P, "plaintext") inside pod) > 0 then res = pod end end; html = html + "</div>\n"; if (res != nil) then var pt = Elem(P, "plaintext") inside res; if Size(pt) > 0 then res = Str_Trim(Text(pt[0])) end; else res = nil; // u + "<br>\n" + Pretty(P); end end; [. html = html, text = res, raw = Pretty(P) ? "none" .];