4590305 [rkeene@sledge /home/rkeene/projects/rivet-cgi/rivet-tcl]$ cat -n html.tcl
   1: ###
   2: ## html <string> ?arg.. arg.. arg..?
   3: ##    Print text with the added ability to pass HTML tags following the string.
   4: ##    Example:
   5: ##	html "Test" b i
   6: ##
   7: ##    Will produce:
   8: ##	<b><i>Test</i></b>
   9: ##
  10: ##    string - A text string to be displayed.
  11: ##    args   - A list of HTML tags (without <>) to surround <string> in.
  12: ###
  13: 
  14: proc html {string args} {
  15:     foreach arg $args { append output <$arg> }
  16:     append output $string
  17:     for {set i [expr [llength $args] - 1]} {$i >= 0} {incr i -1} {
  18: 	append output </[lindex [lindex $args $i] 0]>
  19:     }
  20:     puts $output
  21: }
4590306 [rkeene@sledge /home/rkeene/projects/rivet-cgi/rivet-tcl]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2002-01-09 15:55:03