CSV to HTML translation: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: Add version with streaming/StringJoiner)
No edit summary
Line 2,885: Line 2,885:
</tbody>
</tbody>
</table>
</table>
</lang>

=={{header|Lambdatalk}}==
<lang scheme>
{def CSV
Character,Speech\n
The multitude,The messiah! Show us the messiah!\n
Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n
The multitude,Who are you\n
Brians mother,I'm his mother; that's who!\n
The multitude,Behold his mother! Behold his mother!\n
}
-> CSV

{def csv2html
{lambda {:csv}
{table
{S.replace ([^,]*),([^_]*)_
by {tr {td €1} {td €2}}
in {S.replace \\n by _ in :csv}}}}}
-> csv2html

{csv2html {CSV}} ->

<table>
<tbody>
<tr>
<td>Character</td>
<td>Speech</td>
</tr>
<tr>
<td> The multitude</td>
<td>The messiah! Show us the messiah!</td>
</tr>
<tr>
<td> Brians mother</td>
<td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry></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>
</tbody>
</table>

</lang>
</lang>