21 lines
749 B
Text
21 lines
749 B
Text
infile: "input.csv";
|
|
outfile: "table.html";
|
|
instream: openr(infile);
|
|
outstream: openw(outfile);
|
|
|
|
printf(outstream, "<TABLE border=\"1\">~%");
|
|
nr: 0;
|
|
while (line: readline(instream))#false do (
|
|
nr: nr + 1,
|
|
line: ssubst("<", "<", line),
|
|
line: ssubst(">", ">", line),
|
|
value_list: map(lambda([f], strim(" ", f)), split(line, ",")),
|
|
if nr=1 then printf(outstream, " <THEAD bgcolor=\"yellow\">") else printf(outstream, " <TBODY bgcolor=\"orange\">"),
|
|
printf(outstream, "<TR>"),
|
|
for value in value_list do printf(outstream, "<TD>~a</TD>", value),
|
|
printf(outstream, "</TR>"),
|
|
if nr=1 then printf(outstream, "</THEAD>~%") else printf(outstream, "</TBODY>~%"));
|
|
printf(outstream, "</TABLE>~%");
|
|
|
|
close(instream);
|
|
close(outstream);
|