Jump to content

CSV to HTML translation: Difference between revisions

m
→‎[[CSV to HTML translation#ALGOL 68]]: remove trainling spaces and other misc code changes
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""""] := "&quot;"; optional #
encoded[ABS "&"] := "&amp;";
encoded[ABS "<"] := "&lt;";
# encoded[ABS ">"] := "&gt;"; optional #
 
OP ENCODE = (STRING s)STRING: (
Line 128:
);
 
PROC head = VOID: (
FORMAT title = $"<TITLE>CSV to HTML translation - Extra Credit</TITLE>",$;
printf(($gl$,
$"<HEAD>"l$,
"<TITLE>CSV to HTML translation - Extra Credit</TITLE>",
$"<STYLE type=""textTITLE>f(title)</css""TITLE>"l$,
$"TD<STYLE {background-color:#ddddff; }type=""text/css"">"l$,
$"thead TD {background-color:#ddffdd; text-align:centerddddff; }"l$,
$"thead TD {background-color:#ddffdd; text-align:center; }"l$,
"</STYLE>",
$"</HEADSTYLE>"l$,
$"</STYLEHEAD>",l$
));
);
 
# define HTML tags using Algol68's "reverent" block structuring #
Line 173 ⟶ 175:
ydob;
lmth</lang>
Output:<lang html5><HTML>
<lang html5><HTML>
<HEAD>
<TITLE>CSV to HTML translation - Extra Creditf(title)</TITLE>
<STYLE type="text/css">
TD {background-color:#ddddff; }
Line 184 ⟶ 185:
<BODY>
<TABLE>
<TR><TH>Character</TH><TH>Speech </TH></TR>
<TR><TD>The multitude</TD><TD>The messiah! Show us the messiah! </TD></TR>
<TR><TD>Brians mother</TD><TD>&lt;angry&gt;>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!&lt;/angry&gt; ></TD></TR>
<TR><TD>The multitude</TD><TD>Who are you? </TD></TR>
<TR><TD>Brians mother</TD><TD>I'm his mother; that's who! </TD></TR>
<TR><TD>The multitude</TD><TD>Behold his mother! Behold his mother! </TD></TR>
</TABLE>
</BODY>
</HTML></lang>
 
=={{header|C}}==
This produces a full bare html (tidy gives 1 warning) with styles embedded but not
Cookies help us deliver our services. By using our services, you agree to our use of cookies.