CSV to HTML translation: Difference between revisions
Content deleted Content added
m changed ALL <pre> and <lang html*> to <lang html5> |
m →[[CSV to HTML translation#ALGOL 68]]: remove trainling spaces and other misc code changes |
||
Line 108:
[6]STRING rows := []STRING(
"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!
);
[max abs char]STRING encoded; FOR i TO UPB encoded DO encoded[i]:=REPR i OD;
encoded[ABS "&"] := "&";
encoded[ABS "<"] := "<";
OP ENCODE = (STRING s)STRING: (
Line 128:
);
PROC head = VOID: (
printf((
$"<HEAD>"l$,
▲ "<TITLE>CSV to HTML translation - Extra Credit</TITLE>",
$"<
$"
$"thead TD {background-color:#ddffdd; text-align:center; }"l$,
"</STYLE>",▼
$"</
))
);
# define HTML tags using Algol68's "reverent" block structuring #
Line 173 ⟶ 175:
ydob;
lmth</lang>
Output:<lang html5><HTML>
<HEAD>
<TITLE>
<STYLE type="text/css">
TD {background-color:#ddddff; }
Line 184 ⟶ 185:
<BODY>
<TABLE>
<TR><TH>Character</TH><TH>Speech
<TR><TD>The multitude</TD><TD>The messiah! Show us the messiah!
<TR><TD>Brians mother</TD><TD><angry
<TR><TD>The multitude</TD><TD>Who are you?
<TR><TD>Brians mother</TD><TD>I'm his mother; that's who!
<TR><TD>The multitude</TD><TD>Behold his mother! Behold his mother!
</TABLE>
</BODY>
</HTML></lang>
=={{header|C}}==
This produces a full bare html (tidy gives 1 warning) with styles embedded but not
|