Version 0 of MetaKit Tips and Tricks

Updated 2005-06-14 02:32:12

A page for code snippets for MetaKit

CMcC found layout format annoying in its terseness, so wrote a simple wrapper to allow comments:

    proc layout {string} {
        set result ""
        foreach line [split $string \n] {
            set line [string trim [lindex [split $line \#] 0]]
            if {$line eq ""} continue
            foreach {name t} [split $line :] break
            if {$t eq ""} {
                set t "S"
            #puts stderr "Layout: $line -> $name:$t"
            append result "$name:$t" \n
        return $result


    set trouble_layout [layout {
        user        # user with trouble
        mid        # message id
        error:I        # error code
        text        # error text

    ::mk::view layout $db.trouble $trouble_layout