File: html.tcl

package info (click to toggle)
libapache2-mod-rivet 3.2.0-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 5,868 kB
  • sloc: xml: 8,496; tcl: 7,212; ansic: 6,959; sh: 5,030; makefile: 261; sql: 91; lisp: 78
file content (28 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
###
## html <string> ?arg.. arg.. arg..?
##    Print text with the added ability to pass HTML tags following the string.
##    Example:
##	html "Test" b i
##
##    Will produce:
##	<b><i>Test</i></b>
##
##    string - A text string to be displayed.
##    args   - A list of HTML tags (without <>) to surround <string> in.
##
## $Id$
##
###

namespace eval ::rivet {

    proc html {string args} {
        foreach arg $args { append output <$arg> }
        append output $string
        for {set i [expr {[llength $args] - 1} ]} {$i >= 0} {incr i -1} {
            append output </[lindex [lindex $args $i] 0]>
        }
        puts $output
    }

}