CSV to HTML translation: Difference between revisions

m
changed ALL <pre> and <lang html*> to <lang html5>
m (changed ALL <pre> and <lang html*> to <lang html5>)
Line 65:
 
table.tmplt:
<lang htmlhtml5><table>
@@TABLE@@
<tr>
Line 75:
 
Output:
<lang htmlhtml5><table>
<tr>
<td>Character</td>
Line 174:
lmth</lang>
Output:
<lang html5><HTML>
<HTML>
<HEAD>
<TITLE>CSV to HTML translation - Extra Credit</TITLE>
Line 193 ⟶ 192:
</TABLE>
</BODY>
</HTML></lang>
</lang>
 
=={{header|C}}==
This produces a full bare html (tidy gives 1 warning) with styles embedded but not
Line 291 ⟶ 288:
}</lang>
Output:
<pre><nowikilang html5><html><head><title>CSV converted into HTML</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css"><!--th {font-weight:bold;text-align:left;background-color:yellow}table,td,th {border:1px solid #000;border-collapse:collapse}td {background-color:cyan}td,th {padding:5px}//--></style></head><body><table summary="data"><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></nowiki></prelang>
 
=={{header|C++}}==
Line 327 ⟶ 324:
}</lang>
Output:
<lang htmlhtml5>
<TABLE>
<TR><TD>Character</TD><TD>Speech</TD></TR>
Line 383 ⟶ 380:
 
Output:
<prelang html5>&lt;<table cellspacing=&quot;"0&quot;&gt;">
&lt;<thead&gt;>
&lt;<th scope=&quot;"col&quot;&gt;">Character&lt;</th&gt;>
&lt;<th scope=&quot;"col&quot;&gt;">Speech&lt;</th&gt;>
&lt;</thead&gt;>
&lt;<tbody&gt;>
&lt;<th scope=&quot;"row&quot;&gt;">The multitude&lt;</th&gt;>
&lt;<td&gt;>The messiah! Show us the messiah!&lt;</td&gt;>
&lt;<th scope=&quot;"row&quot;&gt;">Brians mother&lt;</th&gt;>
&lt;<td>&gt;&amp;lt;angry&amp;gt;Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!&amp;lt;/angry&amp;gt;&lt;</td&gt;>
&lt;<th scope=&quot;"row&quot;&gt;">The multitude&lt;</th&gt;>
&lt;<td&gt;>Who are you?&lt;</td&gt;>
&lt;<th scope=&quot;"row&quot;&gt;">Brians mother&lt;</th&gt;>
&lt;<td&gt;>I'm his mother; that's who!&lt;</td&gt;>
&lt;<th scope=&quot;"row&quot;&gt;">The multitude&lt;</th&gt;>
&lt;<td&gt;>Behold his mother! Behold his mother!&lt;</td&gt;>
&lt;</tbody&gt;>
&lt;</table&gt;></lang>
</pre>
 
=={{header|Delphi}}==
Line 593 ⟶ 589:
 
'''Basic output:'''
<lang Delphihtml5>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
Line 626 ⟶ 622:
 
'''Extra credit output:'''
<lang Delphihtml5>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
Line 736 ⟶ 732:
}</lang>
Standard output in table.html:
<lang htmlhtml5><table>
<table>
<tr><td>Character</td><td>Speech</td></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 747 ⟶ 742:
</lang>
Output with -h: (Notice <th> tag on first row. Otherwise output is identical.)
<lang htmlhtml5><table>
<table>
<tr><th>Character</th><th>Speech</th></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 821 ⟶ 815:
 
'''Basic output:'''
<div style="height:30ex;overflow:scroll;"><lang htmlhtml5><html>
<head>
<title>Basic</title>
Line 843 ⟶ 837:
 
'''Extra Credit output:'''
<div style="height:30ex;overflow:scroll;"><lang htmlhtml5><html>
<head>
<title>Extra Credit</title>
Line 905 ⟶ 899:
 
'''Basic output:'''
<div style="height:30ex;overflow:scroll;"><lang htmlhtml5><html>
<head>
<title>Basic</title>
Line 946 ⟶ 940:
 
'''Extra Credit output:'''
<div style="height:30ex;overflow:scroll;"><lang htmlhtml5><html>
<head>
<title>Extra Credit</title>
Line 1,022 ⟶ 1,016:
 
;Output:
<div style="height:30ex;overflow:scroll;"><lang htmlhtml5><table>
<tr>
<td>Character</td>
Line 1,075 ⟶ 1,069:
 
Output:
<lang htmlhtml5><TABLE>
<THEAD>
<TR><TD>Character</TD><TD>Speech</TD></TR>
Line 1,128 ⟶ 1,122:
1 makeHTMLtablefromCSV CSVstrng</lang>
HTML output:
<lang htmlhtml5><table>
<tr><th>Character</th><th>Speech</th></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 1,164 ⟶ 1,158:
end</lang>
 
<prelang html5><table>
<tr><td>Character</td><td>Speech</td></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 1,171 ⟶ 1,165:
<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></lang>
</pre>
 
=={{header|MATLAB}}==
Line 1,254 ⟶ 1,247:
 
Ouput:
<lang MATLABhtml5>>> csvToHTML(data)
 
ans =
Line 1,364 ⟶ 1,357:
Sample html output:
 
<lang htmlhtml5><table>
<tr>
<td>Character</td> <td>Speech</td>
Line 1,486 ⟶ 1,479:
 
Output:
<lang htmlhtml5><table>
<thead>
<tr>
Line 1,539 ⟶ 1,532:
Output (with a command-line argument):
 
<lang html4stricthtml5><table>
<tr><th>Character</th><th>Speech</th></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 1,559 ⟶ 1,552:
(prinl) ) ) )</lang>
Output:
<lang htmlhtml5><table class="myStyle">
<tr><td>Character</td><td>Speech</td></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 1,578 ⟶ 1,571:
(prinl) ) ) ) )</lang>
Output:
<lang htmlhtml5><table class="myStyle"><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>
Line 1,592 ⟶ 1,585:
</lang>
Output:
<lang html4stricthtml5><table>
<table>
<colgroup>
<col/>
Line 1,605 ⟶ 1,597:
<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></lang>
</lang>
===Extra credit solution===
<lang Powershell>
Line 1,620 ⟶ 1,611:
</lang>
Output:
<lang html4stricthtml5>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Line 1,702 ⟶ 1,693:
</lang>
OutPut :
<lang htmlhtml5><TABLE>
<TR>
<TD>Character</TD><TD>Speech</TD>
Line 1,816 ⟶ 1,807:
</lang>
Output :
<lang htmlhtml5><TABLE>
<THEAD>
<TR>
Line 1,879 ⟶ 1,870:
'''Sample HTML output'''
 
<lang htmlhtml5><TABLE summary="csv2html program output">
<TBODY><TR><TD>Character</TD><TD>Speech</TD></TR></TBODY>
<TBODY><TR><TD>The multitude</TD><TD>The messiah! Show us the messiah!</TD></TR></TBODY>
Line 1,924 ⟶ 1,915:
The raw HTML would not render correctly through the wiki interface but shows a suitably coloured table with cell borders.
-->
<lang htmlhtml5><TABLE border="1" summary="csv2html extra program output">
<THEAD bgcolor="yellow"><TR><TD>Character</TD><TD>Speech</TD></TR></THEAD>
<TBODY bgcolor="orange"><TR><TD>The multitude</TD><TD>The messiah! Show us the messiah!</TD></TR></TBODY>
Line 1,956 ⟶ 1,947:
end
 
puts "</table>"</lang>Sample output:<lang htmlhtml5><table summary="csv2html program output">
<tr><th>Character</th><th>Speech</th></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 2,041 ⟶ 2,032:
}]</lang>
Output:
<lang html4stricthtml5><table border="1" summary="csv2html program output">
<tr bgcolor="yellow"><td>Character</td><td>Speech</td></tr>
<tr bgcolor="orange"><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
Line 2,091 ⟶ 2,082:
</lang>
=== Output (source code) ===
<lang html4stricthtml5><!DOCTYPE html system>
<!DOCTYPE html system>
<html>
<head>