不知道怎麼使用pre來讓我的網頁排版,看了好多網站,似乎沒有我可以用的..!
這是一段Tcl的code,其實也只是寫給自己而已。
set file [open [lindex [glob *.html] 0] r]
set body [read $file]
close $file
regexp {<div[^>]+>(.*?)</div>} $body dummy body
set result ""
foreach char [split $body ""] {
if {$char == "<"} {set stop 1}
if {$char == ">"} {set stop 0}
if {!$stop && $char == " "} {set char " "}
append result $char
}
set result "<div class=\"code\">${result}</div>"
set file [open result.txt w]
puts $file $result
close $file
exit
set body [read $file]
close $file
regexp {<div[^>]+>(.*?)</div>} $body dummy body
set result ""
foreach char [split $body ""] {
if {$char == "<"} {set stop 1}
if {$char == ">"} {set stop 0}
if {!$stop && $char == " "} {set char " "}
append result $char
}
set result "<div class=\"code\">${result}</div>"
set file [open result.txt w]
puts $file $result
close $file
exit
我想之後還是會面臨很多先進所提出的「code 過長」造成顯示爆表的問題吧,不過那時候再說囉!
沒有留言:
張貼留言