You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2011/12/06 15:54:10 UTC

svn commit: r1210953 - in /tcl/rivet/branches/rivet-namespace: ChangeLog Makefile.in rivet/rivet-tcl/tablearray.tcl rivet/rivet-tcl/tclIndex

Author: mxmanghi
Date: Tue Dec  6 14:54:10 2011
New Revision: 1210953

URL: http://svn.apache.org/viewvc?rev=1210953&view=rev
Log: (empty)

Added:
    tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl   (with props)
Modified:
    tcl/rivet/branches/rivet-namespace/ChangeLog
    tcl/rivet/branches/rivet-namespace/Makefile.in
    tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tclIndex

Modified: tcl/rivet/branches/rivet-namespace/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/ChangeLog?rev=1210953&r1=1210952&r2=1210953&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/ChangeLog (original)
+++ tcl/rivet/branches/rivet-namespace/ChangeLog Tue Dec  6 14:54:10 2011
@@ -1,4 +1,9 @@
 2011-12-06 Massimo Manghi <mx...@apache.org>
+    * rivet/rivet-tcl/tablearray.tcl: new procedure 'tablearray' prints an array content
+    in an HTML <table> construct. Test procedure, we maybe want to have something more
+    general for printing also dictionaries.
+
+2011-12-06 Massimo Manghi <mx...@apache.org>
     * configure_ac: add new test on Tcl version using AX_VERSION_COMPARE.
 
 2011-12-06 Massimo Manghi <mx...@apache.org>

Modified: tcl/rivet/branches/rivet-namespace/Makefile.in
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/Makefile.in?rev=1210953&r1=1210952&r2=1210953&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/Makefile.in (original)
+++ tcl/rivet/branches/rivet-namespace/Makefile.in Tue Dec  6 14:54:10 2011
@@ -52,6 +52,8 @@ DIST_COMMON = README $(am__configure_dep
 	tclconfig/ltmain.sh tclconfig/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/tclconfig/tcl.m4 \
 	$(top_srcdir)/tclconfig/libtool.m4 \
 	$(top_srcdir)/m4/ax_prefix_config_h.m4 \

Added: tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl?rev=1210953&view=auto
==============================================================================
--- tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl (added)
+++ tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl Tue Dec  6 14:54:10 2011
@@ -0,0 +1,37 @@
+##
+## tablearray <arrayName> ?pattern? ?html-attibutes?
+##
+##	tablearray prints an array data in HTML table
+##	This is good when a table is enough to print consistently
+##	related data. 
+##
+##	arrayName - Name of the array to display
+##	pattern -   Wildcard pattern of variables. An empty string 
+##		    is tantamout a "*" and prints the whole array
+##	html-attributes - list of attribute,value pairs to be put
+##                  in the <table> tag
+##
+## $Id$
+##
+##
+
+namespace eval ::rivet {
+
+    proc tablearray {arrayName {pattern "*"} {htmlAttributes ""}} {
+        upvar 1 $arrayName array
+        if {![array exists array]} {
+            return -code error "\"$arrayName\" isn't an array"
+        }
+        puts -nonewline stdout "<table"
+	foreach {attr attrval} $htmlAttributes {
+	    puts -nonewline " $attr=\"$attrval\""
+	}
+
+	puts "><thead><tr><th colspan=\"2\">$arrayName</th></tr></thead>"
+        puts stdout "<tbody>"
+        foreach name [lsort [array names array $pattern]] {
+            puts stdout [format "<tr><td>%s</td><td>%s</td></tr>" $name $array($name)]
+        }
+        puts stdout "</tbody></table>"
+    }
+}

Propchange: tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tablearray.tcl
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tclIndex
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tclIndex?rev=1210953&r1=1210952&r2=1210953&view=diff
==============================================================================
--- tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tclIndex (original)
+++ tcl/rivet/branches/rivet-namespace/rivet/rivet-tcl/tclIndex Tue Dec  6 14:54:10 2011
@@ -21,6 +21,7 @@ set auto_index(::rivet::lmatch) [list so
 set auto_index(::rivet::read_file) [list source [file join $dir read_file.tcl]]
 set auto_index(::rivet::import_keyvalue_pairs) [list source [file join $dir import_keyvalue_pairs.tcl]]
 set auto_index(::rivet::parray) [list source [file join $dir parray.tcl]]
+set auto_index(::rivet::tablearray) [list source [file join $dir tablearray.tcl]]
 set auto_index(::rivet::wrap) [list source [file join $dir wrap.tcl]]
 set auto_index(::rivet::wrapline) [list source [file join $dir wrap.tcl]]
 set auto_index(::rivet::load_cookies) [list source [file join $dir load_cookies.tcl]]



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org