asp的ubb函数总结

原创 2004年08月22日 23:10:00

aspubb函数<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

function unHtml(content)

unHtml=content

if content <> "" then

unHtml=replace(unHtml,"&","&")

unHtml=replace(unHtml,"<","<")

unHtml=replace(unHtml,">",">")

unHtml=replace(unHtml,chr(34),""")

unHtml=replace(unHtml,chr(13),"<br>")

unHtml=replace(unHtml,chr(32)," ")

'unHtml=ubb(unHtml)

end if

end function

 

function ubb(content)

Dim nowtime,i

ubb=content

nowtime=now()

UBB=Convert(ubb,"code")

UBB=Convert(ubb,"html")

UBB=Convert(ubb,"url")

UBB=Convert(ubb,"color")

UBB=Convert(ubb,"font")

UBB=Convert(ubb,"size")

UBB=Convert(ubb,"quote")

UBB=Convert(ubb,"email")

UBB=Convert(ubb,"img")

UBB=Convert(ubb,"swf")

 

UBB=AutoURL(ubb)

ubb=replace(ubb,"[b]","<b>",1,-1,1)

ubb=replace(ubb,"[/b]","</b>",1,-1,1)

ubb=replace(ubb,"[i]","<i>",1,-1,1)

ubb=replace(ubb,"[/i]","</i>",1,-1,1)

ubb=replace(ubb,"[u]","<u>",1,-1,1)

ubb=replace(ubb,"[/u]","</u>",1,-1,1)

ubb=replace(ubb,"[blue]","<font color='#000099'>",1,-1,1)

ubb=replace(ubb,"[/blue]","</font>",1,-1,1)

ubb=replace(ubb,"[red]","<font color='#990000'>",1,-1,1)

ubb=replace(ubb,"[/red]","</font>",1,-1,1)

for i=1 to 28

ubb=replace(ubb,"{:em"&i&"}","<IMG SRC=emot/emotface/em"&i&".gif></img>",1,6,1)

ubb=replace(ubb,"{:em"&i&"}","",1,-1,1)

next

ubb=replace(ubb,"["&chr(176),"[",1,-1,1)

ubb=replace(ubb,chr(176)&"]","]",1,-1,1)

ubb=replace(ubb,"/"&chr(176),"/",1,-1,1)

' ubb=replace(ubb,"{;em","{:em",1,-1,1)

end function

 

function Convert(ubb,CovT)

Dim cText,startubb,endubb,Lcovt,text,codetext

cText=ubb

startubb=1

do while Covt="url" or Covt="color" or Covt="font" or Covt="size"

startubb=instr(startubb,cText,"["&CovT&"=",1)

if startubb=0 then exit do

endubb=instr(startubb,cText,"]",1)

if endubb=0 then exit do

Lcovt=Covt

startubb=startubb+len(lCovT)+2

text=mid(cText,startubb,endubb-startubb)

codetext=replace(text,"[","["&chr(176),1,-1,1)

codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)

'codetext=replace(codetext,"{:em","{;em",1,-1,1)

codetext=replace(codetext,"/","/"&chr(176),1,-1,1)

select case CovT

case "color"

cText=replace(cText,"[color="&text&"]","<font color='"&text&"'>",1,1,1)

cText=replace(cText,"[/color]","</font>",1,1,1)

case "font"

cText=replace(cText,"[font="&text&"]","<font face='"&text&"'>",1,1,1)

cText=replace(cText,"[/font]","</font>",1,1,1)

case "size"

if IsNumeric(text) then

if text>6 then text=6

if text<1 then text=1

cText=replace(cText,"[size="&text&"]","<font size='"&text&"'>",1,1,1)

cText=replace(cText,"[/size]","</font>",1,1,1)

end if

case "url"

cText=replace(cText,"[url="&text&"]","<a href='"&codetext&"' target=_blank>",1,1,1)

cText=replace(cText,"[/url]","</a>",1,1,1)

case "email"

cText=replace(cText,"["&CovT&"="&text&"]","<a href=mailto:"&text&">",1,1,1)

cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)

end select

loop

startubb=1

do

startubb=instr(startubb,cText,"["&CovT&"]",1)

if startubb=0 then exit do

endubb=instr(startubb,cText,"[/"&CovT&"]",1)

if endubb=0 then exit do

Lcovt=Covt

startubb=startubb+len(lCovT)+2

text=mid(cText,startubb,endubb-startubb)

codetext=replace(text,"[","["&chr(176),1,-1,1)

codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)

'codetext=replace(codetext,"{:em","{;em",1,-1,1)

codetext=replace(codetext,"/","/"&chr(176),1,-1,1)

select case CovT

case "url"

cText=replace(cText,"["&CovT&"]"&text,"<a href='"&codetext&"' target=_blank>"&codetext,1,1,1)

cText=replace(cText,"<a href='"&codetext&"' target=_blank>"&codetext&"[/"&CovT&"]","<a href="&codetext&" target=_blank>"&codetext&"</a>",1,1,1)

case "email"

cText=replace(cText,"["&CovT&"]","<a href=mailto:"&text&">",1,1,1)

cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)

case "html"

codetext=replace(codetext,"<br>",chr(13),1,-1,1)

codetext=replace(codetext," ",chr(32),1,-1,1)

Randomize

rid="temp"&Int(100000 * Rnd)

cText=replace(cText,"[html]"&text,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext,1,1,1)

cText=replace(cText,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"[/html]","代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"</TEXTAREA><INPUT onclick=runEx('"&rid&"') type=button value=运行此段代码 name=Button1 class='Tips_bo'> <INPUT onclick=JM_cc('"&rid&"') type=button value=复制到我的剪贴板 name=Button2 class='Tips_bo'>",1,1,1)

case "img"

cText=replace(cText,"[img]"&text,"<a href="&chr(34)&"about:<img src="&codetext&" border=0>"&chr(34)&" target=_blank><img src="&codetext,1,1,1)

cText=replace(cText,"[/img]"," vspace=2 hspace=2 border=0 alt=::点击图片在新窗口中打开::></a>",1,1,1)

case "code"

cText=replace(cText,"[code]"&text,"以下内容为程序代码<hr noshade>"&codetext,1,1,1)

cText=replace(cText,"以下内容为程序代码<hr noshade>"&codetext&"[/code]","以下内容为程序代码<hr noshade>"&codetext&"<hr noshade>",1,1,1)

case "quote"

atext=replace(text,"[img]","",1,-1,1)

atext=replace(atext,"[/img]","",1,-1,1)

atext=replace(atext,"[swf]","",1,-1,1)

atext=replace(atext,"[/swf]","",1,-1,1)

atext=replace(atext,"[html]","",1,-1,1)

atext=replace(atext,"[/html]","",1,-1,1)

' atext=replace(atext,"{:em","{;em",1,-1,1)

atext=SplitWords(atext,350)

atext=replace(atext,chr(32)," ",1,-1,1)

cText=replace(cText,"[quote]"&text,"<blockquote><hr noshade>"&atext,1,1,1)

cText=replace(cText,"<blockquote><hr noshade>"&atext&"[/quote]","<blockquote><hr noshade>"&atext&"<hr noshade></blockquote>",1,1,1)

case "swf"

cText=replace(cText,"[swf]"&text,"影片地址:<br>"&text&"<br><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>",1,1,1)

cText=replace(cText,"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"[/swf]","<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"</embed></object>",1,1,1)

end select

loop

Convert=cText

end function

使用Objective-C处理UBB标签

有这么个业务需求,抽象出来如下: 展示一条文案,比如“某某人做了某某事”,这里的“某某人”是一个用户的昵称;用户可以修改昵称,修改过后再看之前的文案,“某某人”这个昵称需要跟着变化;文案数据...
  • jasonblog
  • jasonblog
  • 2014年05月23日 10:06
  • 3017

ASP中,UBB代码中,为何Quote不能一段一段地进行引用呢?

UBB.asp代码如下: Const MaxLoopcount=50 function ubb(bod)  'h=2为转换帖,h=1为转换签名 Set re=new RegExp  '声明正则表...
  • zanyeping4763
  • zanyeping4763
  • 2016年12月31日 12:20
  • 89

FTP之quote命令的使用

FTP之quote命令的使用 FTP的quote命令用于将参数逐字发至远程ftp服务器,命令格式为: quote arg1,arg2... 1、quote help 查看q...
  • qq981378640
  • qq981378640
  • 2016年08月21日 09:12
  • 2054

我的php学习笔记(三十六)PHP中开发自己的UBB代码

什么是UBB代码 UBB代码是HTML的一个变种,是Ultimate Bulletin Board (国外一个BBS程序,国内也有不少地方使用这个程序)采用的一种特殊的TAG。UBB代码很简单,虽然...
  • yipiankongbai
  • yipiankongbai
  • 2013年04月21日 00:56
  • 1708

SHELL 十三问

shell十三问,是由来自台湾的一个网友于2003年底至2004年初写的一系列shell知识分享,发表于chinaunix论坛。因为在讲解时有深入浅出,使得一些晦涩的知识变得通俗易懂。虽然已经过去了十...
  • watermelonbig
  • watermelonbig
  • 2017年11月01日 19:51
  • 445

ASP中,UBB代码中,为何Quote不能一段一段地进行引用呢?

UBB.asp代码如下: Const MaxLoopcount=50 function ubb(bod)  'h=2为转换帖,h=1为转换签名 Set re=new RegExp  '声明正则表...
  • banzongwen3744
  • banzongwen3744
  • 2017年01月02日 08:07
  • 117

LaTeX技巧013:quotation,quote环境实现首行缩进2em

前言quotation和quote都是LaTeX中的引用环境,当文章是引用其他文献的内容可以使用该环境,主要表现为引用内容的左右边距比正文要大,quote是没有缩进的,quotation是在quote...
  • ProgramChangesWorld
  • ProgramChangesWorld
  • 2016年06月26日 15:05
  • 2239

quote函数什么意思,怎么用

quote函数  属于urllib库里面的一个函数 屏蔽特殊的字符、比如如果url里面的空格!url里面是不允许出现空格的。 按照标准, URL 只允许一部分 ASCII 字符(数字字母和...
  • qiqiyingse
  • qiqiyingse
  • 2017年04月11日 10:04
  • 3557

【UBB】UBB代码简介

http://baike.baidu.com/link?url=JEDKx14OqvdvpNZjsK4As4er1ey-f-D9BDJ0jncLop0pwS8aCH-bdOfWT7u9N1mBGU9c...
  • horsttnann
  • horsttnann
  • 2014年04月09日 10:12
  • 440

Racket编程指南——2 Racket概要

2 Racket概要  本章提供了一个快速入门的以Racket语言骨架作为背景的指南。有Racket经验的读者可以直接跳到内置数据类型部分。2.1 简单值2.2 简单的定义与表达式2.2.1 定义2....
  • chinazhangyong
  • chinazhangyong
  • 2018年01月06日 21:54
  • 37
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:asp的ubb函数总结
举报原因:
原因补充:

(最多只允许输入30个字)