ASP转化成html的新方式

2021-04-02 19:49 jianzhan
早已有许多转化成html的新闻报道系统软件,可是全是用的模版,本涵数完成把asp网页页面造成的html编码储存变成一个html文档,那样就沒有必需修改原先的网页页面便可以轻轻松松进行一个转化成html的新闻报道系统软件了。^_^ 
因为编码较为短,这儿也不开展注解了
 % 
'当总体目标网页页面的包括文档即#include的网页页面里面存有response.End()的情况下本程序不太好 
'留意:文中件一定要放到23.htm偏向的文档的同一文件目录下 
dim hughchiu_rtcode 
Function get_exe_code(23.htm) 
dim execode 
dim tmp_str 
Dim re,re1,content,fso,f,aspStart,aspEnd 
dim ms,m 
execode = "" 
set fso=CreateObject("Scripting.FileSystemObject") 
set f=fso.OpenTextFile(server.mappath(23.htm)) 
content=f.ReadAll 
f.close 
set f=nothing 
set fso=nothing
set re = new regexp 
re.ignorecase = true 
re.global = true 
re.pattern = " %@[^%]+% " 
content = re.replace(content,"")
re.global = false 
re.pattern = " !--s*#includes*files*=s*""([^""]+)""s*-- " 
set ms = re.execute(content) 
if ms.count 0 then 
set m = ms(0) 
tmp_str = get_exe_code(m.submatches(0)) 
content = re.replace(content, tmp_str) 
else 
exit do 
end if 
loop 
set m = nothing 
set ms = nothing
re.pattern="^s*=" 
aspEnd=1 
aspStart=inStr(aspEnd,content," %")+2
set re1=new RegExp 
re1.ignorecase = true 
re1.global = false 
re1.pattern = "response.Write(.+)"
do while aspStart aspEnd+1 
execode = execode vbcrlf " hughchiu_rtcode = hughchiu_rtcode """ replace( replace(Mid(content,aspEnd,aspStart-aspEnd-2),"""",""""""), vbcrlf, """ vbcrlf """) """" vbcrlf 
aspEnd=inStr(aspStart,content,"% ")+2 
tmp_str = Mid(content,aspStart,aspEnd-aspStart-2)
set ms = re1.execute(tmp_str) 
if ms.count 0 then 
set m = ms(0) 
tmp_str = re1.replace(tmp_str, " hughchiu_rtcode = hughchiu_rtcode " m.submatches(0)) 
else 
exit do 
end if 
set m = nothing 
set ms = nothing
execode = execode re.replace(tmp_str,"hughchiu_rtcode = hughchiu_rtcode ")
aspStart=inStr(aspEnd,content," %")+2 
set re1 = nothing 
set re=nothing
execode = execode vbcrlf " hughchiu_rtcode = hughchiu_rtcode """ replace( replace(Mid(content,aspEnd), """", """"""), vbcrlf, """ vbcrlf """ ) """" vbcrlf 
get_exe_code = " %" execode "% " 
End Function
function asp2html(23.htm) 
dim code 
code = replace( replace( replace( get_exe_code(23.htm), "hughchiu_rtcode = hughchiu_rtcode """"" vbcrlf, "" ), " %", "" ), "% ", "" ) 
'response.Write(code) 
execute(code) 
'response.Write( hughchiu_rtcode ) 
asp2html = hughchiu_rtcode 
end function 
%