You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2018/12/04 16:21:06 UTC

[tcl-rivet] branch master updated: modified color table example. Now version number in AC_INIT is inferred from VERSION

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/master by this push:
     new aeadca5  modified color table example. Now version number in AC_INIT is inferred from VERSION
aeadca5 is described below

commit aeadca50c1cd68306d26e8e0e868458fbdb620b3
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Tue Dec 4 17:20:49 2018 +0100

    modified color table example. Now version number in AC_INIT is inferred from VERSION
---
 ChangeLog                        |   4 ++++
 configure.ac                     |   2 +-
 doc/examples-sgml/colortable.rvt |  46 +++++++++++++++++++++++++++++++++++++++
 doc/examples/colortable.rvt      |  46 +++++++++++++++++++++++++++++++++++++++
 doc/images/color-table.png       | Bin 59362 -> 119287 bytes
 doc/rivet.xml                    |   2 +-
 doc/rivet.xml.in                 |   2 +-
 doc/xml/examples.xml             |   4 ++--
 8 files changed, 101 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b6f026a..384044f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-12-04 Massimo Manghi <mx...@apache.org>
+    * configure.ac: now infer the version number from VERSION.
+    * doc/rivet.xml,doc/xml/examples.xml: modified example "color table"
+
 2018-12-03 Massimo Manghi <mx...@apache.org>
 	* cmake/CMakeList.c: we infer the version number from the file
 	VERSION assumed to reside in the project root directory
diff --git a/configure.ac b/configure.ac
index 9f4cf5b..b652bf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl
 # so you can encode the package version directly into the source files.
 #-----------------------------------------------------------------------
 
-AC_INIT([Rivet],[3.2.0])
+AC_INIT([Rivet],[m4_esyscmd_s([cat VERSION])],[rivet-dev@tcl.apache.org])
 TEA_INIT([3.9])
 
 # we are storing here the configure command line, as recursive
diff --git a/doc/examples-sgml/colortable.rvt b/doc/examples-sgml/colortable.rvt
new file mode 100644
index 0000000..3c21dcf
--- /dev/null
+++ b/doc/examples-sgml/colortable.rvt
@@ -0,0 +1,46 @@
+&lt;html&gt;&lt;head&gt;
+    &lt;style&gt;
+        td { 
+            font-size: 12px;
+            font-family: monospace;
+            text-align: center;
+            padding-left: 3px;
+            padding-right: 3px
+        }
+        td.bright { color: #eee; }
+        td.dark   { color: #222; }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;table&gt;
+&lt;?
+# we create a 9x9 table selecting a different background for each cell
+
+for {set i 0} { $i &lt; 9 } {incr i} {
+    puts &quot;&lt;tr&gt;&quot;
+    for {set j 0} {$j &lt; 9} {incr j} {
+
+        set r [expr int(255 * ($i + $j) / 16)] 
+        set g [expr int(255 * (8 + $j - $i) / 16)]
+        set b [expr int(255 * (abs (4 - $i) + abs(4 - $j)) / 8)]
+
+# determining the background luminosity (YIQ space of NTSC) and choosing
+# the foreground color accordingly in order maintain maximum contrast
+
+        if { [expr ($r*0.29894)+($g*0.58704)+($b*0.11402)] &gt; 148.0} {
+            set cssclass &quot;dark&quot;
+        } else {
+            set cssclass &quot;bright&quot;
+        }
+
+        set cell [format &quot;%3d %3d %3d&quot; $r $g $b]
+
+        puts [format \
+            &quot;&lt;td bgcolor=\&quot;%02x%02x%02x\&quot; class=\&quot;%s\&quot;&gt;%s&lt;/td&gt;&quot; \
+                                            $r $g $b $cssclass $cell]
+    }
+    puts &quot;&lt;/tr&gt;&quot;
+}
+?&gt;
+    &lt;/table&gt;
+&lt;/body&gt;&lt;/html&gt;
diff --git a/doc/examples/colortable.rvt b/doc/examples/colortable.rvt
new file mode 100644
index 0000000..2545a5d
--- /dev/null
+++ b/doc/examples/colortable.rvt
@@ -0,0 +1,46 @@
+<html><head>
+    <style>
+        td { 
+            font-size: 12px;
+            font-family: monospace;
+            text-align: center;
+            padding-left: 3px;
+            padding-right: 3px
+        }
+        td.bright { color: #eee; }
+        td.dark   { color: #222; }
+    </style>
+</head>
+<body>
+    <table>
+<?
+# we create a 9x9 table selecting a different background for each cell
+
+for {set i 0} { $i < 9 } {incr i} {
+    puts "<tr>"
+    for {set j 0} {$j < 9} {incr j} {
+
+        set r [expr int(255 * ($i + $j) / 16)] 
+        set g [expr int(255 * (8 + $j - $i) / 16)]
+        set b [expr int(255 * (abs (4 - $i) + abs(4 - $j)) / 8)]
+
+# determining the background luminosity (YIQ space of NTSC) and choosing
+# the foreground color accordingly in order maintain maximum contrast
+
+        if { [expr ($r*0.29894)+($g*0.58704)+($b*0.11402)] > 148.0} {
+            set cssclass "dark"
+        } else {
+            set cssclass "bright"
+        }
+
+        set cell [format "%3d %3d %3d" $r $g $b]
+
+        puts [format \
+            "<td bgcolor=\"%02x%02x%02x\" class=\"%s\">%s</td>" \
+                                            $r $g $b $cssclass $cell]
+    }
+    puts "</tr>"
+}
+?>
+    </table>
+</body></html>
diff --git a/doc/images/color-table.png b/doc/images/color-table.png
index c05a112..f9eaf3d 100644
Binary files a/doc/images/color-table.png and b/doc/images/color-table.png differ
diff --git a/doc/rivet.xml b/doc/rivet.xml
index 4d8cf4d..89f940f 100644
--- a/doc/rivet.xml
+++ b/doc/rivet.xml
@@ -4,7 +4,7 @@
   "http://www.oasis-open.org/committees/docbook/xml/4.1.2/docbookx.dtd" [
     <!ENTITY hello.rvt             SYSTEM "examples-sgml/hello.rvt" >
     <!ENTITY hello1.rvt            SYSTEM "examples-sgml/hello1.rvt" >
-    <!ENTITY color-table.tcl       SYSTEM "examples-sgml/color-table.tcl" >
+    <!ENTITY colortable            SYSTEM "examples-sgml/colortable.rvt" >
     <!ENTITY vars.html             SYSTEM "examples-sgml/vars.html" >
     <!ENTITY vars.rvt              SYSTEM "examples-sgml/vars.rvt" >
     <!ENTITY upload.html           SYSTEM "examples-sgml/upload.html" >
diff --git a/doc/rivet.xml.in b/doc/rivet.xml.in
index dfdf6b4..df066b6 100644
--- a/doc/rivet.xml.in
+++ b/doc/rivet.xml.in
@@ -4,7 +4,7 @@
   "http://www.oasis-open.org/committees/docbook/xml/4.1.2/docbookx.dtd" [
     <!ENTITY hello.rvt             SYSTEM "examples-sgml/hello.rvt" >
     <!ENTITY hello1.rvt            SYSTEM "examples-sgml/hello1.rvt" >
-    <!ENTITY color-table.tcl       SYSTEM "examples-sgml/color-table.tcl" >
+    <!ENTITY colortable            SYSTEM "examples-sgml/colortable.rvt" >
     <!ENTITY vars.html             SYSTEM "examples-sgml/vars.html" >
     <!ENTITY vars.rvt              SYSTEM "examples-sgml/vars.rvt" >
     <!ENTITY upload.html           SYSTEM "examples-sgml/upload.html" >
diff --git a/doc/xml/examples.xml b/doc/xml/examples.xml
index bc803a2..196268b 100644
--- a/doc/xml/examples.xml
+++ b/doc/xml/examples.xml
@@ -45,9 +45,9 @@
 	   	In another simple example, we dynamically generate a table selecting
 	   	a different background color for each cell. The font color is determined
 	   	through a simple CSS rule embedded in a HTML &lt;style&gt; element. Create
-	   	the file color-table.tcl and put the following code in it
+	   	the file colortable.rvt and put the following code in it
 	  	</para>
-	  	<programlisting>&color-table.tcl;</programlisting>
+	  	<programlisting>&colortable;</programlisting>
 	  	<para>
 	    	If you read the code, you can see that this is pure Tcl.  We
 	    	could take the same code, run it outside of Rivet, and it


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