CSV to HTML translation: Difference between revisions

Content added Content deleted
(→‎{{header|UNIX Shell}}: simpler version (doesn't work with ksh anymore, though))
(Added Arturo implementation)
Line 249: Line 249:
Field : ~[,\n\r]+;
Field : ~[,\n\r]+;
</lang>
</lang>

=={{header|Arturo}}==

<lang rebol>in: {
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!
}

table: function [content]
-> join @["<table>" join content "</table>"]

row: function [data]
-> join @[
"<tr><td>" escape.xml first data "</td>"
"<td>" escape.xml last data "</td></tr>"
]

print table map read.csv in => row</lang>

{{out}}

<pre><table><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>&lt;angry&gt;Now you listen here! He&apos;s not the messiah; he&apos;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&apos;m his mother; that&apos;s who!</td></tr><tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr></table></pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==