|
ASP言語のソースコード整形例 |
|
|
|
|
|
SourceFormatX は優れた構文解析エンジンを元に作られています。ですのであらゆるスタイルで書かれたソースコードを美しく整形することができます。以下の例のようなめちゃくちゃなコードでさえも、整形することが可能です。
|
これは極端な例ですが。SourceFormatXに搭載されている強力な ASPスクリプト言語 のパーサーエンジンの実力を感じて頂けるかと思います。
<%@ language=VBScript %>
<html>
<head>
<title>Draupnir Software</title>
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#ffffff">
<div align="center">
<table border="1" cellpadding="0" cellspacing="0">
<tr><td width="100%"><%=gbook_name%></td></tr>
</table>
</div>
<%
call htmlend()
Response.End:end sub
sub addto()
dim username, email, homeurl, qq, body, addtime, sql, Rs, ip, face, brow
username=htmlencode2(trim(Request.form("username")))
email=htmlencode2(trim(Request.form("email")))
if username = "" then
message="Your nickname cannot be null!\n"
elseif username = "root" then
message="Your nickname cannot be root!\n"
end if
sql="select * from retain where userid='"&userid&"'"
set nrs = Server.CreateObject("ADODB.Recordset")
nrs.open sql,conn,1,1
do while not nrs.eof
if username <>"" and username = nrs("retain_name") then
message=message&"Your nickname was forbidden by administrator!\n"
end if
nrs.movenext
loop
nrs.close
set nrs = nothing
if email <> "" and IsValidEmail(email)=false then
message=message&"Your email maybe wrong?\n"
end if
if body <> "" and Len(body)> bodymax then
message=message&"Sorry, message length cannot over "&bodymax&" words!\n"
end if
if brow = "" then
brow="image/em01.gif"
end if
if message<> "" then
call error(""&message&"")
else
sql = "select * from gbook"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open sql,conn,3,2
Rs.addnew
Rs("username")=username
Rs("email")=email
Rs("homeurl")=homeurl
Rs("qq")=qq
Rs("body")=body
Rs("face")=face
Rs("brow")=brow
Rs("ip")=ip
Rs("addtime")=now
Rs("userid")=userid
Rs.update
Rs.close
sql="select * from admin where id="&userid
Rs.open sql,conn,3,2
if date <> today_time then
Rs("today_count") = 1
else
Rs("today_count") = Rs("today_count")+1
end if
Rs("today_time") = date
Rs.update
Rs.close
set Rs = nothing
conn.close
set conn = nothing
Response.redirect "index.asp?userid="&userid
Response.End
end if
end sub
%>
</body>
</html>
<%@ language=VBScript %>
<html>
<head>
<title>Draupnir Software</title>
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#ffffff">
<div align="center">
<table border="1" cellpadding="0" cellspacing="0">
<tr><td width="100%"><%=gbook_name%></td></tr>
</table>
</div>
<%
Call htmlend()
Response.End
End Sub
Sub addto()
Dim username, email, homeurl, qq, body, addtime, sql, Rs, ip, face, brow
username = htmlencode2(Trim(Request.form("username")))
email = htmlencode2(Trim(Request.form("email")))
If username = "" Then
message = "Your nickname cannot be null!\n"
ElseIf username = "root" Then
message = "Your nickname cannot be root!\n"
End If
sql = "select * from retain where userid='"&userid&"'"
Set nrs = Server.CreateObject("ADODB.Recordset")
nrs.open sql, conn, 1, 1
Do While Not nrs.EOF
If username <>"" And username = nrs("retain_name") Then
message = message&"Your nickname was forbidden by administrator!\n"
End If
nrs.movenext
Loop
nrs.Close
Set nrs = Nothing
If email <> "" And IsValidEmail(email) = False Then
message = message&"Your email maybe wrong?\n"
End If
If body <> "" And Len(body)> bodymax Then
message = message&"Sorry, message length cannot over "&bodymax&" words!\n"
End If
If brow = "" Then
brow = "image/em01.gif"
End If
If message<> "" Then
Call Error(""&message&"")
Else
sql = "select * from gbook"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open sql, conn, 3, 2
Rs.addnew
Rs("username") = username
Rs("email") = email
Rs("homeurl") = homeurl
Rs("qq") = qq
Rs("body") = body
Rs("face") = face
Rs("brow") = brow
Rs("ip") = ip
Rs("addtime") = Now
Rs("userid") = userid
Rs.update
Rs.Close
sql = "select * from admin where id="&userid
Rs.open sql, conn, 3, 2
If Date <> today_time Then
Rs("today_count") = 1
Else
Rs("today_count") = Rs("today_count") + 1
End If
Rs("today_time") = Date
Rs.update
Rs.Close
Set Rs = Nothing
conn.Close
Set conn = Nothing
Response.redirect "index.asp?userid="&userid
Response.End
End If
End Sub
%>
</body>
</html>
再び手動でASP言語のソースコードを整形するために時を浪費しないで下さい! SourceFormatX体験版の無料ダウンロード!
|