<script src="http://media.bigbossweb.com/corporates/chdlr48tnm8thg95tgh9e4mjgngthemb/website/michelepisani/www.michelepisani.it/jscript/rainbow.min.js"></script>
<p class="container">
<i>GitHub: https://github.com/ccampbell/rainbow</i><br />
<b>Rainbow: support for ASP language</b><br />
@author Michele Pisani - www.michelepisani.it<br />
@version 1.0.0
<pre data-language="asp">
<code><!--#include file="test.asp"-->
<!--#include virtual="/test2.asp"-->
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
function changeTextFunc(a, b, c, mystring)
d = b + c
if cint(a) = cint(d) then
mystring=replace(mystring,"ASP","Classic ASP")
end if
changeTextFunc = mystring
end function
dim mystring = ""
dim position = 0
mystring_empty = true
mystring = "Support ASP for use in Rainbow.js"
if len(trim(mystring)) = 0 then mystring_empty = false
mystring = changeTextFunc(5, 2, 3, mystring)
position = instr(mystring,"ASP")
select case cint(position)
case 0
'operations
response.Write "The word searched is not in the string"
case else
'other operations
response.Write "Great! The word searched is in the string"
end select
dim string_names = ""
sql="select id, name from my_table;" 'query example
set rs=connection.execute(sql)
if not rs.eof then
Do while not rs.eof
string_names = string_names & rs("name") & ","
rs.movenext
Loop
string_names = left(string_names,len(string_names)-1)
end if
rs.close
set rs = nothing
%>
<!-- Eventual HTML code before and after ASP code -->
<%
strTest = ""
For i = 1 To Request.Form.Count
strTest = strTest & Request.Form.Key(i) & ": " & Request.Form.Item(i) & "<br />"
Next
'other examples
session.Timeout = 30
session.Abandon
response.Write request.Form
response.redirect "http://www.michelepisani.it"
'...and more (cicle for, do while, on error resume next, ...)
%>
</code>
</pre>
</p>
CSS
pre {background: #F9F9F9;word-wrap: break-word;margin: 0px;padding: 0px;padding: 10px;color: #525252;font-size: 14px;margin-bottom: 20px;border: solid 1px #C6CACD;overflow-x:scroll;}
pre, code {font-family: 'Monaco', courier, monospace;}
pre .variable.language.asp-tag {color: #525252;background-color: #FFFF00}
pre .comment {color: #57ac57;}
pre .constant.language {color: #0000ff;}
pre .string {color: #960000;}
pre .variable.language.asp-include {color: #57ac57;}
pre .support.function {color: #0092db;}
pre .support.function.suggested {color: #0000ff;}
pre .keyword {color: #0000ff;}
pre .keyword.dot {color: #525252;}
pre .keyword.operator {color: #ff3400;}
/* Only for head of result */
p.container {background: #F9F9F9;word-wrap: break-word;margin: 0px;padding: 0px;padding: 10px;color: #525252;font-size: 14px;margin-bottom: 20px;border: solid 1px #C6CACD;font-family: 'Monaco', courier, monospace;}
JavaScript
/**
* Classic ASP patterns
*
* @author Michele Pisani - www.michelepisani.it
* @version 1.0.0
*/
Rainbow.extend('asp', [
{
'name': 'constant.language',
'pattern': /true|false|null/ig
},
{
'name': 'keyword.dot',
'pattern': /\./g
},
{
'name': 'keyword',
'pattern': /\b(dim|function|end|select|case|for|next|loop|do|while|wend|to|until|exit|then|not|if|else|elseif|option|explicit|on|error|resume|codepage|language|sub|call|set|class|private|public|nothing|let|get|new|const|property|execute?)(?=\(|\b)/ig
},
{
'name': 'support.function',
'pattern': /\b(ubound|replace|len|left|right|asc|chr|instr|lcase|ltrim|rtrim|space|split|strcomp|string|strreverse|trim|ucase|mid|instrrev|cint|cdbl|clng)(?=\(|\b)/ig
},
{
'name': 'support.function.suggested',
'pattern': /\b(.binaryread|.clientcertificate|.cookies|.form|.item|.querystring|.servervariables|.totalbytes|.abandon|.codepage|.contents|.lcid|.sessionid|.staticobjects|.timeout|.value|.count|.key|.addheader|.appendtolog|.binarywrite|.buffer|.cachecontrol|.charset|.clear|.contenttype|.end|.expires|.expiresabsolute|.flush|.isclientconnected|.pics|.redirect|.status|.write)(?=\(|\b)/ig
},
{
//pattern for classic ASP tags
'name': 'variable.language.asp-tag',
'pattern': /(<\%|\%>)/g
},
{
//pattern for classic ASP comments
'name': 'comment',
'pattern': /([']).*/g
},
{
//pattern for classic ASP string (find all string between each group of double quotes)
'name': 'string',
'pattern': /\".*?\"/g
},
{
//pattern for INCLUDE (file or virtual) and for HTML comment
'name': 'variable.language.asp-include',
'pattern': /(<!--).*(-->)/g
},
{
'name': 'keyword.operator',
'pattern': /\+|\!|\-|&|\||\*|\=/g
}
]);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.