Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: runFiddle Arguments: name Description: Page type: webl Render function: Module: siteutil Page source: var finfoCss = (Wub_GetFunctionInfo(name + "Css") ? nil); var finfoJs = (Wub_GetFunctionInfo(name + "Js") ? nil); var finfoHtml = (Wub_GetFunctionInfo(name + "Html") ? nil); var s = ` <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> `; // CSS var css = finfoCss.exec ? "====="; var cssImports = []; var cssContent = ""; var i = Str_IndexOf("=====", css); if (i >= 0) then cssImports = Str_Split(Select(css, 0, i), "\n"); cssContent = Str_Trim(Select(css, i+5, Size(css))); end; every imp in cssImports do s = s + ` <link rel="stylesheet" type="text/css" href="` + Str_Trim(imp) + `">` + "\n"; end; // JS var js = finfoJs.exec ? "====="; var jsImports = []; var jsContent = ""; i = Str_IndexOf("=====", js); if (i >= 0) then jsImports = Str_Split(Select(js, 0, i), "\n"); jsContent = Select(js, i+5, Size(js)); end; jsContent = `var OPTIONALARGS = ` + ToString(OPTIONALARGS) + ";\n" + jsContent; s = s + ` <!-- --------- JS IMPORTS ---------- --> `; every imp in jsImports do s = s + ` <script type="text/javascript" src="` + Str_Trim(imp) + `"></script>` + "\n"; end; if cssContent != "" then s = s + ` <!-- --------- CSS ---------- --> <style type="text/css">` + "\n" + cssContent + "\n </style>\n" end; var html = finfoHtml.exec ? ""; s = s + ` </head> ` + html; if jsContent != "" then s = s + ` <script type="text/javascript"> ` + jsContent + ` </script>` + "\n"; end; s = s + ` </html> `; NewPage(s, "text/html");