CSV to HTML translation: Difference between revisions

Content added Content deleted
(→‎{{header|Tcl}}: Extra credit version)
Line 272: Line 272:
puts [subst {
puts [subst {
[table {
[table {
[tr [html::quoteFormValue [rows get]] {bgcolor=yellow}]
[tr [html::quoteFormValue [rows get]] {bgcolor="yellow"}]
[html::while {[rows size]} {
[html::while {[rows size]} {
[tr [html::quoteFormValue [rows get]]]
[tr [html::quoteFormValue [rows get]]]
Line 278: Line 278:
}]
}]
}]</lang>
}]</lang>
Output:
<lang html><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>&lt;angry&gt;Now you listen here! He&#39;s not the messiah; he&#39;s a very naughty boy! Now go away! &lt;/angry&gt;</td></tr>
<tr bgcolor="orange"><td>The multitude</td><td>Who are you?</td></tr>
<tr bgcolor="orange"><td>Brians mother</td><td>I&#39;m his mother; that&#39;s who!</td></tr>
<tr bgcolor="orange"><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</table></lang>