Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
package require Tcl 8.5
|
||||
package require csv
|
||||
package require html
|
||||
package require struct::queue
|
||||
|
||||
set csvData "Character,Speech
|
||||
The multitude,The messiah! Show us the messiah!
|
||||
Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
|
||||
The multitude,Who are you?
|
||||
Brians mother,I'm his mother; that's who!
|
||||
The multitude,Behold his mother! Behold his mother!"
|
||||
|
||||
struct::queue rows
|
||||
foreach line [split $csvData "\n"] {
|
||||
csv::split2queue rows $line
|
||||
}
|
||||
html::init
|
||||
puts [subst {
|
||||
[html::openTag table {summary="csv2html program output"}]
|
||||
[html::while {[rows size]} {
|
||||
[html::row {*}[html::quoteFormValue [rows get]]]
|
||||
}]
|
||||
[html::closeTag]
|
||||
}]
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package require Tcl 8.5
|
||||
package require csv
|
||||
package require html
|
||||
package require struct::queue
|
||||
|
||||
set csvData "Character,Speech
|
||||
The multitude,The messiah! Show us the messiah!
|
||||
Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
|
||||
The multitude,Who are you?
|
||||
Brians mother,I'm his mother; that's who!
|
||||
The multitude,Behold his mother! Behold his mother!"
|
||||
|
||||
html::init {
|
||||
table.border 1
|
||||
table.summary "csv2html program output"
|
||||
tr.bgcolor orange
|
||||
}
|
||||
|
||||
# Helpers; the html package is a little primitive otherwise
|
||||
proc table {contents {opts ""}} {
|
||||
set out [html::openTag table $opts]
|
||||
append out [uplevel 1 [list subst $contents]]
|
||||
append out [html::closeTag]
|
||||
}
|
||||
proc tr {list {ropt ""}} {
|
||||
set out [html::openTag tr $ropt]
|
||||
foreach x $list {append out [html::cell "" $x td]}
|
||||
append out [html::closeTag]
|
||||
}
|
||||
|
||||
# Parse the CSV data
|
||||
struct::queue rows
|
||||
foreach line [split $csvData "\n"] {
|
||||
csv::split2queue rows $line
|
||||
}
|
||||
|
||||
# Generate the output
|
||||
puts [subst {
|
||||
[table {
|
||||
[tr [html::quoteFormValue [rows get]] {bgcolor="yellow"}]
|
||||
[html::while {[rows size]} {
|
||||
[tr [html::quoteFormValue [rows get]]]
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<table border="1" summary="csv2html program output">
|
||||
<tr bgcolor="yellow"><td>Character</td><td>Speech</td></tr>
|
||||
<tr bgcolor="orange"><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
|
||||
<tr bgcolor="orange"><td>Brians mother</td><td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! </angry></td></tr>
|
||||
<tr bgcolor="orange"><td>The multitude</td><td>Who are you?</td></tr>
|
||||
<tr bgcolor="orange"><td>Brians mother</td><td>I'm his mother; that's who!</td></tr>
|
||||
<tr bgcolor="orange"><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue