- 主题:用tcl写了个html生成工具
需要动态的生成html,之前硬拼一堆tag实在太凌乱,于是写了个结构化的html生成类,现在清爽多了。
本身就是tcl代码,所以里面可以直接使用任意的语句,非常方便。
长这样:
HTML <title> "Tcl HTML demo"
HTML -html {
<head> <title>
<body> {
<table> -class mb_table -style width:100% {
<caption> "Moons of planets"
<tbody> {
<!--> a comment tag to mark the last parameter as a script block
foreach {planet moons} {Mercury 0 Venus 0 Earth 1 Mars 2 Jupiter 53 Saturn 53 Uranus 27 Neptune 14} {
<tr> {<td> - nowrap -align center {<b> $planet} ; <td> $moons}
}
}
}
}
}
--
FROM 218.241.217.*
这不是编辑HTML的,这是程序动态生成,数据和逻辑驱动
【 在 a0123456789q 的大作中提到: 】
: 这比html乱多了。
:
--
FROM 124.64.19.*
中间的那个表怎么动态生成?
另外你这个是生成完echo出来整个的,我这个是运行时实时输出的,跑到哪出到哪,中间可以有任意脚本运行,输出页面内容,浏览器可以同步的显示
【 在 MetalSlugX 的大作中提到: 】
: import html_dsl
: const page = html:
: heads:
: ...................
--
FROM 124.64.19.*
我不用啊,我用tcl
【 在 a0123456789q 的大作中提到: 】
: asp.net 不香吗?
--
FROM 124.64.19.*