30 lines
1 KiB
Text
30 lines
1 KiB
Text
$ include "seed7_05.s7i";
|
|
include "html_ent.s7i";
|
|
|
|
const string: csvData is "\
|
|
\Character,Speech\n\
|
|
\The multitude,The messiah! Show us the messiah!\n\
|
|
\Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>\n\
|
|
\The multitude,Who are you?\n\
|
|
\Brians mother,I'm his mother; that's who!\n\
|
|
\The multitude,Behold his mother! Behold his mother!\n";
|
|
|
|
const proc: main is func
|
|
local
|
|
var string: line is "";
|
|
var string: column is "";
|
|
const array [boolean] string: columnStartTag is [boolean] ("<td>", "<th>");
|
|
const array [boolean] string: columnEndTag is [boolean] ("</td>", "</th>");
|
|
var boolean: firstLine is TRUE;
|
|
begin
|
|
writeln("<table>");
|
|
for line range split(csvData, '\n') do
|
|
write("<tr>");
|
|
for column range split(line, ',') do
|
|
write(columnStartTag[firstLine] <& encodeHtmlContent(column) <& columnEndTag[firstLine]);
|
|
end for;
|
|
writeln("</tr>");
|
|
firstLine := FALSE;
|
|
end for;
|
|
writeln("</table>");
|
|
end func;
|