36 lines
1.5 KiB
Text
36 lines
1.5 KiB
Text
newline$ ="|"
|
|
' No escape behaviour, so can't refer to '/n'.
|
|
' Generally imported csv would have separator CR LF; easily converted first if needed
|
|
|
|
csv$ ="Character,Speech" +newline$+_
|
|
"The multitude,The messiah! Show us the messiah!" +newline$+_
|
|
"Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>" +newline$+_
|
|
"The multitude,Who are you?" +newline$+_
|
|
"Brians mother,I'm his mother; that's who!" +newline$+_
|
|
"The multitude,Behold his mother! Behold his mother!"
|
|
|
|
print "<HTML>"
|
|
print "<HEAD>"
|
|
print "</HEAD>"
|
|
print "<BODY>"
|
|
print "<center><H1>CSV to HTML translation </H1></center>"
|
|
print "<table border=1 cellpadding =10>"
|
|
print "<tr><td>"
|
|
|
|
for i =1 to len( csv$)
|
|
c$ =mid$( csv$, i, 1)
|
|
select case c$
|
|
case "|": print "</td></tr>": print "<tr><td>"
|
|
case ",": print "</td><td>";
|
|
case "<": print "&"+"lt;";
|
|
case ">": print "&"+"gt;";
|
|
case "&": print "&"+"amp;";
|
|
case else: print c$;
|
|
end select
|
|
next i
|
|
|
|
print "</td></tr>"
|
|
print "</table>"
|
|
print "</BODY>"
|
|
print "</HTML>"
|
|
end
|