CSV to HTML translation: Difference between revisions
Content added Content deleted
(→{{header|Go}}: library path update, also enhanced extra credit version) |
|||
Line 1,921: | Line 1,921: | ||
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr> |
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr> |
||
</table></lang> |
</table></lang> |
||
=={{header|Perl 6}}== |
|||
<lang Perl 6> |
|||
my $str = Q¦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!¦; # ww |
|||
my &escape = *.trans([ <& < \>>] => [<& < >> ]); |
|||
my &tag = {"<$^t>"~$^s~"</$^t>"}; # ~~ |
|||
printf |
|||
'<!DOCTYPE html> |
|||
<html> |
|||
<head><title>Some Text</title></head> |
|||
<body><table>%s |
|||
</table></body></html> |
|||
', [~] escape($str).split(/\n/).map(-> $l { |
|||
state $first //= 0; |
|||
tag(([~] $l.split(/','/).map({tag($^a, $first++ ?? 'td' !!'th' )})),'tr')}); |
|||
</lang> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |