惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Webroot Blog
Webroot Blog
U
Unit 42
A
About on SuperTechFans
宝玉的分享
宝玉的分享
月光博客
月光博客
C
CERT Recently Published Vulnerability Notes
P
Privacy International News Feed
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Securelist
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
B
Blog
I
Intezer
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
V
V2EX
L
LangChain Blog
AI
AI
G
GRAHAM CLULEY
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
Docker
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
I
InfoQ
Y
Y Combinator Blog
C
Comments on: Blog
GbyAI
GbyAI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
H
Help Net Security
Vercel News
Vercel News
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿

博客园 - waemz

数学之美 系列十八 - 矩阵运算和文本处理中的分类问题 文本分类(二)特征权重量化器(文档转向量表示) 文本分类(一)封装分词器 转嘉士伯的Java小屋写的关于编码的文章(三)网页文件的编码 转嘉士伯的Java小屋写的关于编码的文章(二)GB2312,GBK与中文网页 转嘉士伯的Java小屋写的关于编码的文章(一)编码字符集与字符集编码的区别 SVM入门(三)线性分类器Part 2 SVM入门(一)SVM的八股简介 SVM入门(二)线性分类器Part 1 人工神经网络框架AForge学习(三):后向传播学习算法 人工神经网络框架AForge学习(二):Sigmoid激活函数 人工神经网络框架AForge学习(一) 基于朴素贝叶斯分类器的文本分类算法C#版(二) 基于朴素贝叶斯分类器的文本分类算法C#版(一) AderTemplate模版引擎使用分析 ASP.NET纯代码实现伪静态地址(URL重写) 深入浅出工厂模式 在Web应用程序中执行计划任务(多线程) 您未必知道的Js技巧
AderTemplate模版引擎使用分析(二)
waemz · 2008-02-01 · via 博客园 - waemz

Ver2.1还添加了以下操作符:
is - 和调用equal方法相同. Ex: #obj1 is obj2# 会返回if obj1 equal obj2
isnot - 和调用notequal方法相同. Ex: #obj1 isnot obj2#
and - 相当于c#中的&&操作符
or - 相当于c#中的||
lt, lte, gt, gte - lt(less than,即c#中的"<"), lte(less than or equal,即c#中的"<="), gt(greater than 即c#中的">") and gte(greater than or equal,c#中的">="). 当使用数字类型操作时,必须是相同的类型.如果希望比较double和int类型,必须将int转换为double类型(使用cdouble函数).

#varOne lt 3#
#varTwo lte cdbl(3)#
#varThree gt varFour and varFive gte 5.0#

Built In Tags(内置标签???):
IF
你可以使用IF根据表达式有条件的输出文本:

<ad:if test="#booleanexpression#">

<ad:elseif test="#bool#">

<ad:else>

</ad:if>

elseif和else是可选的,当if运算返回真的时候,if代码块中包含的代码将被执行(输出);否则执行elseif运算,然后是else.
Ex:

<ad:if test="#cust.country is "CHINA"#">
You are CHINA customer.
<ad:else>
You are from: #cust.country# country.
</ad:if>

如果cust.country是CHINA的话,输出:you are CHINA customer.

FOREACH
你可以使用foreach对集合内的元素进行循环遍历.

<ad:foreach collection="#collection#" var="cust" index="i">
#i#: #cust.lastname#, #cust.firstname#
</ad:foreach>

假设customers是customer的集合:customers = Customer("Tom", "Jackson"), Customer("Mary", "Foo")
输出将是:
1. Jackson, Tom
2. Foo, Mary
在循环处理中,变量名称将被集合中的元素替换.foreach中的index属性可以省略,它被用来在循环中表示循环标志.开始于1并在每次迭代中自动增加.

FOR
你可以通过一个整数标志来进行FOR循环:

<ad:for from="1" to="10" index="i">
#i#: #customers[i].name#
</ad:for>

SET
Set标签允许设值通过其他表达式:
<ad:set name="var" value="#someexpression#" />
当Set语句执行后,你可以象使用局部变量一样使用var.当存取复杂类型的对象的时候非常有用.
以下写法:

#customers[i].address.firstname#
#customers[i].address.lastname#
#customers[i].address.address1#

可以写成: 

<ad:set name="add" value="#customers[i].address#" />
#add.firstname# 
#add.lastname# 
#add.address1#

Custom Templates(定制模版):
你可以在模版文件中创建自己可调用的的模版.使用Template标签来做:

<ad:template name="ShowCustomer">
#customer.lastname#, #customer.firstname# 
</ad:template>

<ad:showcustomer customer="#cust#" />

你可以为自定义的模版添加任何属性,然后就可以在模版中使用他们.自定义模版也可以使用在它之外定义的任何变量,当调用自定义模版的时候必须在最后加上/或者加关闭标签
Ex:
<ad:showcustomer />
OR
<ad:showcustomer></ad:showcustomer>

Ex:

<ad:template name="bold">
<b>#innerText#</b>
</ad:template>

<ad:bold>#cust.lastname#, #cust.firstname#</ad:bold>

输出: <b>Jackson, Tom</b> (if customer is Tom Jackson)
模版可以嵌套使用:

<ad:template name="italic">#innerText#</ad:template>

<ad:bold><ad:italic>This will be bold and italic</ad:italic></ad:bold>

模版可以嵌套定义:

<ad:template name="doit">
    
<ad:template name="colorme">
    
<font color=#color#>#innerText#</font>
    
</ad:template>
    
<ad:colorme color="blue">colorize me</ad:colorme>
</ad:template>

嵌套定义的模版只能在按照定义顺序在父模版中使用.
也可以在程序中定义模版:

TemplateManager mngr = ;
mngr.AddTemplate(Template.FromString(
"bold""<b>#innerText#</b>"));

现在bold模版可以在以后使用了.

(未完,等续)

AderTemplate官方网站:

http://www.adersoftware.com
AderTemplate dll下载地址:http://www.aspxon.com/ShowSoft/15.aspx
AderTemplate源码下载地址(含有演示):AderTemplate(dll)模版引擎(c#源码)